text
stringlengths 0
3.34M
|
---|
(* Adapted from https://github.com/Eelis/hybrid (although the construction is standard) *)
Require Import Coq.Reals.Reals.
Require Import Fourier.
Require Import List.
Require Import Bool.
Require Export Program.
Require Import EquivDec.
Require Import Relation_Definitions.
Require Import Morphisms.
Set Implicit Arguments.
Open Local Scope R_scope.
Ltac hyp := assumption.
Ltac ref := reflexivity.
Ltac destruct_and :=
match goal with
| H: _ /\ _ |- _ => destruct H; destruct_and
| _ => idtac
end.
Section predicate_reflection.
Inductive PredicateType: Type -> Type :=
| PT_Prop: PredicateType Prop
| PT_pred X (T: X -> Type): (forall x, PredicateType (T x)) ->
PredicateType (forall x: X, T x).
(* We would really like PredicateType to be a type class, but unfortunately
we cannot make it one with the way type classes currently work. Hence,
we introduce the following: *)
Class IsPredicateType (T: Type): Type := is_PT: PredicateType T.
Instance PT_Prop_instance: IsPredicateType Prop := PT_Prop.
Instance PT_pred_instance (X: Type) (T: X -> Type) (U: forall x, IsPredicateType (T x)):
IsPredicateType (forall x: X, T x) := PT_pred T U.
Variables
(F: forall T: Type, T -> Type)
(A: forall P: Prop, F P)
(B: forall (U: Type) (R: U -> Type) (p: forall u, R u)
(i: forall u, PredicateType (R u)), (forall u, F (p u)) -> F p).
Definition pred_rect (T: Type) (i: IsPredicateType T) (t: T): F t.
Proof.
induction i.
apply A.
exact (B T t p (fun u => X0 u (t u))).
Defined.
End predicate_reflection.
Existing Instance PT_Prop_instance.
Existing Instance PT_pred_instance.
Class decision (P: Prop): Set := decide: { P } + { ~ P }.
Program Instance decide_conjunction {P Q: Prop} `{Pd: decision P} `{Qd: decision Q}: decision (P /\ Q) :=
match Pd, Qd with
| right _, _ => right _
| _, right _ => right _
| left _, left _ => left _
end.
Next Obligation. firstorder. Qed.
Next Obligation. firstorder. Qed.
Instance decide_equality {A} {R: relation A} `{e: EqDec A R} x y: decision (R x y) := e x y.
Definition decision_to_bool P (dec : decision P) : bool :=
match dec with
| left _ => true
| right _ => false
end.
Ltac dec_eq := unfold decision; decide equality.
Implicit Arguments fst [[A] [B]].
Implicit Arguments snd [[A] [B]].
Notation "g ∘ f" := (compose g f) (at level 40, left associativity).
Definition uncurry A B C (f: A -> B -> C) (ab: A * B): C := f (fst ab) (snd ab).
Definition curry A B C (f: A * B -> C) (a: A) (b: B): C := f (a, b).
Definition curry_eq A B C (f: A * B -> C) a b: f (a, b) = curry f a b := refl_equal _.
Definition conj_pair {A B: Prop} (P: A /\ B): A * B :=
match P with conj a b => (a, b) end.
Coercion conj_pair: and >-> prod.
Definition equivalent_decision (P Q: Prop) (PQ: P <-> Q) (d: decision P): decision Q :=
match d with
| left p => left (fst PQ p)
| right H => right (fun q => H (snd PQ q))
end.
Definition opt_neg_conj (A B: Prop)
(oa: option (~ A)) (ob: option (~ B)): option (~ (A /\ B)) :=
match oa, ob with
| Some na, _ => Some (na ∘ fst ∘ conj_pair)
| _, Some nb => Some (nb ∘ snd ∘ conj_pair)
| None, None => None
end.
Definition opt_neg_impl (P Q: Prop) (i: P -> Q):
option (~ Q) -> option (~ P) :=
option_map (fun x => x ∘ i).
Definition pair_eq_dec (X Y: Type)
(X_eq_dec: forall x x': X, {x=x'}+{x<>x'})
(Y_eq_dec: forall y y': Y, {y=y'}+{y<>y'})
(p: prod X Y) (p': prod X Y): decision (p=p').
Proof with auto.
destruct p. destruct p'. unfold decision.
destruct (X_eq_dec x x0); destruct (Y_eq_dec y y0);
subst; try auto; right; intro; inversion H...
Defined.
Hint Unfold decision.
Definition and_dec (P Q: Prop) (Pdec: decision P) (Qdec: decision Q):
decision (P/\Q).
Proof. unfold decision. destruct Pdec, Qdec; firstorder. Defined.
Hint Resolve and_dec.
Definition list_dec (X: Set) (P: X -> Prop) (d: forall x, decision (P x))
(l: list X): decision (forall x, In x l -> P x).
Proof with auto.
induction l.
left. intros. inversion H.
simpl.
destruct (d a).
destruct IHl; [left | right]...
intros. destruct H... subst...
right...
Defined.
Coercion unsumbool (A B: Prop) (sb: {A}+{B}): bool :=
if sb then true else false.
Lemma Rmax_le x y z: x <= z -> y <= z -> Rmax x y <= z.
Proof with auto.
intros. unfold Rmax. destruct (Rle_dec x y)...
Qed.
Lemma Rmin_le x y z: z <= x -> z <= y -> z <= Rmin x y.
Proof with auto.
intros. unfold Rmin. destruct (Rle_dec x y)...
Qed.
Instance option_eq_dec {B: Type} `(Bdec: EquivDec.EqDec B eq): EquivDec.EqDec (option B) eq.
Proof with auto.
intros o o'.
unfold Equivalence.equiv.
destruct o; destruct o'...
destruct (Bdec b b0).
unfold Equivalence.equiv in *.
subst...
right. intro. inversion H...
right. discriminate.
right. discriminate.
Defined.
Coercion opt_to_bool A (o: option A): bool :=
match o with Some _ => true | None => false end.
Definition opt {A R}: (A -> R) -> R -> option A -> R :=
option_rect (fun _ => R).
Definition flip_opt {A R} (r: R) (o: option A) (f: A -> R): R :=
option_rect (fun _ => R) f r o.
Definition opt_prop A (o: option A) (f: A -> Prop): Prop :=
match o with
| None => True
| Some v => f v
end.
Definition options A (x y: option A): option A :=
match x, y with
| Some a, _ => Some a
| _, Some a => Some a
| None, None => None
end.
Lemma option_eq_inv A (x y: A): Some x = Some y -> x = y.
intros.
inversion H.
reflexivity.
Defined.
Lemma unsumbool_true (P Q: Prop) (sb: {P}+{Q}): unsumbool sb = true -> P.
Proof. destruct sb. auto. intro. discriminate. Qed.
Lemma decision_true (P: Prop) (sb: decision P): unsumbool sb = true -> P.
Proof. destruct sb. auto. intro. discriminate. Qed.
Lemma decision_false (P: Prop) (sb: decision P): unsumbool sb = false -> ~P.
Proof. destruct sb. intro. discriminate. auto. Qed.
Lemma semidec_true (P: Prop) (o: option P): opt_to_bool o = true -> P.
Proof. destruct o. auto. intro. discriminate. Qed.
Lemma show_unsumbool A (b: decision A) (c: bool): (if c then A else ~A) -> unsumbool b = c.
Proof. destruct b; destruct c; intuition. Qed.
Class ExhaustiveList (T: Type): Type :=
{ exhaustive_list: list T
; list_exhaustive: forall x, In x exhaustive_list }.
Hint Resolve @list_exhaustive.
Coercion exhaustive_list: ExhaustiveList >-> list.
Hint Resolve in_map.
Lemma negb_inv b c: b = negb c -> negb b = c.
Proof. intros. subst. apply negb_involutive. Qed.
Definition prod_map A B C D (f: A -> B) (g: C -> D) (p: A*C): B*D :=
(f (fst p), g (snd p)).
Definition flip (A B C: Type) (f: A -> B -> C) (b: B) (a: A): C := f a b.
Definition dep_flip (A B: Type) (C: A -> B -> Type) (f: forall a b, C a b) (b: B) (a: A): C a b := f a b.
Hint Extern 4 => match goal with
|- ?P (@proj1_sig ?T ?P ?x) => destruct x; auto
end.
Class overestimation (P: Prop): Set := overestimate: { b: bool | b = false -> ~ P }.
Definition underestimation (P: Prop): Set := option P.
Coercion overestimation_bool P: overestimation P -> bool := @proj1_sig _ _.
Coercion underestimation_bool P: underestimation P -> bool := @opt_to_bool _.
Program Instance opt_overestimation {A: Type} (P: A -> Prop)
(H: forall a, overestimation (P a)) (o: option A): overestimation (opt_prop o P) :=
match o with
| None => true
| Some v => H v
end.
Program Instance overestimate_conj {P Q: Prop}
(x: overestimation P) (y: overestimation Q): overestimation (P /\ Q) := x && y.
Next Obligation.
intros [A B].
destruct x. destruct y.
simpl in H.
destruct (andb_false_elim _ _ H); intuition.
Qed.
Lemma overestimation_false P (o: overestimation P): (o: bool) = false -> ~ P.
Proof. destruct o. assumption. Qed.
Lemma underestimation_true P (o: underestimation P): (o: bool) = true -> P.
Proof. destruct o. intro. assumption. intro. discriminate. Qed.
Lemma overestimation_true P (o: overestimation P): P -> (o: bool) = true.
Proof. destruct o. destruct x. reflexivity. intros. absurd P; auto. Qed.
Section doers.
Context {T: Type} `{ipt: IsPredicateType T}.
Definition overestimator: T -> Type :=
pred_rect (fun _ _ => Type) overestimation (fun U R p i X => forall x, X x) ipt.
Definition underestimator: T -> Type :=
pred_rect (fun _ _ => Type) underestimation (fun U R p i X => forall x, X x) ipt.
Definition decider: T -> Type :=
pred_rect (fun _ _ => Type) decision (fun U R p i X => forall x, X x) ipt.
End doers.
Program Coercion decision_overestimation (P: Prop) (d: decision P): overestimation P := d: bool.
Next Obligation. destruct d; firstorder. Qed.
(* todo: rename, because we can do the same for underestimation *)
Definition decider_to_overestimator {T: Type} `{ipt: IsPredicateType T} (P: T): decider P -> overestimator P.
unfold decider, overestimator.
unfold IsPredicateType in ipt.
unfold pred_rect.
induction ipt; simpl.
apply decision_overestimation.
intuition.
Defined.
Coercion decider_to_overestimator: decider >-> overestimator.
Definition LazyProp (T: Prop): Prop := () -> T.
Definition force (T: Prop) (l: LazyProp T): T := l ().
Hint Constructors unit.
Require Import Ensembles.
Implicit Arguments Complement [U].
Definition overlap X (A B: Ensembles.Ensemble X): Prop := exists x, A x /\ B x.
Require Import EqdepFacts.
Require Import Eqdep_dec.
Section eq_dep.
Variables (U : Type) (eq_dec : forall x y : U, {x=y}+{~x=y}).
Lemma eq_rect_eq : forall (p : U) Q x h, x = eq_rect p Q x p h.
Proof.
exact (eq_rect_eq_dec eq_dec).
Qed.
Lemma eq_dep_eq : forall P (p : U) x y, eq_dep U P p x p y -> x = y.
Proof.
exact (eq_rect_eq__eq_dep_eq U eq_rect_eq).
Qed.
End eq_dep.
Definition proj1_sig_relation (T: Type) (P: T -> Prop) (R: relation T): relation (sig P) :=
fun x y => R (`x) (`y).
Definition product_conj_relation (T T': Type) (R: relation T) (R': relation T'): relation (T * T') :=
fun p p' => R (fst p) (fst p') /\ R' (snd p) (snd p').
Definition morpher A B: relation (A -> B) -> Type := @sig _ ∘ Proper.
(* A more general version would be:
Definition morpher A: relation A -> Type := @sig _ ∘ Morphism.
However, we need the hard-coded implication to be able to declare the
coercion below. *)
Let morpher_to_func A B (R: relation (A -> B)): morpher R -> (A -> B) := @proj1_sig _ _.
Coercion morpher_to_func: morpher >-> Funclass.
Instance morpher_morphism A B (R: relation (A -> B)) (f: morpher R):
Proper R f := proj2_sig f.
Ltac prove_NoDup := simpl;
match goal with
| |- NoDup [] => constructor 1
| |- NoDup _ => constructor 2; [vm_compute; intuition; discriminate | prove_NoDup ]
end.
Ltac prove_exhaustive_list :=
destruct 0; vm_compute; tauto.
Definition decision_decider_to_EqDec X (R: relation X) (e: Equivalence R)
(d: forall x y, decision (R x y)): EquivDec.EqDec X R := d.
Ltac equiv_dec := apply decision_decider_to_EqDec; dec_eq.
Instance bools: ExhaustiveList bool := { exhaustive_list := true :: false :: [] }.
Proof. prove_exhaustive_list. Defined.
Lemma NoDup_bools: NoDup bools.
Proof. prove_NoDup. Qed.
Instance Bool_eq_dec: EquivDec.EqDec bool eq := bool_dec.
Module trans_refl_closure.
Section contents.
Variables (T: Type) (TR: relation T).
Inductive R: relation T :=
| refl' s: R s s
| step a b c: R a b -> TR b c -> R a c.
Hint Constructors R.
Instance trans: Transitive R.
Proof. repeat intro. induction H0; eauto. Qed.
Lemma flip (P: T -> Prop) (Pdec: forall s, decision (P s))
(a b: T): R a b -> P a -> ~ P b ->
exists c, exists d, P c /\ ~ P d /\ TR c d.
Proof.
intros r.
induction r. firstorder.
destruct (Pdec b); eauto.
Qed.
Lemma flip_inv (P: T -> Prop) (Pdec: forall s, decision (P s))
(a b: T): R a b -> ~ P a -> P b ->
exists c, exists d, ~ P c /\ P d /\ TR c d.
Proof.
intros r.
induction r. firstorder.
destruct (Pdec b); eauto.
Qed.
End contents.
End trans_refl_closure.
Hint Constructors trans_refl_closure.R.
Section alternate.
Variables (T: Type) (R: bool -> relation T).
Inductive end_with: bool -> relation T :=
| end_with_refl b s: end_with b s s
| end_with_next b x y:
end_with (negb b) x y -> forall z, R b y z -> end_with b x z.
Definition alternate: relation T :=
fun s s' => exists b, end_with b s s'.
End alternate.
Hint Constructors end_with.
Notation "[= e =]" := (exist _ e _).
|
[STATEMENT]
lemma [simp]: "\<bottom>|\<^bsub>r\<^esub> = \<bottom>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<bottom>|\<^bsub>r\<^esub> = \<bottom>
[PROOF STEP]
by fixrec_simp
|
for N in [Float64, Float32, Rational{Int}]
# BallInf approximation of a 3D unit ball in the 1-norm centered at [1,2,0]
b = Ball1(N[1, 2, 0], N(1))
bi = ballinf_approximation(b)
biexp = BallInf(N[1, 2, 0], N(1))
@test bi.center ≈ biexp.center
@test bi.radius ≈ biexp.radius
# BallInf approximation of a 2D polygon whose vertices are
# (0,1), (1,1), (2,-1), (-1,0)
p = HPolygon{N}()
addconstraint!(p, LinearConstraint(N[0, 1], N(1)))
addconstraint!(p, LinearConstraint(N[-1, 1], N(1)))
addconstraint!(p, LinearConstraint(N[-1, -3], N(1)))
addconstraint!(p, LinearConstraint(N[2, 1], N(3)))
bi = ballinf_approximation(p)
biexp = BallInf(N[0.5, 0], N(1.5))
@test bi.center ≈ biexp.center
@test bi.radius ≈ biexp.radius
# empty set
E = EmptySet{N}(2)
@test ballinf_approximation(E) == E
if N == Float64
# robustness (see issue #2532): the set has two contradicting constraints
# => the set is empty, but requires to use high precision
# x >= 1.0000000000000002
# x <= 1
s1 = HalfSpace([-1.0], -1.0000000000000002)
s2 = HalfSpace([1.0], 1.0)
P = s1 ∩ s2
@test ballinf_approximation(P) == BallInf([1.0], 0.0)
s1big = HalfSpace([-big(1.0)], -big(1.0000000000000002))
s2big = HalfSpace([big(1.0)], big(1.0))
Pbig = HPolytope([s1big, s2big])
@test ballinf_approximation(Pbig) == EmptySet{BigFloat}(1)
end
end
|
library(AnophelesModel)
# entomology parameters
gambiae_ent_params <- def_vector_params(mosquito_species = "Anopheles gambiae")
# host params
default_host_params <- def_host_params()
select_idx = activity_patterns$species == "Anopheles gambiae" &
activity_patterns$country == "Ghana"
gha_gambiae_biting_pattern <- activity_patterns[select_idx, ]
host_pop = 2000
vec_pop = 10000
model_params <- build_model_obj(
gambiae_ent_params,
default_host_params,
gha_gambiae_biting_pattern,
host_pop
)
PN2 <- intervention_obj_examples$LLINs_example
PN2$description <- "PN2"
PN2$parameterisation <- "LLINs01"
PN2$LLIN_country <- "Ghana"
PN2$LLIN_type <- "PermaNet 2.0"
PN3 <- intervention_obj_examples$LLINs_example
PN3$description <- "PN3"
PN3$parameterisation <- "LLINs02"
PN2$LLIN_country <- "Ghana"
PN2$LLIN_type <- "PermaNet 3.0"
new_IRS <- intervention_obj_examples$IRS_example
new_IRS$description <- "Permethrin IRS"
new_IRS$parameterisation <- "IRS16"
new_intervention_list <- c(intervention_obj_examples, list(new_IRS = new_IRS))
list_interv <- new_intervention_list
coverages <- c(seq(0, 1, by = 0.1))
n_ip <- 100
intervention_vec <- def_interventions_effects(
list_interv,
model_params,
n_ip,
verbose = TRUE
)
# vector capacity
impact_gambiae <- calculate_impact_var(
mosquito_species = "Anopheles gambiae",
activity_patterns = "default_Anopheles_gambiae",
interventions = intervention_vec,
n_sample_points = 10,
plot_result = FALSE
)
plot_impact_var("Anopheles gambiae", impact_gambiae)
# entomology xml
entomology_xml <- get_OM_ento_snippet(
gambiae_ent_params,
default_host_params
)
print(entomology_xml)
# GVI snippets
GVI_snippets <- get_OM_GVI_snippet(
"Anopheles example",
impacts$interventions_vec$LLINs_example,
100,
plot_f = TRUE
)
|
/-
Copyright (c) 2019 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl, Patrick Massot, Casper Putz, Anne Baanen
-/
import data.matrix.basic
import linear_algebra.finite_dimensional
/-!
# The finite-dimensional space of matrices
This file shows that `m` by `n` matrices form a finite-dimensional space,
and proves the `finrank` of that space is equal to `card m * card n`.
## Main definitions
* `matrix.finite_dimensional`: matrices form a finite dimensional vector space over a field `K`
* `matrix.finrank_matrix`: the `finrank` of `matrix m n R` is `card m * card n`
## Tags
matrix, finite dimensional, findim, finrank
-/
universes u v
namespace matrix
section finite_dimensional
variables {m n : Type*} {R : Type v} [field R]
instance [finite m] [finite n] : finite_dimensional R (matrix m n R) :=
linear_equiv.finite_dimensional (linear_equiv.curry R m n)
/--
The dimension of the space of finite dimensional matrices
is the product of the number of rows and columns.
-/
@[simp] lemma finrank_matrix [fintype m] [fintype n] :
finite_dimensional.finrank R (matrix m n R) = fintype.card m * fintype.card n :=
by rw [@linear_equiv.finrank_eq R (matrix m n R) _ _ _ _ _ _ (linear_equiv.curry R m n).symm,
finite_dimensional.finrank_fintype_fun_eq_card, fintype.card_prod]
end finite_dimensional
end matrix
|
#ifndef _GSLRNG_H
#define _GSLRNG_H
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <ctime>
#include <vector>
using namespace std;
namespace myGSL {
class Rng;
class PoissonGenerator;
};
typedef myGSL::Rng GSLRng;
class myGSL::Rng {
public:
Rng(const gsl_rng_type * T = gsl_rng_taus2, unsigned long seed = time(NULL))
: rng(gsl_rng_alloc(T)), discrete_t(NULL)
{ gsl_rng_set(rng,seed); }
Rng(const Rng& R)
: rng(gsl_rng_clone(R.constptr())), discrete_t(NULL)
{}
~Rng() {
gsl_rng_free(rng);
if (discrete_t != NULL) discrete_free();
}
inline void set(unsigned long seed) { gsl_rng_set(rng,seed); }
inline unsigned long min() { return gsl_rng_min(rng); }
inline unsigned long max() { return gsl_rng_max(rng); }
// uniform distributions
inline unsigned long get() { return gsl_rng_get(rng); }
inline double uniform() { return gsl_rng_uniform(rng); }
inline double uniform_pos() { return gsl_rng_uniform_pos(rng); }
inline double uniform(double a, double b) { return a + (b-a)*uniform(); }
inline unsigned long uniform_int(unsigned long n) { return gsl_rng_uniform_int(rng,n); }
// other distributions
inline double gaussian(double mu, double s) { return gsl_ran_gaussian(rng,s) + mu; }
inline unsigned long binomial(double r, unsigned n) { return gsl_ran_binomial(rng,r,n); }
inline unsigned int poisson(double mu) { return gsl_ran_poisson(rng,mu); }
inline double exponential(double mu) { return gsl_ran_exponential(rng,mu); }
// discrete distributions
inline void discrete_preproc(int K, const double * P) { discrete_t = gsl_ran_discrete_preproc(K,P); }
inline int get_discrete() { return gsl_ran_discrete(rng,discrete_t); }
inline void discrete_free() { gsl_ran_discrete_free(discrete_t); discrete_t = NULL; }
template<typename T> inline void shuffle(vector<T>& src, size_t first = 0,
size_t last = -1) {
if (first >= src.size()) return;
if (last > src.size()) last = src.size();
gsl_ran_shuffle(rng,&src[first],last-first,sizeof(T));
}
template<typename T> inline void choose(vector<T>& src, vector<T>& dest) {
gsl_ran_choose(rng,&dest[0],dest.size(),&src[0],src.size(),sizeof(T));
}
inline gsl_rng * ptr() { return rng; }
inline const gsl_rng * constptr() const { return rng; }
private:
gsl_rng * rng;
gsl_ran_discrete_t * discrete_t;
};
class myGSL::PoissonGenerator {
public:
double mu;
Rng* rng;
PoissonGenerator(double m, Rng* r) { mu = m; rng = r; }
double operator()() { return rng->poisson(mu); }
};
#endif
|
{-# LANGUAGE ApplicativeDo #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
#if __GLASGOW_HASKELL__ < 806
{-# LANGUAGE TypeInType #-}
#endif
module Codec.Winery.Class (Serialise(..)
, VarInt(..)
, BundleSerialise(..)
, bundleRecord
, bundleRecordDefault
, bundleVariant
, alterSchemaGen
, alterExtractor
, getSchema
, schema
, withSchema
, unexpectedSchema
, mkExtractor
, extractListBy
, buildVariantExtractor
, gschemaGenRecord
, gtoBuilderRecord
, gextractorRecord
, extractorRecord'
, gdecodeCurrentRecord
, GEncodeProduct(..)
, GDecodeProduct(..)
, GSerialiseRecord(..)
, GSerialiseProduct(..)
, gschemaGenProduct
, gtoBuilderProduct
, gextractorProduct
, gdecodeCurrentProduct
, extractorProduct'
, GConstructorCount(..)
, GDecodeVariant(..)
, GEncodeVariant(..)
, GSerialiseVariant(..)
, gschemaGenVariant
, gtoBuilderVariant
, gextractorVariant
, gdecodeCurrentVariant
, gvariantExtractors
, Subextractor(..)
, extractField
, extractFieldBy
, buildExtractor
, buildRecordExtractor
, bextractors
, buildRecordExtractorF
, bextractorsF
) where
import Barbies hiding (Void)
import Barbies.Constraints
import Barbies.TH
import Control.Applicative
import Control.Exception
import Control.Monad.Reader
import qualified Data.ByteString as B
import qualified Data.ByteString.FastBuilder as BB
import qualified Data.ByteString.Lazy as BL
import Data.Bits
import Data.Complex
import Data.Dynamic
import Data.Fixed
import Data.Functor.Compose
import Data.Functor.Identity
import qualified Data.Functor.Product as F
import Data.List (elemIndex)
import qualified Data.List.NonEmpty as NE
import Data.Monoid as M
import Data.Kind (Type)
import Data.Proxy
import Data.Ratio (Ratio, (%), numerator, denominator)
import Data.Scientific (Scientific, scientific, coefficient, base10Exponent)
import Data.Semigroup as S
import Data.Hashable (Hashable)
import qualified Data.HashMap.Strict as HM
import Data.Int
import qualified Data.IntMap as IM
import qualified Data.IntSet as IS
import qualified Data.Map as M
import Data.Ord (Down(..))
import Data.Word
import Codec.Winery.Base as W
import Codec.Winery.Internal
import qualified Data.Sequence as Seq
import qualified Data.Set as S
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
import qualified Data.Text.Encoding.Error as T
import qualified Data.Vector as V
import qualified Data.Vector.Storable as SV
import qualified Data.Vector.Unboxed as UV
import Prettyprinter hiding ((<>), SText, SChar)
import Data.Time.Clock
import Data.Time.Clock.POSIX
import Data.Typeable
import Data.Void (Void)
import Unsafe.Coerce
import GHC.Float (castWord32ToFloat, castWord64ToDouble)
import GHC.Natural
import GHC.Generics
import GHC.TypeLits
-- | Serialisable datatype
--
class Typeable a => Serialise a where
-- | Obtain the schema of the datatype.
schemaGen :: Proxy a -> SchemaGen Schema
schemaGen = bundleSchemaGen bundleSerialise
{-# INLINE schemaGen #-}
-- | Serialise a value.
toBuilder :: a -> BB.Builder
toBuilder = bundleToBuilder bundleSerialise
{-# INLINE toBuilder #-}
-- | A value of 'Extractor a' interprets a schema and builds a function from
-- 'Term' to @a@. This must be equivalent to 'decodeCurrent' when the schema
-- is the current one.
--
-- If @'extractor' s@ returns a function, the function must return a
-- non-bottom for any 'Term' @'decodeTerm' s@ returns.
--
-- It must not return a function if an unsupported schema is supplied.
--
-- @getDecoderBy extractor (schema (Proxy @a))@ must be @Right d@
-- where @d@ is equivalent to 'decodeCurrent'.
--
extractor :: Extractor a
extractor = bundleExtractor bundleSerialise
{-# INLINE extractor #-}
-- | Decode a value with the current schema.
--
-- @'decodeCurrent' `evalDecoder` 'toBuilder' x@ ≡ x
decodeCurrent :: Decoder a
decodeCurrent = bundleDecodeCurrent bundleSerialise
{-# INLINE decodeCurrent #-}
-- | Instead of the four methods above, you can supply a bundle.
bundleSerialise :: BundleSerialise a
bundleSerialise = BundleSerialise
{ bundleSchemaGen = schemaGen
, bundleToBuilder = toBuilder
, bundleExtractor = extractor
, bundleDecodeCurrent = decodeCurrent
}
{-# MINIMAL schemaGen, toBuilder, extractor, decodeCurrent | bundleSerialise #-}
-- | A bundle of 'Serialise' methods
data BundleSerialise a = BundleSerialise
{ bundleSchemaGen :: Proxy a -> SchemaGen Schema
, bundleToBuilder :: a -> BB.Builder
, bundleExtractor :: Extractor a
, bundleDecodeCurrent :: Decoder a
}
-- | Modify 'bundleSchemaGen'
alterSchemaGen :: (SchemaGen Schema -> SchemaGen Schema)
-> BundleSerialise a -> BundleSerialise a
alterSchemaGen f bundle = bundle { bundleSchemaGen = f . bundleSchemaGen bundle }
-- | Modify 'bundleExtractor'
alterExtractor :: (Extractor a -> Extractor a)
-> BundleSerialise a -> BundleSerialise a
alterExtractor f bundle = bundle { bundleExtractor = f (bundleExtractor bundle) }
-- | A bundle of generic implementations for records
bundleRecord :: (GEncodeProduct (Rep a), GSerialiseRecord (Rep a), GDecodeProduct (Rep a), Generic a, Typeable a)
=> (Extractor a -> Extractor a) -- extractor modifier
-> BundleSerialise a
bundleRecord f = BundleSerialise
{ bundleSchemaGen = gschemaGenRecord
, bundleToBuilder = gtoBuilderRecord
, bundleExtractor = f $ gextractorRecord Nothing
, bundleDecodeCurrent = gdecodeCurrentRecord
}
{-# INLINE bundleRecord #-}
{-# DEPRECATED bundleRecord "Use bundleVia instead" #-}
-- | A bundle of generic implementations for records, with a default value
bundleRecordDefault :: (GEncodeProduct (Rep a), GSerialiseRecord (Rep a), GDecodeProduct (Rep a), Generic a, Typeable a)
=> a -- default value
-> (Extractor a -> Extractor a) -- extractor modifier
-> BundleSerialise a
bundleRecordDefault def f = BundleSerialise
{ bundleSchemaGen = gschemaGenRecord
, bundleToBuilder = gtoBuilderRecord
, bundleExtractor = f $ gextractorRecord $ Just def
, bundleDecodeCurrent = gdecodeCurrentRecord
}
{-# INLINE bundleRecordDefault #-}
{-# DEPRECATED bundleRecordDefault "Use bundleVia instead" #-}
-- | A bundle of generic implementations for variants
bundleVariant :: (GSerialiseVariant (Rep a), GConstructorCount (Rep a), GEncodeVariant (Rep a), GDecodeVariant (Rep a), Generic a, Typeable a)
=> (Extractor a -> Extractor a) -- extractor modifier
-> BundleSerialise a
bundleVariant f = BundleSerialise
{ bundleSchemaGen = gschemaGenVariant
, bundleToBuilder = gtoBuilderVariant
, bundleExtractor = f $ gextractorVariant
, bundleDecodeCurrent = gdecodeCurrentVariant
}
{-# INLINE bundleVariant #-}
{-# DEPRECATED bundleVariant "Use bundleVia instead" #-}
-- | Bind a schema. While this does not change the semantics, it helps reducing the schema size
-- when it has multiple children with the specified type (use TypeApplications to specify a type).
withSchema :: forall a. Serialise a => SchemaGen Schema -> SchemaGen Schema
withSchema gen = SchemaGen $ \seen -> if S.member rep seen
then unSchemaGen gen seen
else do
let seen' = S.insert rep seen
let (reps', g) = unSchemaGen (getSchema (Proxy @a)) seen
let (reps, f) = unSchemaGen gen seen'
(reps <> reps', \xs -> SLet (g xs) $ f $ rep : xs)
where
rep = typeRep (Proxy @a)
-- | Obtain a schema on 'SchemaGen', binding a fixpoint when necessary.
-- If you are hand-rolling a definition of 'schemaGen', you should call this
-- instead of 'schemaGen'.
getSchema :: forall proxy a. Serialise a => proxy a -> SchemaGen Schema
getSchema p = SchemaGen $ \seen -> if S.member rep seen
then (S.singleton rep, \xs -> case elemIndex rep xs of
Just i -> SVar i
Nothing -> error $ "getSchema: impossible " ++ show (rep, seen, xs))
-- request a fixpoint for rep when it detects a recursion
else case unSchemaGen (schemaGen (Proxy @a)) (S.insert rep seen) of
(reps, f)
| S.member rep reps -> (reps, \xs -> SFix $ f (rep : xs))
| otherwise -> (reps, f)
where
rep = typeRep p
-- | Obtain the schema of the datatype.
--
-- /"Tell me what you drink, and I will tell you what you are."/
schema :: forall proxy a. Serialise a => proxy a -> Schema
schema p = case unSchemaGen (schemaGen (Proxy @a)) (S.singleton rep) of
(reps, f)
| S.member rep reps -> SFix $ f [rep]
| otherwise -> f []
where
rep = typeRep p
unexpectedSchema :: forall f a. Serialise a => Schema -> Strategy' (f a)
unexpectedSchema actual = throwStrategy
$ UnexpectedSchema [] (pretty $ schema (Proxy @a)) actual
mkExtractor :: forall a. Typeable a => (Schema -> Strategy' (Term -> a)) -> Extractor a
mkExtractor = Extractor . fmap addTrail . recursiveStrategy where
addTrail (Strategy f) = Strategy $ \env -> case f env of
Left e -> Left $! pushTrace (typeRep (Proxy @a)) e
Right a -> Right a
{-# INLINE mkExtractor #-}
-- | Handle (recursive) schema bindings.
recursiveStrategy :: forall a. Typeable a => (Schema -> Strategy' (Term -> a)) -> Schema -> Strategy' (Term -> a)
recursiveStrategy k sch = Strategy $ \(StrategyEnv ofs decs) -> case sch of
SVar i
| point : _ <- drop i decs -> case point of
BoundSchema ofs' sch' -> recursiveStrategy k sch' `unStrategy` StrategyEnv ofs' (drop (ofs - ofs') decs)
DynDecoder dyn -> case fromDynamic dyn of
Nothing -> Left $ TypeMismatch [] i
(typeRep (Proxy @(Term -> a)))
(dynTypeRep dyn)
Just a -> Right a
| otherwise -> Left $ UnboundVariable [] i
SFix s -> mfix $ \a -> recursiveStrategy k s `unStrategy` StrategyEnv (ofs + 1) (DynDecoder (toDyn a) : decs)
SLet s t -> recursiveStrategy k t `unStrategy` StrategyEnv (ofs + 1) (BoundSchema ofs s : decs)
s -> k s `unStrategy` StrategyEnv ofs decs
instance Serialise Tag where
schemaGen = gschemaGenVariant
toBuilder = gtoBuilderVariant
extractor = gextractorVariant
decodeCurrent = gdecodeCurrentVariant
instance Serialise Schema where
schemaGen = gschemaGenVariant
toBuilder = gtoBuilderVariant
extractor = gextractorVariant
decodeCurrent = gdecodeCurrentVariant
instance Serialise () where
schemaGen _ = pure $ SProduct mempty
toBuilder = mempty
{-# INLINE toBuilder #-}
extractor = pure ()
decodeCurrent = pure ()
instance Serialise Bool where
schemaGen _ = pure SBool
toBuilder False = BB.word8 0
toBuilder True = BB.word8 1
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SBool -> pure $ \case
TBool b -> b
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = (/=0) <$> getWord8
instance Serialise Word8 where
schemaGen _ = pure SWord8
toBuilder = BB.word8
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SWord8 -> pure $ \case
TWord8 i -> i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = getWord8
instance Serialise Word16 where
schemaGen _ = pure SWord16
toBuilder = BB.word16LE
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SWord16 -> pure $ \case
TWord16 i -> i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = getWord16
instance Serialise Word32 where
schemaGen _ = pure SWord32
toBuilder = BB.word32LE
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SWord32 -> pure $ \case
TWord32 i -> i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = getWord32
instance Serialise Word64 where
schemaGen _ = pure SWord64
toBuilder = BB.word64LE
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SWord64 -> pure $ \case
TWord64 i -> i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = getWord64
instance Serialise Word where
schemaGen _ = pure SWord64
toBuilder = BB.word64LE . fromIntegral
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SWord64 -> pure $ \case
TWord64 i -> fromIntegral i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = fromIntegral <$> getWord64
instance Serialise Int8 where
schemaGen _ = pure SInt8
toBuilder = BB.word8 . fromIntegral
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SInt8 -> pure $ \case
TInt8 i -> i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = fromIntegral <$> getWord8
instance Serialise Int16 where
schemaGen _ = pure SInt16
toBuilder = BB.word16LE . fromIntegral
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SInt16 -> pure $ \case
TInt16 i -> i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = fromIntegral <$> getWord16
instance Serialise Int32 where
schemaGen _ = pure SInt32
toBuilder = BB.word32LE . fromIntegral
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SInt32 -> pure $ \case
TInt32 i -> i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = fromIntegral <$> getWord32
instance Serialise Int64 where
schemaGen _ = pure SInt64
toBuilder = BB.word64LE . fromIntegral
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SInt64 -> pure $ \case
TInt64 i -> i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = fromIntegral <$> getWord64
instance Serialise Int where
schemaGen _ = pure SInteger
toBuilder = toBuilder . VarInt
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SInteger -> pure $ \case
TInteger i -> fromIntegral i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = decodeVarIntFinite
instance Serialise Float where
schemaGen _ = pure SFloat
toBuilder = BB.floatLE
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SFloat -> pure $ \case
TFloat x -> x
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = castWord32ToFloat <$> getWord32
instance Serialise Double where
schemaGen _ = pure SDouble
toBuilder = BB.doubleLE
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SDouble -> pure $ \case
TDouble x -> x
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = castWord64ToDouble <$> getWord64
instance Serialise T.Text where
schemaGen _ = pure SText
toBuilder = toBuilder . T.encodeUtf8
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SText -> pure $ \case
TText t -> t
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = do
len <- decodeVarInt
T.decodeUtf8With T.lenientDecode <$> getBytes len
-- | Encoded in variable-length quantity.
newtype VarInt a = VarInt { getVarInt :: a } deriving (Show, Read, Eq, Ord, Enum
, Bounded, Num, Real, Integral, Bits, Typeable)
instance (Typeable a, Bits a, Integral a) => Serialise (VarInt a) where
schemaGen _ = pure SInteger
toBuilder = varInt . getVarInt
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SInteger -> pure $ \case
TInteger i -> fromIntegral i
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = VarInt <$> decodeVarInt
instance Serialise Integer where
schemaGen _ = pure SInteger
toBuilder = toBuilder . VarInt
{-# INLINE toBuilder #-}
extractor = getVarInt <$> extractor
decodeCurrent = getVarInt <$> decodeCurrent
instance Serialise Natural where
schemaGen _ = pure SInteger
toBuilder = toBuilder . toInteger
extractor = naturalFromInteger <$> extractor
decodeCurrent = naturalFromInteger <$> decodeCurrent
instance Serialise Char where
schemaGen _ = pure SChar
toBuilder = toBuilder . fromEnum
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SChar -> pure $ \case
TChar c -> c
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = toEnum <$> decodeVarInt
instance Serialise a => Serialise (Maybe a) where
schemaGen = gschemaGenVariant
toBuilder = gtoBuilderVariant
extractor = gextractorVariant
decodeCurrent = gdecodeCurrentVariant
instance Serialise B.ByteString where
schemaGen _ = pure SBytes
toBuilder bs = varInt (B.length bs) <> BB.byteString bs
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SBytes -> pure $ \case
TBytes bs -> bs
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = decodeVarInt >>= getBytes
instance Serialise BL.ByteString where
schemaGen _ = pure SBytes
toBuilder = toBuilder . BL.toStrict
{-# INLINE toBuilder #-}
extractor = BL.fromStrict <$> extractor
decodeCurrent = BL.fromStrict <$> decodeCurrent
-- | time-1.9.1
nanosecondsToNominalDiffTime :: Int64 -> NominalDiffTime
nanosecondsToNominalDiffTime = unsafeCoerce . MkFixed . (*1000) . fromIntegral
instance Serialise UTCTime where
schemaGen _ = pure SUTCTime
toBuilder = toBuilder . utcTimeToPOSIXSeconds
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \case
SUTCTime -> pure $ \case
TUTCTime bs -> bs
t -> throw $ InvalidTerm t
s -> unexpectedSchema s
decodeCurrent = posixSecondsToUTCTime <$> decodeCurrent
instance Serialise NominalDiffTime where
schemaGen _ = pure SInt64
toBuilder x = case unsafeCoerce x of
MkFixed p -> toBuilder (fromIntegral (p `div` 1000) :: Int64)
{-# INLINE toBuilder #-}
extractor = nanosecondsToNominalDiffTime <$> extractor
decodeCurrent = nanosecondsToNominalDiffTime <$> decodeCurrent
-- | Extract a list or an array of values.
extractListBy :: Typeable a => Extractor a -> Extractor (V.Vector a)
extractListBy (Extractor plan) = mkExtractor $ \case
SVector s -> do
getItem <- plan s
return $ \case
TVector xs -> V.map getItem xs
t -> throw $ InvalidTerm t
s -> throwStrategy $ UnexpectedSchema [] "SVector" s
{-# INLINE extractListBy #-}
instance Serialise a => Serialise [a] where
schemaGen _ = SVector <$> getSchema (Proxy @a)
toBuilder xs = varInt (length xs)
<> foldMap toBuilder xs
{-# INLINE toBuilder #-}
extractor = V.toList <$> extractListBy extractor
decodeCurrent = do
n <- decodeVarInt
replicateM n decodeCurrent
instance Serialise a => Serialise (NE.NonEmpty a) where
schemaGen _ = SVector <$> getSchema (Proxy @a)
toBuilder = toBuilder . NE.toList
{-# INLINE toBuilder #-}
extractor = NE.fromList . V.toList <$> extractListBy extractor
decodeCurrent = NE.fromList <$> decodeCurrent
instance Serialise a => Serialise (V.Vector a) where
schemaGen _ = SVector <$> getSchema (Proxy @a)
toBuilder xs = varInt (V.length xs)
<> foldMap toBuilder xs
{-# INLINE toBuilder #-}
extractor = extractListBy extractor
decodeCurrent = do
n <- decodeVarInt
V.replicateM n decodeCurrent
instance (SV.Storable a, Serialise a) => Serialise (SV.Vector a) where
schemaGen _ = SVector <$> getSchema (Proxy @a)
toBuilder = toBuilder . (SV.convert :: SV.Vector a -> V.Vector a)
{-# INLINE toBuilder #-}
extractor = SV.convert <$> extractListBy extractor
decodeCurrent = do
n <- decodeVarInt
SV.replicateM n decodeCurrent
instance (UV.Unbox a, Serialise a) => Serialise (UV.Vector a) where
schemaGen _ = SVector <$> getSchema (Proxy @a)
toBuilder = toBuilder . (UV.convert :: UV.Vector a -> V.Vector a)
{-# INLINE toBuilder #-}
extractor = UV.convert <$> extractListBy extractor
decodeCurrent = do
n <- decodeVarInt
UV.replicateM n decodeCurrent
instance (Ord k, Serialise k, Serialise v) => Serialise (M.Map k v) where
schemaGen _ = schemaGen (Proxy @[(k, v)])
toBuilder m = toBuilder (M.size m)
<> M.foldMapWithKey (curry toBuilder) m
{-# INLINE toBuilder #-}
extractor = M.fromList <$> extractor
decodeCurrent = M.fromList <$> decodeCurrent
instance (Eq k, Hashable k, Serialise k, Serialise v) => Serialise (HM.HashMap k v) where
schemaGen _ = schemaGen (Proxy @[(k, v)])
toBuilder m = toBuilder (HM.size m)
<> HM.foldrWithKey (\k v r -> toBuilder (k, v) <> r) mempty m
{-# INLINE toBuilder #-}
extractor = HM.fromList <$> extractor
decodeCurrent = HM.fromList <$> decodeCurrent
instance (Serialise v) => Serialise (IM.IntMap v) where
schemaGen _ = schemaGen (Proxy @[(Int, v)])
toBuilder m = toBuilder (IM.size m)
<> IM.foldMapWithKey (curry toBuilder) m
{-# INLINE toBuilder #-}
extractor = IM.fromList <$> extractor
decodeCurrent = IM.fromList <$> decodeCurrent
instance (Ord a, Serialise a) => Serialise (S.Set a) where
schemaGen _ = schemaGen (Proxy @[a])
toBuilder s = toBuilder (S.size s) <> foldMap toBuilder s
{-# INLINE toBuilder #-}
extractor = S.fromList <$> extractor
decodeCurrent = S.fromList <$> decodeCurrent
instance Serialise IS.IntSet where
schemaGen _ = schemaGen (Proxy @[Int])
toBuilder s = toBuilder (IS.size s) <> IS.foldr (mappend . toBuilder) mempty s
{-# INLINE toBuilder #-}
extractor = IS.fromList <$> extractor
decodeCurrent = IS.fromList <$> decodeCurrent
instance Serialise a => Serialise (Seq.Seq a) where
schemaGen _ = schemaGen (Proxy @[a])
toBuilder s = toBuilder (length s) <> foldMap toBuilder s
{-# INLINE toBuilder #-}
extractor = Seq.fromList <$> extractor
decodeCurrent = Seq.fromList <$> decodeCurrent
instance (Integral a, Serialise a) => Serialise (Ratio a) where
schemaGen _ = schemaGen (Proxy @(a, a))
toBuilder x = toBuilder (numerator x, denominator x)
{-# INLINE toBuilder #-}
extractor = uncurry (%) <$> extractor
decodeCurrent = uncurry (%) <$> decodeCurrent
instance Serialise Scientific where
schemaGen _ = schemaGen (Proxy @(Integer, Int))
toBuilder s = toBuilder (coefficient s, base10Exponent s)
{-# INLINE toBuilder #-}
extractor = mkExtractor $ \s -> case s of
SWord8 -> f (fromIntegral :: Word8 -> Scientific) s
SWord16 -> f (fromIntegral :: Word16 -> Scientific) s
SWord32 -> f (fromIntegral :: Word32 -> Scientific) s
SWord64 -> f (fromIntegral :: Word64 -> Scientific) s
SInt8 -> f (fromIntegral :: Int8 -> Scientific) s
SInt16 -> f (fromIntegral :: Int16 -> Scientific) s
SInt32 -> f (fromIntegral :: Int32 -> Scientific) s
SInt64 -> f (fromIntegral :: Int64 -> Scientific) s
SInteger -> f fromInteger s
SFloat -> f (realToFrac :: Float -> Scientific) s
SDouble -> f (realToFrac :: Double -> Scientific) s
_ -> f (uncurry scientific) s
where
f c = runExtractor (c <$> extractor)
decodeCurrent = scientific <$> decodeCurrent <*> decodeCurrent
instance (Serialise a, Serialise b) => Serialise (a, b) where
schemaGen = gschemaGenProduct
toBuilder = gtoBuilderProduct
extractor = gextractorProduct
decodeCurrent = gdecodeCurrentProduct
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
instance (Serialise a, Serialise b, Serialise c) => Serialise (a, b, c) where
schemaGen = gschemaGenProduct
toBuilder = gtoBuilderProduct
extractor = gextractorProduct
decodeCurrent = gdecodeCurrentProduct
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
instance (Serialise a, Serialise b, Serialise c, Serialise d) => Serialise (a, b, c, d) where
schemaGen = gschemaGenProduct
toBuilder = gtoBuilderProduct
extractor = gextractorProduct
decodeCurrent = gdecodeCurrentProduct
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
instance (Serialise a, Serialise b, Serialise c, Serialise d, Serialise e) => Serialise (a, b, c, d, e) where
schemaGen = gschemaGenProduct
toBuilder = gtoBuilderProduct
extractor = gextractorProduct
decodeCurrent = gdecodeCurrentProduct
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
instance (Serialise a, Serialise b, Serialise c, Serialise d, Serialise e, Serialise f) => Serialise (a, b, c, d, e, f) where
schemaGen = gschemaGenProduct
toBuilder = gtoBuilderProduct
extractor = gextractorProduct
decodeCurrent = gdecodeCurrentProduct
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
instance (Serialise a, Serialise b) => Serialise (Either a b) where
schemaGen = gschemaGenVariant
toBuilder = gtoBuilderVariant
extractor = gextractorVariant
decodeCurrent = gdecodeCurrentVariant
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
instance Serialise Ordering where
schemaGen = gschemaGenVariant
toBuilder = gtoBuilderVariant
extractor = gextractorVariant
decodeCurrent = gdecodeCurrentVariant
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
deriving instance Serialise a => Serialise (Identity a)
deriving instance (Serialise a, Typeable b, Typeable k) => Serialise (Const a (b :: k))
deriving instance Serialise Any
deriving instance Serialise All
deriving instance Serialise a => Serialise (Down a)
deriving instance Serialise a => Serialise (Product a)
deriving instance Serialise a => Serialise (Sum a)
deriving instance Serialise a => Serialise (Dual a)
deriving instance Serialise a => Serialise (M.Last a)
deriving instance Serialise a => Serialise (M.First a)
deriving instance Serialise a => Serialise (S.Last a)
deriving instance Serialise a => Serialise (S.First a)
deriving instance Serialise a => Serialise (ZipList a)
deriving instance Serialise a => Serialise (Max a)
deriving instance Serialise a => Serialise (Min a)
deriving instance (Typeable k, Typeable f, Typeable a, Serialise (f a)) => Serialise (Alt f (a :: k))
deriving instance (Typeable j, Typeable k, Typeable f, Typeable g, Typeable a, Serialise (f (g a))) => Serialise (Compose f (g :: j -> k) (a :: j))
#if MIN_VERSION_base(4,12,0)
deriving instance (Typeable k, Typeable f, Typeable a, Serialise (f a)) => Serialise (Ap f (a :: k))
#endif
instance (Typeable k, Typeable a, Typeable b, a ~ b) => Serialise ((a :: k) :~: b) where
schemaGen _ = pure $ SProduct mempty
toBuilder = mempty
extractor = pure Refl
decodeCurrent = pure Refl
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
instance (Serialise a, Serialise b) => Serialise (Arg a b) where
schemaGen = gschemaGenProduct
toBuilder = gtoBuilderProduct
extractor = gextractorProduct
decodeCurrent = gdecodeCurrentProduct
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
instance Serialise a => Serialise (Complex a) where
schemaGen = gschemaGenProduct
toBuilder = gtoBuilderProduct
extractor = gextractorProduct
decodeCurrent = gdecodeCurrentProduct
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
instance Serialise Void where
schemaGen _ = pure $ SVariant V.empty
toBuilder = mempty
extractor = Extractor $ const $ throwStrategy "No extractor for Void"
decodeCurrent = error "No decodeCurrent for Void"
{-# INLINE toBuilder #-}
{-# INLINE decodeCurrent #-}
--------------------------------------------------------------------------------
-- | Generic implementation of 'schemaGen' for a record.
gschemaGenRecord :: forall proxy a. (GSerialiseRecord (Rep a), Generic a, Typeable a) => proxy a -> SchemaGen Schema
gschemaGenRecord _ = SRecord . V.fromList <$> recordSchema (Proxy @(Rep a))
-- | Generic implementation of 'toBuilder' for a record.
gtoBuilderRecord :: (GEncodeProduct (Rep a), Generic a) => a -> BB.Builder
gtoBuilderRecord = productEncoder . from
{-# INLINE gtoBuilderRecord #-}
data FieldDecoder i a = FieldDecoder !i !(Maybe a) !(Schema -> Strategy' (Term -> a))
-- | Generic implementation of 'extractor' for a record.
gextractorRecord :: forall a. (GSerialiseRecord (Rep a), Generic a, Typeable a)
=> Maybe a -- ^ default value (optional)
-> Extractor a
gextractorRecord def = mkExtractor
$ fmap (fmap (to .)) $ extractorRecord'
(from <$> def)
-- | Generic implementation of 'extractor' for a record.
extractorRecord' :: (GSerialiseRecord f)
=> Maybe (f x) -- ^ default value (optional)
-> Schema -> Strategy' (Term -> f x)
extractorRecord' def (SRecord schs) = Strategy $ \decs -> do
let go :: FieldDecoder T.Text x -> Either WineryException (Term -> x)
go (FieldDecoder name def' p) = case lookupWithIndexV name schs of
Nothing -> case def' of
Just d -> Right (const d)
Nothing -> Left $ FieldNotFound [] name (map fst $ V.toList schs)
Just (i, sch) -> case p sch `unStrategy` decs of
Right getItem -> Right $ \case
t@(TRecord xs) -> maybe (throw $ InvalidTerm t) (getItem . snd) $ xs V.!? i
t -> throw $ InvalidTerm t
Left e -> Left e
unTransFusion (recordExtractor def) go
extractorRecord' _ s = throwStrategy $ UnexpectedSchema [] "a record" s
{-# INLINE gextractorRecord #-}
-- | Synonym for 'gdecodeCurrentProduct'
gdecodeCurrentRecord :: (GDecodeProduct (Rep a), Generic a) => Decoder a
gdecodeCurrentRecord = to <$> productDecoder
{-# INLINE gdecodeCurrentRecord #-}
-- | Encode all the fields
class GEncodeProduct f where
productEncoder :: f x -> BB.Builder
instance GEncodeProduct U1 where
productEncoder _ = mempty
{-# INLINE productEncoder #-}
instance (GEncodeProduct f, GEncodeProduct g) => GEncodeProduct (f :*: g) where
productEncoder (f :*: g) = productEncoder f <> productEncoder g
{-# INLINE productEncoder #-}
instance Serialise a => GEncodeProduct (S1 c (K1 i a)) where
productEncoder (M1 (K1 a)) = toBuilder a
{-# INLINE productEncoder #-}
instance GEncodeProduct f => GEncodeProduct (C1 c f) where
productEncoder (M1 a) = productEncoder a
{-# INLINE productEncoder #-}
instance GEncodeProduct f => GEncodeProduct (D1 c f) where
productEncoder (M1 a) = productEncoder a
{-# INLINE productEncoder #-}
class GDecodeProduct f where
productDecoder :: Decoder (f x)
instance GDecodeProduct U1 where
productDecoder = pure U1
instance Serialise a => GDecodeProduct (K1 i a) where
productDecoder = K1 <$> decodeCurrent
{-# INLINE productDecoder #-}
instance GDecodeProduct f => GDecodeProduct (M1 i c f) where
productDecoder = M1 <$> productDecoder
{-# INLINE productDecoder #-}
instance (GDecodeProduct f, GDecodeProduct g) => GDecodeProduct (f :*: g) where
productDecoder = (:*:) <$> productDecoder <*> productDecoder
{-# INLINE productDecoder #-}
class GSerialiseRecord f where
recordSchema :: proxy f -> SchemaGen [(T.Text, Schema)]
recordExtractor :: Maybe (f x) -> TransFusion (FieldDecoder T.Text) ((->) Term) (Term -> f x)
instance (GSerialiseRecord f, GSerialiseRecord g) => GSerialiseRecord (f :*: g) where
recordSchema _ = (++) <$> recordSchema (Proxy @f) <*> recordSchema (Proxy @g)
recordExtractor def = (\f g -> (:*:) <$> f <*> g)
<$> recordExtractor ((\(x :*: _) -> x) <$> def)
<*> recordExtractor ((\(_ :*: x) -> x) <$> def)
{-# INLINE recordExtractor #-}
instance (Serialise a, Selector c) => GSerialiseRecord (S1 c (K1 i a)) where
recordSchema _ = do
s <- getSchema (Proxy @a)
pure [(T.pack $ selName (M1 undefined :: M1 i c (K1 i a) x), s)]
recordExtractor def = TransFusion $ \k -> fmap (fmap (M1 . K1)) $ k $ FieldDecoder
(T.pack $ selName (M1 undefined :: M1 i c (K1 i a) x))
(unK1 . unM1 <$> def)
(runExtractor extractor)
{-# INLINE recordExtractor #-}
instance (GSerialiseRecord f) => GSerialiseRecord (C1 c f) where
recordSchema _ = recordSchema (Proxy @f)
recordExtractor def = fmap M1 <$> recordExtractor (unM1 <$> def)
instance (GSerialiseRecord f) => GSerialiseRecord (D1 c f) where
recordSchema _ = recordSchema (Proxy @f)
recordExtractor def = fmap M1 <$> recordExtractor (unM1 <$> def)
class GSerialiseProduct f where
productSchema :: proxy f -> SchemaGen [Schema]
productExtractor :: Compose (State Int) (TransFusion (FieldDecoder Int) ((->) Term)) (Term -> f x)
instance GSerialiseProduct U1 where
productSchema _ = pure []
productExtractor = pure (pure U1)
instance (Serialise a) => GSerialiseProduct (K1 i a) where
productSchema _ = pure <$> getSchema (Proxy @a)
productExtractor = Compose $ State $ \i ->
( TransFusion $ \k -> fmap (fmap K1) $ k $ FieldDecoder i Nothing (runExtractor extractor)
, i + 1)
instance GSerialiseProduct f => GSerialiseProduct (M1 i c f) where
productSchema _ = productSchema (Proxy @f)
productExtractor = fmap M1 <$> productExtractor
instance (GSerialiseProduct f, GSerialiseProduct g) => GSerialiseProduct (f :*: g) where
productSchema _ = (++) <$> productSchema (Proxy @f) <*> productSchema (Proxy @g)
productExtractor = liftA2 (:*:) <$> productExtractor <*> productExtractor
gschemaGenProduct :: forall proxy a. (Generic a, GSerialiseProduct (Rep a)) => proxy a -> SchemaGen Schema
gschemaGenProduct _ = SProduct . V.fromList <$> productSchema (Proxy @(Rep a))
{-# INLINE gschemaGenProduct #-}
gtoBuilderProduct :: (Generic a, GEncodeProduct (Rep a)) => a -> BB.Builder
gtoBuilderProduct = productEncoder . from
{-# INLINE gtoBuilderProduct #-}
-- | Generic implementation of 'extractor' for a record.
gextractorProduct :: forall a. (GSerialiseProduct (Rep a), Generic a, Typeable a)
=> Extractor a
gextractorProduct = mkExtractor $ fmap (to .) . extractorProduct'
{-# INLINE gextractorProduct #-}
-- | Generic implementation of 'extractor' for a record.
gdecodeCurrentProduct :: forall a. (GDecodeProduct (Rep a), Generic a)
=> Decoder a
gdecodeCurrentProduct = to <$> productDecoder
{-# INLINE gdecodeCurrentProduct #-}
extractorProduct' :: GSerialiseProduct f => Schema -> Strategy' (Term -> f x)
extractorProduct' sch
| Just schs <- strip sch = Strategy $ \recs -> do
let go :: FieldDecoder Int x -> Either WineryException (Term -> x)
go (FieldDecoder i _ p) = do
getItem <- if i < length schs
then p (schs V.! i) `unStrategy` recs
else Left $ ProductTooSmall [] $ length schs
return $ \case
TProduct xs -> getItem $ maybe (throw $ InvalidTerm (TProduct xs)) id
$ xs V.!? i
t -> throw $ InvalidTerm t
unTransFusion (getCompose productExtractor `evalState` 0) go
where
strip (SProduct xs) = Just xs
strip (SRecord xs) = Just $ V.map snd xs
strip _ = Nothing
extractorProduct' sch = throwStrategy $ UnexpectedSchema [] "a product" sch
-- | Generic implementation of 'schemaGen' for an ADT.
gschemaGenVariant :: forall proxy a. (GSerialiseVariant (Rep a), Typeable a, Generic a) => proxy a -> SchemaGen Schema
gschemaGenVariant _ = SVariant . V.fromList <$> variantSchema (Proxy @(Rep a))
-- | Generic implementation of 'toBuilder' for an ADT.
gtoBuilderVariant :: forall a. (GConstructorCount (Rep a), GEncodeVariant (Rep a), Generic a) => a -> BB.Builder
gtoBuilderVariant = variantEncoder (variantCount (Proxy :: Proxy (Rep a))) 0 . from
{-# INLINE gtoBuilderVariant #-}
-- | Generic implementation of 'extractor' for an ADT.
gextractorVariant :: (GSerialiseVariant (Rep a), Generic a, Typeable a)
=> Extractor a
gextractorVariant = buildVariantExtractor gvariantExtractors
{-# INLINE gextractorVariant #-}
-- | Collect extractors as a 'HM.HashMap' keyed by constructor names
gvariantExtractors :: (GSerialiseVariant (Rep a), Generic a) => HM.HashMap T.Text (Extractor a)
gvariantExtractors = fmap to <$> variantExtractor
{-# INLINE gvariantExtractors #-}
-- | Bundle a 'HM.HashMap' of 'Extractor's into an extractor of a variant.
buildVariantExtractor :: (Generic a, Typeable a)
=> HM.HashMap T.Text (Extractor a)
-> Extractor a
buildVariantExtractor extractors = mkExtractor $ \case
SVariant schs0 -> Strategy $ \decs -> do
ds' <- traverse (\(name, sch) -> case HM.lookup name extractors of
Nothing -> Left $ FieldNotFound [] name (HM.keys extractors)
Just f -> runExtractor f sch `unStrategy` decs) schs0
return $ \case
TVariant i _ v -> maybe (throw InvalidTag) ($ v) $ ds' V.!? i
t -> throw $ InvalidTerm t
s -> throwStrategy $ UnexpectedSchema [] "a variant" s
gdecodeCurrentVariant :: forall a. (GConstructorCount (Rep a), GEncodeVariant (Rep a), GDecodeVariant (Rep a), Generic a) => Decoder a
gdecodeCurrentVariant = decodeVarInt >>= fmap to . variantDecoder (variantCount (Proxy :: Proxy (Rep a)))
{-# INLINE gdecodeCurrentVariant #-}
class GConstructorCount f where
variantCount :: proxy f -> Int
instance (GConstructorCount f, GConstructorCount g) => GConstructorCount (f :+: g) where
variantCount _ = variantCount (Proxy @f) + variantCount (Proxy @g)
{-# INLINE variantCount #-}
instance GConstructorCount (C1 i f) where
variantCount _ = 1
{-# INLINE variantCount #-}
instance GConstructorCount f => GConstructorCount (D1 i f) where
variantCount _ = variantCount (Proxy @f)
{-# INLINE variantCount #-}
class GDecodeVariant f where
variantDecoder :: Int -> Int -> Decoder (f x)
instance (GDecodeVariant f, GDecodeVariant g) => GDecodeVariant (f :+: g) where
variantDecoder len i
| i < len' = L1 <$> variantDecoder len' i
| otherwise = R1 <$> variantDecoder (len - len') (i - len')
where
-- Nested ':+:' are balanced
-- cf. https://github.com/GaloisInc/cereal/blob/cereal-0.5.8.1/src/Data/Serialize.hs#L659
len' = unsafeShiftR len 1
{-# INLINE variantDecoder #-}
instance GDecodeProduct f => GDecodeVariant (C1 i f) where
variantDecoder _ _ = M1 <$> productDecoder
{-# INLINE variantDecoder #-}
instance GDecodeVariant f => GDecodeVariant (D1 i f) where
variantDecoder len i = M1 <$> variantDecoder len i
{-# INLINE variantDecoder #-}
class GEncodeVariant f where
variantEncoder :: Int -> Int -> f x -> BB.Builder
instance (GEncodeVariant f, GEncodeVariant g) => GEncodeVariant (f :+: g) where
variantEncoder len i (L1 f) = variantEncoder (unsafeShiftR len 1) i f
variantEncoder len i (R1 g) = variantEncoder (len - len') (i + len') g
where
-- Nested ':+:' are balanced
-- cf. https://github.com/GaloisInc/cereal/blob/cereal-0.5.8.1/src/Data/Serialize.hs#L659
len' = unsafeShiftR len 1
{-# INLINE variantEncoder #-}
instance (GEncodeProduct f) => GEncodeVariant (C1 i f) where
variantEncoder _ !i (M1 a) = varInt i <> productEncoder a
{-# INLINE variantEncoder #-}
instance GEncodeVariant f => GEncodeVariant (D1 i f) where
variantEncoder len i (M1 a) = variantEncoder len i a
{-# INLINE variantEncoder #-}
class GSerialiseVariant f where
variantSchema :: proxy f -> SchemaGen [(T.Text, Schema)]
variantExtractor :: HM.HashMap T.Text (Extractor (f x))
instance (GSerialiseVariant f, GSerialiseVariant g) => GSerialiseVariant (f :+: g) where
variantSchema _ = (++) <$> variantSchema (Proxy @f) <*> variantSchema (Proxy @g)
variantExtractor = fmap (fmap L1) variantExtractor
<> fmap (fmap R1) variantExtractor
instance (GSerialiseProduct f, KnownSymbol name) => GSerialiseVariant (C1 ('MetaCons name fixity 'False) f) where
variantSchema _ = do
s <- productSchema (Proxy @f)
return [(T.pack $ symbolVal (Proxy @name), SProduct $ V.fromList s)]
variantExtractor = HM.singleton (T.pack $ symbolVal (Proxy @name)) (M1 <$> Extractor extractorProduct')
instance (GSerialiseRecord f, KnownSymbol name) => GSerialiseVariant (C1 ('MetaCons name fixity 'True) f) where
variantSchema _ = do
s <- recordSchema (Proxy @f)
return [(T.pack $ symbolVal (Proxy @name), SRecord $ V.fromList s)]
variantExtractor = HM.singleton (T.pack $ symbolVal (Proxy @name)) (M1 <$> Extractor (extractorRecord' Nothing))
instance (GSerialiseVariant f) => GSerialiseVariant (D1 c f) where
variantSchema _ = variantSchema (Proxy @f)
variantExtractor = fmap M1 <$> variantExtractor
-- | An extractor for individual fields. This distinction is required for
-- handling recursions correctly.
--
-- Recommended extension: ApplicativeDo
newtype Subextractor a = Subextractor { unSubextractor :: Extractor a }
deriving (Functor, Applicative, Alternative)
-- | Extract a field of a record.
extractField :: Serialise a => T.Text -> Subextractor a
extractField = extractFieldBy extractor
{-# INLINE extractField #-}
-- | Extract a field using the supplied 'Extractor'.
extractFieldBy :: Extractor a -> T.Text -> Subextractor a
extractFieldBy (Extractor g) name = Subextractor $ Extractor $ \case
SRecord schs -> case lookupWithIndexV name schs of
Just (i, sch) -> do
m <- g sch
return $ \case
TRecord xs -> maybe (throw $ InvalidTerm (TRecord xs)) (m . snd) $ xs V.!? i
t -> throw $ InvalidTerm t
_ -> throwStrategy $ FieldNotFound [] name (map fst $ V.toList schs)
s -> throwStrategy $ UnexpectedSchema [] "a record" s
-- | Build an extractor from a 'Subextractor'.
buildExtractor :: Typeable a => Subextractor a -> Extractor a
buildExtractor (Subextractor e) = mkExtractor $ runExtractor e
{-# INLINE buildExtractor #-}
instance (Typeable k, Typeable b, Typeable h, ApplicativeB b, ConstraintsB b, TraversableB b, AllBF Serialise h b, FieldNamesB b) => Serialise (Barbie b (h :: k -> Type)) where
schemaGen _ = fmap (SRecord . V.fromList . (`appEndo`[]) . bfoldMap getConst)
$ btraverse (\(F.Pair (Dict :: Dict (ClassF Serialise h) a) (Const k))
-> Const . Endo . (:) . (,) k <$> schemaGen (Proxy @(h a)))
$ baddDicts (bfieldNames :: b (Const T.Text))
toBuilder = bfoldMap (\(F.Pair (Dict :: Dict (ClassF Serialise h) a) x) -> toBuilder x) . baddDicts
{-# INLINE toBuilder #-}
decodeCurrent = fmap Barbie $ btraverse (\Dict -> decodeCurrent) (bdicts :: b (Dict (ClassF Serialise h)))
{-# INLINE decodeCurrent #-}
extractor = fmap Barbie $ buildRecordExtractorF bextractorsF
buildRecordExtractorF :: (Typeable b, Typeable h, TraversableB b) => b (Compose Subextractor h) -> Extractor (b h)
buildRecordExtractorF = buildExtractor . btraverse getCompose
{-# INLINE buildRecordExtractorF #-}
-- | Collect extractors for record fields
bextractorsF :: forall b h. (ConstraintsB b, AllBF Serialise h b, FieldNamesB b) => b (Compose Subextractor h)
bextractorsF = bmapC @(ClassF Serialise h) (Compose . extractField . getConst) bfieldNames
{-# INLINABLE bextractorsF #-}
buildRecordExtractor :: (Typeable b, TraversableB b) => b Subextractor -> Extractor (b Identity)
buildRecordExtractor = buildExtractor . btraverse (fmap Identity)
{-# INLINE buildRecordExtractor #-}
-- | Collect extractors for record fields
bextractors :: forall b. (ConstraintsB b, AllB Serialise b, FieldNamesB b) => b Subextractor
bextractors = bmapC @Serialise (extractField . getConst) bfieldNames
{-# INLINABLE bextractors #-}
|
Require Import Logic.lib.Coqlib.
Require Import Logic.GeneralLogic.Base.
Require Import Logic.GeneralLogic.KripkeModel.
Require Import Logic.GeneralLogic.Semantics.Kripke.
Require Import Logic.MinimumLogic.Syntax.
Require Import Logic.MinimumLogic.Semantics.Kripke.
Require Import Logic.PropositionalLogic.Syntax.
Require Import Logic.PropositionalLogic.Semantics.Kripke.
Require Import Logic.SeparationLogic.Syntax.
Require Import Logic.SeparationLogic.Model.SeparationAlgebra.
Require Import Logic.SeparationLogic.Model.OrderedSA.
Require Import Logic.SeparationLogic.Semantics.UpwardsSemantics.
Local Open Scope logic_base.
Local Open Scope syntax.
Local Open Scope kripke_model.
Import PropositionalLanguageNotation.
Import SeparationLogicNotation.
Import KripkeModelFamilyNotation.
Import KripkeModelNotation_Intuitionistic.
Section Sound_Upwards.
Context {L: Language}
{minL: MinimumLanguage L}
{iffpL: IffLanguage L}
{sepconL: SepconLanguage L}
{wandL: WandLanguage L}
{MD: Model}
{kMD: KripkeModel MD}
(M: Kmodel)
{R: Relation (Kworlds M)}
{po_R: PreOrder Krelation}
{J: Join (Kworlds M)}
{SA: SeparationAlgebra (Kworlds M)}
{dSA: DownwardsClosedSeparationAlgebra (Kworlds M)}
{SM: Semantics L MD}
{kiSM: KripkeIntuitionisticSemantics L MD M SM}
{kminSM: KripkeMinimumSemantics L MD M SM}
{kiffpSM: KripkeIffSemantics L MD M SM}
{usepconSM: UpwardsSemantics.SepconSemantics L MD M SM}
{uwandSM: UpwardsSemantics.WandSemantics L MD M SM}.
Lemma sound_sepcon_comm:
forall x y: expr,
forall m,
KRIPKE: M, m |= x * y --> y * x.
Proof.
intros.
rewrite sat_impp; intros.
rewrite sat_sepcon in H0 |- *; intros.
destruct H0 as [m1 [m2 [? [? ?]]]].
exists m2, m1.
split; [| split]; auto.
apply join_comm; auto.
Qed.
Lemma sound_sepcon_assoc:
forall x y z: expr,
forall m,
KRIPKE: M, m |= x * (y * z) <--> (x * y) * z.
Proof.
intros.
apply sat_iffp.
split; intros.
+ rewrite sat_sepcon in H0.
destruct H0 as [mx [myz [? [? ?]]]].
rewrite sat_sepcon in H2.
destruct H2 as [my [mz [? [? ?]]]].
apply join_comm in H0.
apply join_comm in H2.
destruct (join_assoc mz my mx myz n H2 H0) as [mxy [? ?]].
apply join_comm in H5.
apply join_comm in H6.
rewrite sat_sepcon.
exists mxy, mz.
split; [| split]; auto.
rewrite sat_sepcon.
exists mx, my.
split; [| split]; auto.
+ rewrite sat_sepcon in H0.
destruct H0 as [mxy [mz [? [? ?]]]].
rewrite sat_sepcon in H1.
destruct H1 as [mx [my [? [? ?]]]].
destruct (join_assoc mx my mz mxy n H1 H0) as [myz [? ?]].
rewrite sat_sepcon.
exists mx, myz.
split; [| split]; auto.
rewrite sat_sepcon.
exists my, mz.
split; [| split]; auto.
Qed.
Lemma sound_wand_sepcon_adjoint:
forall x y z: expr,
(forall m, KRIPKE: M, m |= x * y --> z) <-> (forall m, KRIPKE: M, m |= x --> (y -* z)).
Proof.
intros.
split; intro.
+ assert (ASSU: forall m1 m2 m, join m1 m2 m -> KRIPKE: M, m1 |= x -> KRIPKE: M, m2 |= y -> KRIPKE: M, m |= z).
{
intros.
specialize (H m).
rewrite sat_impp in H.
apply (H m); [reflexivity |].
rewrite sat_sepcon.
exists m1, m2; auto.
}
clear H.
intros.
rewrite sat_impp; intros.
rewrite sat_wand; intros.
apply (ASSU m0 m1 m2); auto.
eapply sat_mono; eauto.
+ assert (ASSU: forall m0 m1 m2 m, m <= m0 -> join m0 m1 m2 -> KRIPKE: M, m |= x -> KRIPKE: M, m1 |= y -> KRIPKE: M, m2 |= z).
{
intros.
specialize (H m).
rewrite sat_impp in H.
revert m0 m1 m2 H0 H1 H3.
rewrite <- sat_wand.
apply (H m); [reflexivity | auto].
}
intros.
rewrite sat_impp; intros.
rewrite sat_sepcon in H1.
destruct H1 as [m1 [m2 [? [? ?]]]].
apply (ASSU m1 m2 n m1); auto.
reflexivity.
Qed.
Lemma sound_sepcon_mono:
forall x1 x2 y1 y2: expr,
(forall m, KRIPKE: M, m |= x1 --> x2) ->
(forall m, KRIPKE: M, m |= y1 --> y2) ->
(forall m, KRIPKE: M, m |= x1 * y1 --> x2 * y2).
Proof.
intros.
assert (ASSUx: forall m, KRIPKE: M, m |= x1 -> KRIPKE: M, m |= x2).
{
intros.
specialize (H m0).
rewrite sat_impp in H.
apply (H m0); [reflexivity | auto].
}
assert (ASSUy: forall m, KRIPKE: M, m |= y1 -> KRIPKE: M, m |= y2).
{
intros.
specialize (H0 m0).
rewrite sat_impp in H0.
apply (H0 m0); [reflexivity | auto].
}
rewrite sat_impp; intros.
rewrite sat_sepcon in H2 |- *.
destruct H2 as [m1 [m2 [? [? ?]]]].
exists m1, m2; auto.
Qed.
Lemma sound_sepcon_elim1 {incrSA: IncreasingSeparationAlgebra (Kworlds M)}:
forall x y: expr,
forall m, KRIPKE: M, m |= x * y --> x.
Proof.
intros.
rewrite sat_impp; intros.
rewrite sat_sepcon in H0.
destruct H0 as [m1 [m2 [? [? ?]]]].
apply join_comm in H0.
apply all_increasing in H0.
eapply sat_mono; eauto.
Qed.
Context {empL: EmpLanguage L}
{uempSM: UpwardsSemantics.EmpSemantics L MD M SM}.
Lemma sound_sepcon_emp {USA': UnitalSeparationAlgebra' (Kworlds M)}:
forall x: expr,
forall m, KRIPKE: M, m |= x * emp <--> x.
Proof.
intros.
apply sat_iffp.
split; intros.
+ rewrite sat_sepcon in H0.
destruct H0 as [n' [u [? [? ?]]]].
rewrite sat_emp in H2.
apply join_comm in H0.
unfold increasing in H2.
specialize (H2 _ ltac:(reflexivity) _ _ H0).
eapply sat_mono; eauto.
+ rewrite sat_sepcon.
destruct (incr'_exists n) as [u [? ?]].
destruct H1 as [n' [H1 H1']].
exists n', u.
split; [| split]; auto.
- apply join_comm; auto.
- eapply sat_mono; eauto.
- rewrite sat_emp; eauto.
Qed.
(* will weak emp work *)
(* what is unital sa' *)
End Sound_Upwards.
(*****************************************)
(* For SL extension *)
(*****************************************)
(*
Definition unique_cancel {worlds: Type} {kiM: KripkeIntuitionisticModel worlds} {J: Join worlds} (P: worlds -> Prop): Prop :=
forall n,
(exists n1 n2, P n1 /\ join n1 n2 n) ->
(exists n1 n2, P n1 /\ join n1 n2 n /\
forall n1' n2', (P n1' /\ join n1' n2' n) -> n2 <= n2').
Lemma sound_precise_sepcon {L: Language} {nL: NormalLanguage L} {pL: PropositionalLanguage L} {sL: SeparationLanguage L} {MD: Model} {kMD: KripkeModel MD} (M: Kmodel) {R: Relation (Kworlds M)} {po_R: PreOrder Krelation} {J: Join (Kworlds M)} {nSA: SeparationAlgebra (Kworlds M)} {dSA: UpwardsClosedSeparationAlgebra (Kworlds M)} {SM: Semantics L MD} {kiSM: KripkeIntuitionisticSemantics L MD M SM} {usSM: UpwardsSemantics.SeparatingSemantics L MD M SM}:
forall x y,
unique_cancel (fun m => KRIPKE: M, m |= x) ->
unique_cancel (fun m => KRIPKE: M, m |= y) ->
unique_cancel (fun m => KRIPKE: M, m |= x * y).
Proof.
pose proof Korder_PreOrder as H_PreOrder.
intros.
hnf; intros.
destruct H1 as [nxy [n_res [? ?]]].
rewrite sat_sepcon in H1.
destruct H1 as [nx [ny [? [? ?]]]].
destruct (join_assoc _ _ _ _ _ H1 H2) as [nyr [? ?]].
destruct (H n (ex_intro _ nx (ex_intro _ nyr (conj H3 H6))))
as [nx' [nyr' [? [? ?]]]].
pose proof H9 _ _ (conj H3 H6).
destruct (join_Korder_up _ _ _ _ H5 H10) as [ny' [n_res' [? [? ?]]]].
eapply sat_mono in H4; [| exact H12].
destruct (H0 nyr' (ex_intro _ ny' (ex_intro _ n_res' (conj H4 H11))))
as [ny'' [n_res'' [? [? ?]]]].
clear nx ny nxy n_res nyr H1 H2 H3 ny' n_res' H5 H6 H10 H11 H12 H13 H4.
rename nx' into nx, nyr' into nyr, ny'' into ny, n_res'' into nr.
destruct (join_assoc _ _ _ _ _ (join_comm _ _ _ H15) (join_comm _ _ _ H8))
as [nxy [? ?]].
apply join_comm in H1.
apply join_comm in H2.
exists nxy, nr.
split; [rewrite sat_sepcon; eauto | split; [auto |]].
clear H7 H8 H14 H15 H1 H2.
intros nxy' nr' [? ?].
rewrite sat_sepcon in H1.
destruct H1 as [nx' [ny' [? [? ?]]]].
destruct (join_assoc _ _ _ _ _ H1 H2) as [nyr' [? ?]].
specialize (H9 _ _ (conj H3 H6)).
destruct (join_Korder_up _ _ _ _ H5 H9) as [ny'' [nr'' [? [? ?]]]].
eapply sat_mono in H4; [| exact H8].
specialize (H16 _ _ (conj H4 H7)).
etransitivity; eassumption.
Qed.
*)
(*
(* This is over generalization, i.e. the soundness of pure_fact_andp needs extra restriction on models. *)
Definition join_inv {worlds: Type} {kiM: KripkeIntuitionisticModel worlds} {J: Join worlds} (P: worlds -> Prop): Prop :=
(forall n1 n2 n, join n1 n2 n -> P n ->
exists n1' n2', join n1' n2' n /\ n1' <= n1 /\ n2' <= n2 /\ P n1') /\
(forall n1 n2 n, join n1 n2 n -> P n1 -> P n).
Lemma sound_andp_sepcon {L: Language} {nL: NormalLanguage L} {pL: PropositionalLanguage L} {sL: SeparationLanguage L} {MD: Model} {kMD: KripkeModel MD} (M: Kmodel) {R: Relation (Kworlds M)} {po_R: PreOrder Krelation} {J: Join (Kworlds M)} {nSA: SeparationAlgebra (Kworlds M)} {dSA: UpwardsClosedSeparationAlgebra (Kworlds M)} {SM: Semantics L MD} {kiSM: KripkeIntuitionisticSemantics L MD M SM} {usSM: UpwardsSemantics.SeparatingSemantics L MD M SM}:
forall x y z,
join_inv (fun m => KRIPKE: M, m |= x) ->
forall m,
KRIPKE: M, m |= (x && (y * z)) <--> ((x && y) * z).
Proof.
intros.
unfold iffp.
rewrite sat_andp, !sat_impp; split; intros ? _ ?; clear m.
+ rewrite sat_andp in H0; destruct H0.
rewrite sat_sepcon in H1; destruct H1 as [ny [nz [? [? ?]]]].
destruct H as [? _].
specialize (H _ _ _ H1 H0).
destruct H as [ny' [nz' [? [? [? ?]]]]].
rewrite sat_sepcon; exists ny', nz'.
split; [| split]; auto.
- rewrite sat_andp; split; auto.
eapply sat_mono; eauto.
- eapply sat_mono; eauto.
+ rewrite sat_sepcon in H0; destruct H0 as [ny [nz [? [? ?]]]].
rewrite sat_andp in H1; destruct H1.
rewrite sat_andp; split.
- destruct H as [_ ?].
apply (H _ _ _ H0 H1).
- rewrite sat_sepcon; exists ny, nz.
auto.
Qed.
*)
|
#' localrank
#'
#' Get the node-local MPI rank from the default communicator.
#'
#' @useDynLib localrank R_localrank
#' @export
localrank = function()
{
.Call(R_localrank)
}
|
!------------------------------------------------------------------------!
! Authors: Tom Melia, Kirill Melnikov, Raoul Rontsch, Giulia Zanderighi !
! Date: 25/10/2010 !
! Used for arXiv:1007.5313 Wp Wp 2 jets !
!------------------------------------------------------------------------!
subroutine qqb_wpwp_qqb(p,msq)
use qqqqampl
use consts_dp
implicit none
! include 'constants.f'
include 'masses.f'
include 'qcdcouple.f'
include 'ewcouple.f'
integer i,j,k
double precision msq(-5:5,-5:5),p(12,4)
double precision mqqb(3),mqbq(3),mqqq(2),mqbb(2)
double precision mtot(3),mtot_bits(3)
double precision aveqqqq, fac
double precision sw1, sw2, facprop
double complex propw1, propw2
double complex Amp(2)
double precision, parameter :: c1=2d0,c2=-2d0/3d0
c---set msq=0 to initialize
msq=0d0
aveqqqq = 1d0/9d0/4d0
fac = (gw**8)*(gsq**2)/4d0
sw1 =2d0*(p(3,4)*p(4,4)-p(3,1)*p(4,1)-p(3,2)*p(4,2)-p(3,3)*p(4,3))
sw2 =2d0*(p(5,4)*p(6,4)-p(5,1)*p(6,1)-p(5,2)*p(6,2)-p(5,3)*p(6,3))
propw1 = sw1/(sw1-wmass**2+ci*wwidth*wmass)
propw2 = sw2/(sw2-wmass**2+ci*wwidth*wmass)
facprop = abs(propw1)**2*abs(propw2)**2
fac = fac*aveqqqq*facprop
call getamplqqqq(p(1:8,:),1,2,7,8,Amp(1))
call getamplqqqq(p(1:8,:),1,8,7,2,Amp(2))
Amp(2)=-Amp(2)
mqqb(1) = fac*(c1*abs(Amp(1))**2+c1*abs(Amp(2))**2 +
. c2*(Amp(1)*dconjg(Amp(2))+dconjg(Amp(1))*Amp(2)))
mqqb(2) = fac*(c1*abs(Amp(1))**2)
mqqb(3) = fac*(c1*abs(Amp(2))**2)
call getamplqqqq(p(1:8,:),2,1,7,8,Amp(1))
call getamplqqqq(p(1:8,:),2,8,7,1,Amp(2))
Amp(2)=-Amp(2)
mqbq(1) = fac*(c1*abs(Amp(1))**2+c1*abs(Amp(2))**2 +
. c2*(Amp(1)*dconjg(Amp(2))+dconjg(Amp(1))*Amp(2)))
mqbq(2) = fac*(c1*abs(Amp(1))**2)
mqbq(3) = fac*(c1*abs(Amp(2))**2)
call getamplqqqq(p(1:8,:),1,7,2,8,Amp(1))
call getamplqqqq(p(1:8,:),1,8,2,7,Amp(2))
Amp(2)=-Amp(2)
mqqq(1) = fac*(c1*abs(Amp(1))**2+c1*abs(Amp(2))**2 +
. c2*(Amp(1)*dconjg(Amp(2))+dconjg(Amp(1))*Amp(2)))
mqqq(2) = fac*(c1*abs(Amp(1))**2)
call getamplqqqq(p(1:8,:),7,1,8,2,Amp(1))
call getamplqqqq(p(1:8,:),7,2,8,1,Amp(2))
Amp(2)=-Amp(2)
mqbb(1) = fac*(c1*abs(Amp(1))**2+c1*abs(Amp(2))**2 +
. c2*(Amp(1)*dconjg(Amp(2))+dconjg(Amp(1))*Amp(2)))
mqbb(2) = fac*(c1*abs(Amp(1))**2)
!---fill msq
msq(2,-1) = mqqb(1) + mqqb(2) ! u dbar initial state
msq(2,-3) = mqqb(3) ! u sbar initial state
msq(4,-3) = mqqb(1) + mqqb(2) ! c sbar initial state
msq(4,-1) = mqqb(3) ! c dbar initial state
msq(-1,2) = mqbq(1) + mqbq(2) ! dbar u initial state
msq(-3,2) = mqbq(3) ! sbar u initial state
msq(-3,4) = mqbq(1) + mqbq(2) ! sbar c intital state
msq(-1,4) = mqbq(3) ! dbar c initial state
msq(2,2) = mqqq(1)*(1d0/2d0) ! u u initial state
msq(2,4) = mqqq(2) ! u c initial state
msq(4,2) = mqqq(2) ! c u initial state
msq(4,4) = mqqq(1)*(1d0/2d0) ! c c initial state
msq(-1,-1) = mqbb(1)*(1d0/2d0) ! dbar dbar initial state
msq(-1,-3) = mqbb(2) ! dbar sbar initial state
msq(-3,-1) = mqbb(2) ! sbar dbar initial state
msq(-3,-3) = mqbb(1)*(1d0/2d0) ! sbar sbar initial state
return
end
|
program AdvectSlottedCylindersDriver
use NumberKindsModule
use OutputWriterModule
use LoggerModule
use ParticlesModule
use EdgesModule
use FacesModule
use PolyMesh2dModule
use FieldModule
use MPISetupModule
use SphereGeomModule
use RefinementModule
use SSRFPACKInterfaceModule
use SSRFPACKRemeshModule
use SphereTransportSolverModule
use SphereTracersModule
use SphereTransportModule
use SphereTransportVelocitiesModule, velFn => LauritzenEtalDeformationalVelocity
implicit none
include 'mpif.h'
! mesh variables
type(TransportMesh) :: sphere
type(RefineSetup) :: refinement
integer(kint) :: initNest
integer(kint) :: maxNest
integer(kint) :: faceKind
integer(kint) :: meshSeed
integer(kint) :: amrLimit
real(kreal), parameter :: radius = 1.0_kreal
logical(klog) :: continueAMR
logical(klog) :: AMR
integer(kint) :: nParticlesBefore
integer(kint) :: nParticlesAfter
namelist /meshDefine/ faceKind, initNest, amrLimit
! test case variables
real(kreal), allocatable, dimension(:) :: trMass
real(kreal) :: l2Err, l2Denom
real(kreal) :: lInfErr
real(kreal) :: qMinTrue, qMaxTrue
real(kreal) :: qMinComp, qMaxComp
real(kreal) :: qMinErr, qMaxErr
real(kreal), parameter :: qRange = 0.9_kreal
integer(kint), parameter :: nTracers = 3
integer(kint), dimension(3), parameter :: tracerDims = [1,1,1]
! remeshing variables
type(TransportRemesh) :: remesh
integer(kint) :: remeshInterval
integer(kint) :: remeshCounter
type(TransportMesh) :: tempSphere
logical(klog) :: useDirectRemesh
! timestepping
type(TransportSolver) :: solver
real(kreal) :: dt
real(kreal) :: t
real(kreal) :: tfinal
integer(kint) :: nTimesteps
integer(kint) :: timeJ
namelist /timestepping/ dt, tfinal, remeshInterval, useDirectRemesh
! i/o
character(len=MAX_STRING_LENGTH) :: outputDir
character(len=MAX_STRING_LENGTH) :: outputRoot
character(len=MAX_STRING_LENGTH) :: vtkFile
character(len=MAX_STRING_LENGTH) :: matlabFile
character(len=MAX_STRING_LENGTH) :: vtkRoot
character(len=MAX_STRING_LENGTH) :: meshString
integer(kint) :: frameOut
integer(kint) :: frameCounter
namelist /fileIO/ outputDir, outputRoot, frameOut
! computing environment / general
type(Logger) :: exeLog
character(len=MAX_STRING_LENGTH) :: logString
integer(kint), parameter :: logLevel = DEBUG_LOGGING_LEVEL
character(len=28) :: logKey = "AdvectSlottedC"
integer(kint) :: mpiErrCode
real(kreal) :: timeStart, timeEnd
integer(kint) :: i
real(kreal), dimension(3) :: vec
!--------------------------------
! initialize : setup computing environment
!--------------------------------
call MPI_INIT(mpiErrCode)
call MPI_COMM_SIZE(MPI_COMM_WORLD, numProcs, mpiErrCode)
call MPI_COMM_RANK(MPI_COMM_WORLD, procRank, mpiErrCode)
call InitLogger(exeLog, procRank)
timeStart = MPI_WTIME()
call ReadNamelistFile( procRank )
!
! initialize mesh and spatial fields
!
t = 0.0_kreal
call New( sphere, meshSeed, initNest, maxNest, amrLimit, radius, .FALSE.)
call AddTracers(sphere, nTracers, tracerDims)
sphere%tracers(1)%name = "slotC"
sphere%tracers(2)%name = "initialLatitude"
sphere%tracers(3)%name = "relError"
sphere%tracers(3)%N = sphere%mesh%particles%N
call SetInitialDensityOnMesh(sphere)
call SetTracerOnMesh( sphere, 1, SlottedCylinderTracer )
call SetVelocityOnMesh( sphere, velFn, t)
call SetDivergenceOnMesh(sphere)
do i = 1, sphere%mesh%particles%N
vec = LagCoord(sphere%mesh%particles, i)
call InsertScalarToField( sphere%tracers(2), Latitude(vec) )
enddo
! TO DO : AMR
!
! Output initial data
!
frameCounter = 0
remeshCounter = 0
if ( procRank == 0 ) then
call LogStats(sphere, exeLog)
if (meshSeed == ICOS_TRI_SPHERE_SEED) then
if ( initNest == maxNest) then
write(meshString, '(A,I1,A)') '_icosTri', initNest, '_'
else
write(meshString, '(2(A,I1),A)') '_icosTriAMR', initNest, 'to', maxNest, '_'
endif
elseif (meshSeed == CUBED_SPHERE_SEED ) then
if ( initNest == maxNest ) then
write(meshString, '(A,I1,A)') '_cubedSphere', initNest, '_'
else
write(meshString, '(2(A,I1),A)') '_cubedSphereAMR', initNest, 'to', maxNest, '_'
endif
endif
write(vtkRoot,'(4A)') trim(outputDir), '/vtkOut/', trim(outputRoot), trim(meshString)
write(vtkFile,'(A,I0.4,A)') trim(vtkRoot), frameCounter, '.vtk'
call OutputToVTK(sphere, vtkFile)
frameCounter = frameCounter + 1
call LogMessage(exeLog, TRACE_LOGGING_LEVEL, trim(logkey)//" t = ", t)
endif
!
! initialize time stepping
!
call New(solver, sphere)
nTimesteps = floor( tfinal/dt )
allocate(trMass( nTimesteps + 1))
trMass(1) = TracerMass(sphere, 1)
qMinTrue = MinScalarVal(sphere%tracers(1))
qMaxTrue = MaxScalarVal(sphere%tracers(1))
!--------------------------------
! run : evolve the problem in time
!--------------------------------
call LogMessage(exeLog, DEBUG_LOGGING_LEVEL, trim(logkey)//" ", "starting timestepping loop.")
do timeJ = 0, nTimesteps - 1
if ( mod(timeJ+1, remeshInterval) == 0 ) then
call LogMessage(exeLog, TRACE_LOGGING_LEVEL, trim(logkey)//" remesh triggered by remesh interval : ",&
remeshCounter)
call New(remesh, sphere)
call New(tempSphere, meshSeed, initNest, maxNest, amrLimit, radius, .FALSE.)
call AddTracers(tempSphere, nTracers, tracerDims)
tempSphere%tracers(1)%name = "slotC"
tempSphere%tracers(2)%name = "initialLatitude"
tempSphere%tracers(3)%name = "relError"
call LagrangianRemeshTransportWithFunctions(remesh, sphere, tempSphere, .FALSE., velFn, t, &
tracerFn1 = SlottedCylinderTracer, tracerFn2 = InitLatTracer )
call Copy(sphere, tempSphere)
remeshCounter = remeshCounter + 1
call Delete(tempSphere)
call Delete(remesh)
call Delete(solver)
call New(solver, sphere)
endif
call Timestep(solver, sphere, t, dt, velFn)
t = real(timeJ +1, kreal) * dt
sphere%mesh%t = t
trMass(timeJ+2) = TracerMass(sphere, 1)
if ( timeJ+1 == nTimesteps ) then
!--------------------------------
! calculate error at each particle
!--------------------------------
do i = 1, sphere%mesh%particles%N
sphere%tracers(3)%scalar(i) = abs(SlottedCylinderTracer( sphere%mesh%particles%x(i), &
sphere%mesh%particles%y(i), sphere%mesh%particles%z(i) ) - sphere%tracers(1)%scalar(i) ) / qRange
enddo
endif
if ( procRank == 0 .AND. mod(timeJ+1, frameOut) == 0 ) then
write(vtkFile,'(A,I0.4,A)') trim(vtkRoot), frameCounter, '.vtk'
call OutputToVTK(sphere, vtkFile)
frameCounter = frameCounter + 1
call LogMessage(exelog, TRACE_LOGGING_LEVEL, trim(logKey)//" t = ", t)
endif
enddo
!
! write t = tfinal output
!
if ( procRank == 0 ) then
write(matlabFile, '(5A)') trim(outputDir), '/', trim(outputRoot), trim(meshString), '.m'
l2Err = 0.0_kreal
l2Denom = 0.0_kreal
do i = 1, sphere%mesh%particles%N
if ( sphere%mesh%particles%isActive(i) ) then
l2Err = l2Err + sphere%tracers(3)%scalar(i) * sphere%tracers(3)%scalar(i) * sphere%mesh%particles%area(i)
l2Denom = l2Denom + SlottedCylinderTracer( sphere%mesh%particles%x(i), sphere%mesh%particles%y(i), &
sphere%mesh%particles%z(i) ) ** 2 * sphere%mesh%particles%area(i)
endif
enddo
l2Err = l2Err / l2Denom
lInfErr = MaxScalarVal(sphere%tracers(3))
qMinComp = MinScalarVal(sphere%tracers(1))
qMaxComp = MaxScalarVal(sphere%tracers(1))
qMinErr = (qMinComp - qMinTrue) / qRange
qMaxErr = (qMaxComp - qMaxTrue) / qRange
call StartSection(exeLog, "Final Errors: "//meshString )
call LogMessage(exeLog, TRACE_LOGGING_LEVEL, "l2Err = ", l2Err )
call LogMessage(exeLog, TRACE_LOGGING_LEVEL, "lInfErr = ", lInfErr )
call LogMessage(exeLog, TRACE_LOGGING_LEVEL, "qMinErr = ", qMinErr )
call LogMessage(exeLog, TRACE_LOGGING_LEVEL, "qMaxErr = ", qMaxErr )
call LogMessage(exeLog, TRACE_LOGGING_LEVEL, "rel. tracer mass change = ", &
maxval(abs(trMass - trMass(1))) / trMass(1) )
call LogMessage(exeLog, TRACE_LOGGING_LEVEL, " ", " ")
call EndSection(exeLog)
open(unit=WRITE_UNIT_1, file=matlabFile, status='REPLACE', action='WRITE')
write(WRITE_UNIT_1,'(A,F12.9,A,F12.6,A)') "t = 0:", dt,":", tfinal, ";"
call WriteToMatlab(trMass, WRITE_UNIT_1, "trMass")
call WriteToMatlab(l2Err, WRITE_UNIT_1, "l2Err")
call WriteToMatlab(lInfErr, WRITE_UNIT_1, "lInfErr")
call WriteToMatlab(qMinErr, WRITE_UNIT_1, "qMinErr")
call WriteToMatlab(qMaxErr, WRITE_UNIT_1, "qMaxErr")
call WriteToMatlab(maxval(abs(trMass - trMass(1))) / trMass(1), WRITE_UNIT_1, "tracerMassChange")
close(WRITE_UNIT_1)
endif
!--------------------------------
! finalize : clean up
!--------------------------------
timeEnd = MPI_WTIME()
write(logstring,'(A,F12.2,A)') "PROGRAM COMPLETE : elapsed time ", timeEnd - timeStart, " seconds."
call LogMessage(exeLog, TRACE_LOGGING_LEVEL, trim(logKey)//" ", logstring)
call Delete(solver)
call Delete(sphere)
deallocate(trMass)
call MPI_FINALIZE(mpiErrCode)
contains
subroutine ReadNamelistFile( rank )
integer(kint), intent(in) :: rank
!
character(len=MAX_STRING_LENGTH) :: namelistFilename
integer(kint), parameter :: initBcast_intSize = 7
integer(kint), parameter :: initBcast_realSize = 2
integer(kint), dimension(initBcast_intSize) :: bcastIntegers
real(kreal), dimension(initBcast_realSize) :: bcastReals
integer(kint) :: mpiErrCode, readStat
if ( COMMAND_ARGUMENT_COUNT() /= 1 ) then
call LogMessage(exeLog, ERROR_LOGGING_LEVEL, trim(logKey), " ERROR: expected namelist file as 1st argument.")
stop
endif
if ( rank == 0 ) then
call GET_COMMAND_ARGUMENT(1, namelistFilename)
open(unit=READ_UNIT, file=namelistFilename, status='OLD', action='READ', iostat=readStat)
if ( readStat /= 0 ) then
call LogMessage(exeLog, ERROR_LOGGING_LEVEL, trim(logKey), " ERROR: cannot read namelist file.")
stop
endif
read(READ_UNIT, nml=meshDefine)
rewind(READ_UNIT)
read(READ_UNIT, nml=timestepping)
rewind(READ_UNIT)
read(READ_UNIT, nml=fileIO)
close(READ_UNIT)
if ( faceKind == 3 ) then
meshSeed = ICOS_TRI_SPHERE_SEED
elseif ( faceKind == 4) then
meshSeed = CUBED_SPHERE_SEED
else
call LogMessage(exeLog, WARNING_LOGGING_LEVEL, trim(logkey)//" ReadNamelistFile WARNING : ", &
" invalid faceKind -- using triangles.")
meshSeed = ICOS_TRI_SPHERE_SEED
endif
maxNest = initNest + amrLimit
! namelist /meshDefine/ faceKind, initNest, maxNest, amrLimit, radius
! namelist /timestepping/ dt, tfinal
! namelist /fileIO/ outputDir, outputRoot, frameOut
bcastIntegers(1) = meshSeed
bcastIntegers(2) = initNest
bcastIntegers(3) = maxNest
bcastIntegers(4) = amrLimit
bcastIntegers(5) = frameOut
bcastIntegers(6) = remeshInterval
if ( useDirectRemesh ) then
bcastIntegers(7) = 1
else
bcastIntegers(7) = 0
endif
bcastReals(1) = dt
bcastReals(2) = tfinal
endif
call MPI_BCAST(bcastIntegers, initBCAST_intSize, MPI_INTEGER, 0, MPI_COMM_WORLD, mpiErrCode)
if ( mpiErrCode /= 0 ) then
call LogMessage(exeLog, ERROR_LOGGING_LEVEL, trim(logKey)//" bcastIntegers, MPI_BCAST ERROR : ", mpiErrCode)
endif
call MPI_BCAST(bcastReals, initBCAST_realSize, MPI_DOUBLE_PRECISION, 0, MPI_COMM_WORLD, mpiErrCode)
if ( mpiErrCode /= 0 ) then
call LogMessage(exeLog, ERROR_LOGGING_LEVEL, trim(logKey)//" bcastReals, MPI_BCAST ERROR : ", mpiErrCode)
endif
meshSeed = bcastIntegers(1)
initNest = bcastIntegers(2)
maxNest = bcastIntegers(3)
amrLimit = bcastIntegers(4)
frameOut = bcastIntegers(5)
remeshInterval = bcastIntegers(6)
if (bcastIntegers(7) > 0 ) then
useDirectRemesh = .TRUE.
else
useDirectRemesh = .FALSE.
endif
dt = bcastReals(1)
tfinal = bcastReals(2)
end subroutine
!> @brief Initializes a @ref Logger for this executable program.
!>
!> Output is controlled by message priority level and MPI rank.
!>
!> @param[in] log @ref Logger to initialize
!> @param[in] rank MPI rank
subroutine InitLogger(log, rank)
type(Logger), intent(inout) :: log
integer(kint), intent(in) :: rank
if ( rank == 0 ) then
call New(log, logLevel)
else
call New(log, ERROR_LOGGING_LEVEL)
endif
write(logKey,'(A,I0.2,A)') trim(logKey)//"_", rank, ":"
end subroutine
end program
|
# Lab 2: Stochastic Gradient Descent & Pytorch
**Tomas Beuzen, January 2021**
## Table of Contents
<hr>
<div class="toc"><ul class="toc-item"><li><span><a href="#Instructions" data-toc-modified-id="Instructions-2">Instructions</a></span></li><li><span><a href="#Imports" data-toc-modified-id="Imports-3">Imports</a></span></li><li><span><a href="#Exercise-1:-Stochastic-Gradient-Descent" data-toc-modified-id="Exercise-1:-Stochastic-Gradient-Descent-4">Exercise 1: Stochastic Gradient Descent</a></span></li><li><span><a href="#Exercise-2:-SGDClassifier-and-SGDRegresor" data-toc-modified-id="Exercise-2:-SGDClassifier-and-SGDRegresor-5">Exercise 2: <code>SGDClassifier</code> and <code>SGDRegresor</code></a></span></li><li><span><a href="#Exercise-3:-Neural-Networks-"By-Hand"" data-toc-modified-id="Exercise-3:-Neural-Networks-"By-Hand"-6">Exercise 3: Neural Networks "By Hand"</a></span></li><li><span><a href="#Exercise-4:-Predicting-Fashion" data-toc-modified-id="Exercise-4:-Predicting-Fashion-7">Exercise 4: Predicting Fashion</a></span></li><li><span><a href="#(Optional)-Exercise-5:-Implementing-Adam-Optimization-From-Scratch" data-toc-modified-id="(Optional)-Exercise-5:-Implementing-Adam-Optimization-From-Scratch-8">(Optional) Exercise 5: Implementing Adam Optimization From Scratch</a></span></li><li><span><a href="#(Optional)-Exercise-6:-Gif-or-Jiff" data-toc-modified-id="(Optional)-Exercise-6:-Gif-or-Jiff-9">(Optional) Exercise 6: Gif or Jiff</a></span></li><li><span><a href="#Submit-to-Canvas-and-GitHub" data-toc-modified-id="Submit-to-Canvas-and-GitHub-10">Submit to Canvas and GitHub</a></span></li></ul></div>
## Instructions
<hr>
rubric={mechanics:3}
**Link to your GitHub repository:**
You will receive marks for correctly submitting this assignment. To submit this assignment you should:
1. Push your assignment to your GitHub repository!
2. Provide a link to your repository in the space provided above.
2. Upload a HTML render of your assignment to Canvas. The last cell of this notebook will help you do that.
3. Be sure to follow the [General Lab Instructions](https://ubc-mds.github.io/resources_pages/general_lab_instructions/). You can view a description of the different rubrics used for grading in MDS [here](https://github.com/UBC-MDS/public/tree/master/rubric).
Here's a break down of the required and optional exercises in this lab:
| | Number of Exercises | Points |
|:-------:|:-------------------:|:------:|
| Required| 13 | 35 |
| Optional| 2 | 2 |
## Imports
<hr>
```python
import numpy as np
import pandas as pd
import time
import torch
from torch import nn
from torchvision import datasets, transforms
from sklearn.datasets import load_boston
from sklearn.preprocessing import MinMaxScaler
from sklearn.linear_model import LinearRegression, LogisticRegression, SGDClassifier
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import CountVectorizer
from canvasutils.submit import submit, convert_notebook
import matplotlib.pyplot as plt
plt.style.use('ggplot')
plt.rcParams.update({'font.size': 16, 'figure.figsize': (5,5), 'axes.grid': False})
```
## Exercise 1: Stochastic Gradient Descent
<hr>
Below is a super-streamlined Python function that performs gradient descent, it's much like the code you saw in Lectures and in Lab 1. I just made a few small changes:
- Removed the docstring and `print` statements for brevity.
- The algorithm stops after `n_iters`.
I also include functions to calculate the MSE and gradient of MSE for a linear model $\hat{y}=w^Tx$.
```python
def gradient_descent(f, f_grad, w0, X, y, n_iters=1000, α=0.001):
w = w0
for _ in range(n_iters):
w = w - α * f_grad(w, X, y)
return w
def mse(w, X, y):
return np.mean((X @ w - y) ** 2)
def mse_grad(w, X, y):
return X.T @ (X @ w) - X.T @ y
```
The code works fine, although it is quite slow as per usual for vanilla gradient descent. For example, here we do ordinary least squares linear regression on the boston house-prices dataset from sklearn:
```python
X, y = load_boston(return_X_y=True)
X = MinMaxScaler().fit_transform(X)
```
```python
start = time.time()
w0 = np.zeros(X.shape[1])
w_gd = gradient_descent(mse, mse_grad, w0, X, y, n_iters=10**5)
print(f"Fitting time = {time.time() - start:.4f}s")
print("Weights:")
w_gd
```
Compared to sklearn's `LinearRegression()`:
```python
start = time.time()
lr = LinearRegression(fit_intercept=False).fit(X, y)
print(f"Fitting time = {time.time() - start:.4f}s")
print("Weights:")
lr.coef_
```
As we can see, the coefficients obtained from gradient descent are very similar to those obtained by sklearn's `LinearRegression()` (although sklearn is much faster). All is well so far.
### 1.1
rubric={accuracy:5}
In this exercise your task is to implement a function `stochastic_gradient_descent`, that performs SGD, _using_ the `gradient_descent` function provided above. You can have your function accept the same arguments as the `gradient_descent` function above, except:
- Change `n_iters` to `n_epochs`.
- Add an extra `batch_size` argument.
- Your implementation of SGD should follow "[Approach 1](https://pages.github.ubc.ca/MDS-2020-21/DSCI_572_sup-learn-2_students/lectures/lecture3_stochastic-gradient-descent.html#sampling-with-or-without-replacement)" from Lecture 3: shuffle the dataset and then divide it into batches. If the numer of samples is not divisible by the `batch_size`, your last batch will have less than `batch_size` samples - you can either throw this last batch away or use it (I usually choose to use it and that's the default in PyTorch, the library we'll be using to build neural networks starting next lecture).
- You can leave `α` constant for all iterations.
>The pedagogical goal here is to help you see how SGD relates to regular "vanilla" gradient descent. In reality it would be fine to implement SGD "from scratch" without calling a GD function.
```python
def stochastic_gradient_descent(f, f_grad, w0, X, y, n_epochs=1, α=0.001, batch_size=1):
pass # Your solution goes here.
stochastic_gradient_descent(mse, mse_grad, w0, X, y) # Test your function with defaults (results probably won't be very good)
```
### 1.2
rubric={accuracy:3}
Show that when the batch size is set to the whole training set (i.e., `batch_size=len(X)`), you get exactly the same estimated coefficients with SGD and GD. Use the same learning rate (`α=0.001`) and number of epochs (`10 ** 5`) for both algorithms.
```python
w_gd = gradient_descent(mse, mse_grad, w0, X, y, n_iters=10**5) # GD coefficients
print(w_gd)
w_sgd = None # Your solution goes here.
print(w_sgd)
```
## Exercise 2: `SGDClassifier` and `SGDRegresor`
<hr>
In this exercise we'll explore training a classifier with SGD on the [Sentiment140 dataset](http://help.sentiment140.com/home), which contains tweets labeled with sentiment associated with a brand, product, or topic. Please start by doing the following:
1. Download the corpus from [here](http://cs.stanford.edu/people/alecmgo/trainingandtestdata.zip).
2. Unzip.
3. Copy the file `training.1600000.processed.noemoticon.csv` into the current directory.
4. Create a `.gitignore` file so that you don't accidentally commit the dataset (I've tried to do this for you but please double check it).
Once you're done the above, steps, run the starter code below:
```python
# Data loading and preprocessing
df = pd.read_csv(
"training.1600000.processed.noemoticon.csv",
encoding="ISO-8859-1",
names=["label", "id", "date", "no_query", "name", "text"],
)
df["label"] = df["label"].map({0: "neg", 4: "pos"}) # change 0's to "neg" and 4's to "pos"
df.head()
```
Now we split the data:
```python
X, y = df["text"], df["label"]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.25, random_state=2021)
```
And then we encode it using `CountVectorizer`, which may take a minute or so:
```python
vec = CountVectorizer(stop_words='english')
X_train = vec.fit_transform(X_train)
X_test = vec.transform(X_test)
```
Note that our training data is rather large compared to datasets we've explored in the past:
```python
X_train.shape
```
Luckily, `CountVectorizer()` returns us a sparse matrix:
```python
type(X_train)
```
Recall that a sparse matrix is a more efficient representation of a matrix that contains many 0's. What percentage of our array is non-zero?
```python
print(f"{X_train.nnz / np.prod(X_train.shape) * 100:.5f}%")
```
So few non-zero values - lucky we have a sparse matrix! Anyway, let's train a classifier (this may take a while!):
```python
lr = LogisticRegression()
```
```python
t = time.time()
lr.fit(X_train, y_train)
print(f"Training took {time.time() - t:.1f} seconds")
```
```python
print(f"Train score: {lr.score(X_train, y_train):.2f}")
print(f"Test score: {lr.score(X_test, y_test):.2f}")
```
### 2.1
rubric={accuracy:3}
In sklearn, there is a classifier called `linear_model.SGDClassifier()` - [see the docs](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html) (there's also a `SGDRegressor` but we won't look at that here). As the name suggests, this model can train linear classifiers with SGD - in the true sense of the algorithm, 1 sample per iteration (i.e., batch size of 1).
Train a logistic regression model on the same dataset above using `SGDClassifier`. Compare the training time of your `SGDClassifier` to `LogisticRegression()`. You'll need to specify the correct `loss` argument in `SGDClassifier()` to train a logistic regression model. [Read the docstring](https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.SGDClassifier.html) to find the appropriate `loss`.
> The pedagogical goal here is to demonstrate how using just one sample per iteration in SGD can significantly speed up training, and accuracy-wise, is not a terrible idea!
```python
# Your solution goes here.
```
### 2.2
rubric={reasoning:2}
Discuss the training and test accuracies of your `SGDClassifier()` and `LogisticRegression()` models. Is there any difference between the two models?
```python
# Your solution goes here.
```
### 2.3
rubric={reasoning:3}
One possible explanation for `SGDClassifier`'s speed is that it's just doing fewer iterations (epochs) before converging. `SGDClassifier` and `LogisticRegression` have an `n_iter_` attribute which you can check after fitting (in these sklearn models, `n_iter_` is equivalent to "number of epochs").
1. Compare these values and discuss them in the context of the above hypothesis.
2. Then, using the `max_iter` parameter, do a "fair" experiment where `SGDClassifier` and `LogisticRegression` do the same number of passes through the dataset, and comment on the results.
>To be completely "fair" we should also make sure that the tolerance and regularization strength in both models is the same (by default they are not) - but you don't need to worry about that here. Just focus on the number of iterations/epochs.
Your solution goes here.
## Exercise 3: Neural Networks "By Hand"
<hr>
### 3.1
rubric={accuracy:4}
The neural networks we've seen in [Lecture 4](https://pages.github.ubc.ca/MDS-2020-21/DSCI_572_sup-learn-2_students/lectures/lecture4_pytorch-neural-networks-pt1.html) are just recursive functions where each layer is made up of the previous layer's output, multiplied by some weights, with some biases added, and passed through an activation function (we call these networks "fully-connected feed-forward networks", but more on that next week). We don't usually include the input layer when counting up the layers in a network. So a 2 layer network (`L=2`) really means: 1 input layer, 1 hidden layer, 1 output layer. A 3 layer network (`L=3`) really means: 1 input layer, 2 hidden layers, 1 output layer.
Mathematically, our networks have the form:
$$ x^{(l+1)} = h\left( W^{(l)} x^{(l)} + b^{(l)}\right) $$
where:
- $W^{(l)}$ is a matrix of weights.
- $b^{(l)}$ is a vector of biases.
- $x^{(l)}$ is the output of layer $l$:
- $x^{(0)}$ are the inputs
- $x^{(1)}$ are the outputs of the first hidden layers, i.e., $x^{(1)} = h\left( W^{(0)} x^{(0)} + b^{(0)}\right)$
- etc.
- $x^{(L)} = \hat{y}$
- Classification: $\hat{y} = h\left( W^{(L-1)} x^{(L-1)} + b^{(L-1)}\right)$
- Regression: $\hat{y} = W^{(L-1)} x^{(L-1)} + b^{(L-1)}$ (no activation!)
Suppose that we use a neural network with one hidden layer with a **ReLU activation** for a **regression** problem. After training, we obtain the following parameters:
$$\begin{align}W^{(0)} &= \begin{bmatrix}-2 & 2 & -1\\-1 & -2 & 0\end{bmatrix}, &b^{(0)}&=\begin{bmatrix}2 \\ 0\end{bmatrix} \\ W^{(1)} &= \begin{bmatrix}3 & 1\end{bmatrix}, &b^{(1)}&=-10\end{align}$$
For a training example with features $x = \begin{bmatrix}3 \\-2 \\ 2\end{bmatrix}$ what are the values in this network of $x^{(1)}$ and $\hat{y}$? Show your work using code cells or LaTeX.
```python
# Your answer goes here.
```
### 3.2
rubric={reasoning:4}
Draw this neural network using a circle/arrow diagram (similar to [the ones I drew in Lecture 4](https://pages.github.ubc.ca/MDS-2020-21/DSCI_572_sup-learn-2_students/lectures/lecture4_pytorch-neural-networks-pt1.html#neural-network-basics)). Label the diagram with the weight/bias values given above. If you want to draw this diagram by hand, that is fine: you can take a photo of the drawing and put it in here. If you are doing so, make sure you upload the image to your repo!
Your drawing goes here.
## Exercise 4: Predicting Fashion
<hr>
In this Exercise I'm going to get you to train a neural network using the Fashion-MNIST dataset. Fashion-MNIST is a set of 28 x 28 pixel greyscale images of clothes. Some of you may have worked with this dataset before - it's a classic. I promise that our datasets will get more interesting than this, but this dataset is ideal for your first PyTorch exercise. Below is a sample of some of the images in the dataset - we have 10 classes in the dataset: T-shirt/tops, Trousers, Pullovers, Dresss, Coats, Sandals, Shirts, Sneakers, Bags, and Ankle Boots.
The goal of this exercise is to develop a network that can correctly predict a given image of "fashion" into one of the 10 classes. This is a multi-class classification task, our model should spit out 10 probabilities for a given image - one probability for each class. Ideally the class our model predicts with maximum probability is the correct one!
The below cell will download and load in the Fashion-MNIST data for you. We'll talk more about this process next week, but briefly:
- Think of images as ndarrays of data, in the case of grayscale images like we have here, each pixel has a value between 0 and 1 indicating how "bright" that pixel is. So each image here is just a 28 x 28 ndarray with values ranging from 0 to 1! (when we get to colour images, it's exactly the same, except each pixel has 3 values, one for each of the colour channels Red, Blue, Green. If we had colour images here our array would be 28 x 28 x 3).
- `transform`: applies some transformations to the images. Here we are converting the data to tensors. We'll work with these more next week so don't worry too much about them.
- `torch.utils.data.DataLoader`: these are "data loaders". Think of them as generators. During training/testing, we can easily query them for a batch of data of size `BATCH_SIZE`. Cool!
```python
BATCH_SIZE = 64
# Define a transform to normalize the data, which usually helps with training
transform = transforms.Compose([transforms.ToTensor()])
# Download data
trainset = datasets.FashionMNIST('~/.pytorch/F_MNIST_data/', download=True, train=True, transform=transform)
testset = datasets.FashionMNIST('~/.pytorch/F_MNIST_data/', download=True, train=False, transform=transform)
# Create data loaders (these are just generators that will give us `batch_size` samples as a time)
trainloader = torch.utils.data.DataLoader(trainset, batch_size=64, shuffle=True)
testloader = torch.utils.data.DataLoader(testset, batch_size=64, shuffle=True)
# Class labels
class_labels = ['T-shirt/top', 'Trouser', 'Pullover', 'Dress', 'Coat',
'Sandal', 'Shirt', 'Sneaker', 'Bag', 'Ankle Boot']
```
Let's plot a random image (run this cell as many times as you like to see different images):
```python
image, label = next(iter(trainloader)) # Get a random batch of 64 images
i = np.random.randint(0, 64) # Choose one image at random
plt.imshow(image[i, 0], cmap='gray') # Plot
plt.title(class_labels[label[i]]);
```
### 4.1
rubric={accuracy:3}
Notice in the plot above that our image is 28 x 28 pixels. How do we feed this into a neural network? Well we can flatten it out into a vector of 784 elements (28 x 28 = 784) and create 784 input nodes! We'll do this later on - for now, all I want you to do is create a new class defining a classifier with the following architecture ([this section of Lecture 4](https://pages.github.ubc.ca/MDS-2020-21/DSCI_572_sup-learn-2_students/lectures/lecture4_pytorch-neural-networks-pt1.html#non-linear-regression-with-a-neural-network) might help here):
- linear layer that goes from `input_size` -> 256 nodes
- ReLU activation function
- linear layer that goes from 256 nodes -> 128 nodes
- ReLU activation function
- linear layer that goes from 128 nodes -> 64 nodes
- ReLU activation function
- output layer that goes from 64 nodes -> `output_size` nodes
I've given you some starter code to get you going.
>When we create our model in a later exercise we will specify `input_size=784` and `output_size=10`. The `784` is the flattened 28 x 28 image and the output size of 10 is so that we have one node for each item of clothing (remember we have 10 classes), and each node will contain the probability of that item of clothing being the one in a particular input image.
```python
class Classifier(nn.Module):
def __init__(self, input_size, output_size):
super().__init__()
self.main = None # Your code goes here
def forward(self, x):
out = self.main(x)
return out
```
### 4.2
rubric={accuracy:1}
If your model has `input_size = 784` and `output_size=10`, how many parameters does your model have? (Ideally you can work this out by hand but you can use `torchsummary` like I showed in Lecture 4 if you must...)
```python
# Your answer goes here.
```
### 4.3
rubric={accuracy:3}
We haven't trained yet, but let's test out your network. The below function will help you plot your network's predictions for a particular image using `matplotlib`, run it:
```python
def plot_prediction(image, label, predictions):
"""Plot network predictions with matplotlib."""
fig, (ax1, ax2) = plt.subplots(figsize=(8, 4), ncols=2) # Plot
ax1.imshow(image[0], cmap='gray')
ax1.axis('off')
ax1.set_title(class_labels[label])
ax2.barh(np.arange(10), predictions.data.numpy().squeeze())
ax2.set_title("Predictions")
ax2.set_yticks(np.arange(10))
ax2.set_yticklabels(class_labels)
ax2.set_xlim(0, 1)
plt.tight_layout();
```
```python
model = Classifier(input_size=784, output_size=10)
# Test on training images (run as many times as you like!)
image, label = next(iter(trainloader)) # Get a random batch of 64 images
predictions = model(image[0].view(1, -1)) # Get first image, flatten to shape (1, 784) and predict it
predictions = nn.Softmax(dim=1)(predictions) # Coerce predictions to probabilities using Softmax()
plot_prediction(image[0], label[0], predictions)
```
Okay, those predictions are probably pretty bad. We need to train! Below is a training function (the same one we saw in Lecture 4). The only difference is that when I'm creating `y_hat` (my model predictions), I'm reshaping my data to be of shape `(batch_size, 784)` using `X.view(X.shape[0], -1)` so we can feed it into our network (`X.shape[0]` is the batch size, and the -1 just says "flatten remaining dimensions into a single dimension", so this turns something of shape `(64, 28, 28)` to `(64, 784)` which in English reads as "64 examples of vectors with length 784", i.e. 64 flattened images).
```python
def trainer(model, criterion, optimizer, dataloader, epochs=5, verbose=True):
"""Simple training wrapper for PyTorch network."""
for epoch in range(epochs):
losses = 0
for X, y in dataloader:
optimizer.zero_grad() # Clear gradients w.r.t. parameters
y_hat = model(X.view(X.shape[0], -1)) # Reshape data to (batch_size, 784) and forward pass to get output
loss = criterion(y_hat, y) # Calculate loss
loss.backward() # Getting gradients w.r.t. parameters
optimizer.step() # Update parameters
losses += loss.item() # Add loss for this batch to running total
if verbose: print(f"epoch: {epoch + 1}, loss: {losses / len(dataloader):.4f}")
```
Define an appropriate `criterion` and `optimizer` to train your model with.
- We are doing multi-class classification here, what loss function do we use for this case (hint: see [this part of Lecture 4](https://pages.github.ubc.ca/MDS-2020-21/DSCI_572_sup-learn-2_students/lectures/lecture4_pytorch-neural-networks-pt1.html#multiclass-classification-optional))?
- Use any optimizer you like but I recommend Adam (by the way, optional Exercise 5 of this lab gets you to implement Adam from scratch 😉 )
I already created the dataloader `trainloader` for you at the start of this exercise. Pass all these things to `trainer()` to train your model (it may take a few minutes):
```python
# Your answer goes here.
# Uncomment and run the below once you've defined a criterion and optimizer
# trainer(model, criterion, optimizer, trainloader, epochs=5, verbose=True)
```
### 4.4
rubric={accuracy:1}
Test out your newly trained network on the training data:
```python
# Test model on training images (run as many times as you like!)
image, label = next(iter(trainloader)) # Get a random batch of 64 images
predictions = model(image[0].view(1, -1)) # Get first image, flatten to shape (1, 784) and predict it
predictions = nn.Softmax(dim=1)(predictions) # Coerce predictions to probabilities using Softmax()
plot_prediction(image[0], label[0], predictions)
```
And test it out on the test data:
```python
# Test model on testing images (run as many times as you like!)
image, label = next(iter(testloader)) # Get a random batch of 64 images
predictions = model(image[0].view(1, -1)) # Get first image, flatten to shape (1, 784) and predict it
predictions = nn.Softmax(dim=1)(predictions) # Coerce predictions to probabilities using Softmax()
plot_prediction(image[0], label[0], predictions)
```
Pretty sweet! That's all there is to it - you just created your first legitimate classifier! WELL DONE! I personally am super excited for you.
Oh right, I need to give you an exercise to answer. In this exercise we used a `BATCH_SIZE = 64`. This is a pretty common size to use, in fact the most common sizes are: 32, 64, 128, 256, and 512. In terms of optimizing a network, list one difference between using a small batch size vs large batch size?
Your answer goes here.
### 4.5
No marks and nothing to do for this question, just a bit of fun. Our network was trained on clothing images, but that doesn't mean we can't use it to predict other images (but this is probably a bad idea)! Let's see what our model thinks of a 28 x 28 image of me:
```python
image = torch.from_numpy(plt.imread("img/tomas_beuzen.png"))
predictions = model(image.view(1, -1)) # Flatten image to shape (1, 784) and predict it
predictions = nn.Softmax(dim=1)(predictions) # Coerce predictions to probabilities using Softmax()
label = predictions.argmax(dim=1) # Get class label from max probability
plot_prediction(image.numpy()[None, :, :], label, predictions)
```
## (Optional) Exercise 5: Implementing Adam Optimization From Scratch
<hr>
rubric={accuracy:1}
Adam is an optimization algorithm that we'll be using a lot for the rest of the course. [Here's the original paper](https://arxiv.org/abs/1412.6980) that proposed it. It is essentially a fancier version of SGD. Without getting too technical, Adam really adds two additional features to SGD:
1. Momentum: which uses past gradients to help improve convergence speed, reduce noise in the path to the minimum, and avoid local minima.
2. Per-parameter learning rate: a learning rate is maintained and adapted for each parameter as iterations of optimization proceed.
Pretty cool! I recommend [reading this article](https://ruder.io/optimizing-gradient-descent/index.html) or [watching this video](https://www.youtube.com/watch?v=JXQT_vxqwIs) to learn more, but Adam boils down to the following equations:
Weight updating:
$$\mathbf{w}_{t+1} = \mathbf{w}_{t} - \frac{\alpha}{\sqrt{\hat{v}_{t}} + \epsilon} \hat{m}_{t}$$
The various components required for that equation:
$$\begin{align}
\hat{m}_{t} &= \frac{m_{t}}{1 - \beta_{1}^{t}}\\
\hat{v}_{t} &= \frac{v_{t}}{1 - \beta_{2}^{t}}
\end{align}$$
$$\begin{align}
m_{t} &= \beta_{1} m_{t-1} + (1 - \beta_{1}) g_{t}\\
v_{t} &= \beta_{2} v_{t-1} + (1 - \beta_{2}) g_{t}^{2}
\end{align}$$
Where:
- $t$ is the iteration of optimization, it increments up by one each time you update $\mathbf{w}$. Note that in the equation for $\hat{m}_{t}$ and $\hat{v}_{t}$, $\beta_{1}$ and $\beta_{2}$ are raised to the power of $t$.
- $g_{t}$ is the gradient of the loss function w.r.t to the parameters $w$.
- $m_{t}$ is known as the first moment (the mean) of the gradients. Initialize as 0.
- $v_{t}$ is known as the second moment (the uncentered variance) of the gradients. Initialize as 0.
- $\alpha$ is the learning rate. 0.1 is a good start.
- $\epsilon$ is just a term to prevent division by zero. Default: $10^{-8}$.
- $\beta_{1}$ is a hyperparameter that controls the influence of past gradients on subsequent updates. Default: $0.9$.
- $\beta_{2}$ is a hyperparameter that controls the influence of past gradients on subsequent updates. Default: $0.999$.
Here's a squiggly function for you to try and find the minimum parameter for. I've hard-coded the "optimum parameter" as $w_{opt}=4$ but I want you to find this value using Adam optimization and starting at $w \neq w_{opt}$. I've provided you the function (`f()`), the MSE loss w.r.t this function (`loss()`), and the gradient of the loss (`loss_grad()`). Run the cell below:
```python
def f(w, X):
"""Squiggly function"""
return w * np.cos(w * X)
def loss(w, X, y):
"""MSE loss."""
return np.mean((f(w, X) - y) ** 2)
def loss_grad(w, X, y):
"""Gradient of MSE."""
t = np.cos(w * X) - w * X * np.sin(w * X)
return np.mean((f(w, X) - y) * t)
w_opt = 4
X = np.arange(-3, 3, 0.1)
y = f(w_opt, X)
l = [loss(w, X, y) for w in np.arange(-10, 11, 0.1)]
plt.plot(np.arange(-10, 11, 0.1), l)
plt.xlabel("w")
plt.ylabel("MSE")
plt.grid(True);
```
Your task here is to implement Adam from scratch. Then use it to find $w_{opt}$ for the above function. I've provided some code below that you should run when you're ready. Note:
- I've specified a default of 100 epochs. We have a *tiny* dataset here of 60 samples so this is nothing really. Feel free to add more epochs if you wish.
- You can start with the default values for the various Adam terms I give in the equations above.
- You *may* need to play around with the hyperparameter $\alpha$ to get to the minimum (I've given a default of 0.3 in the starter code below - I didn't need to change this value in my solution). You can leave $\beta_{1}$, $\beta_{2}$ as is - often we don't tune those ones and I didn't in my solution, but you can tune them if you want.
- Adam is generally used with batches like SGD so my solution has the ability to accept a `batch_size` argument, but you don't have to code up this functionality and I didn't include that argument in the starter code below. So feel free to just use all the data each iteration for simplicity like vanilla GD would do. But if you're feeling adventurous, thrown in a `batch_size` argument 😉
>The pedagogical goal here is to get you to implement Adam and play around with it to see how it can "jump over" local minima. If you get it working, it's pretty awesome!
```python
def Adam(X, y, w0, loss, loss_grad, n_epochs=100, alpha=0.3, beta1=0.9, beta2=0.999, eta=10e-8):
# Your code goes here.
w = None
return w
w0 = [9]
w = Adam(X, y, w0, loss, loss_grad)
print(w) # Should be close to 4
```
## (Optional) Exercise 6: Gif or Jiff
<hr>
rubric={accuracy:1}
Practically a free mark here for making it to the end. But I do have a question for you.
.gif files are animations made of a series of images. For example, this is me when someone tells me they have 80% accuracy with their ML model:
My question to you - are these files pronounced "Gif" or "Jiff"?
Your answer here:
## Submit to Canvas and GitHub
<hr>
When you are ready to submit your assignment do the following:
1. Run all cells in your notebook to make sure there are no errors by doing `Kernel -> Restart Kernel and Run All Cells...`
2. Save your notebook.
3. Convert your notebook to `.html` format using the `convert_notebook()` function below or by `File -> Export Notebook As... -> Export Notebook to HTML`
4. Run the code `submit()` below to go through an interactive submission process to Canvas.
5. Finally, push all your work to GitHub (including the rendered html file).
```python
# convert_notebook("lab2.ipynb", "html") # save your notebook, then uncomment and run when you want to convert to html
```
```python
# submit(course_code=59090) # uncomment and run when ready to submit to Canvas
```
|
function M = slpweval(X1, X2, f, varargin)
%SLPWEVAL Perform pairwise computation
%
% $ Syntax $
% - M = slpweval(X1, X2, f)
% - M = slpweval(X1, X2, f, ...)
%
% $ Arguments $
% - X1: the matrix of vectors serving as first argument of f
% - X2: the matrix of vectors serving as second argument of f
% - f: the function maps two vectors to a single scalar value
% - M: the matrix of pairwise evaluaton results
%
% $ Description $
% - M = slpweval(X1, X2, f) takes vector arguments from X1 and X2, and
% computes the pairwise evaluation result with f. The vectors in X1
% and X2 are stored in a column-wise manner. Suppose X1 and X2 have
% m and n columns respectively, then the resultant matrix M would be
% of size m x n, with the M(i, j) = f(X1(:,i), X2(:,j)).
%
% - M = slpweval(X1, X2, f, ...) conducts the computation with extra
% parameters to f, i.e. M(i, j) = f(X1(:,i), X2(:,j), ...).
%
% $ Remarks $
% - The vector length of the vectors in X1 and X2 are not necessarily
% equal. The requirment on their dimensions depends on the callback
% function f.
% - For efficiency, the function would invoke f to evaluate in batch.
% Thus f should support batch-evaluation. When the input arguments
% to f have n columns, f should return an 1 x n row vector.
%
% $ History $
% - Created by Dahua Lin on Apr 21, 2006
% - Modified by Dahua Lin on Sep 10, 2006
% - make some minor changes to suppress warnings
%
%% parse and verify input arguments
if nargin < 3
raise_lackinput('slpweval', 3);
end
[d1, n1] = size(X1);
[d2, n2] = size(X2);
slignorevars(d1, d2);
%% compute
% prepare output matrix
M = zeros(n1, n2);
if n1 > n2 % expand each column in X2 to n1 copies
inds_e = ones(1, n1);
for i = 1 : n2
x2 = X2(:, i);
X2e = x2(:, inds_e);
M(:, i) = feval(f, X1, X2e, varargin{:})';
end
else % expand each column in X1 to n2 copies
inds_e = ones(1, n2);
for i = 1 : n1
x1 = X1(:, i);
X1e = x1(:, inds_e);
M(i, :) = feval(f, X1e, X2, varargin{:});
end
end
|
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
def output(path):
df = pd.read_csv(path)
print(df.head())
print(df.iloc[1])
df.plot(x='et', y='emissn')
#lt.show()
s = df.max()
nx, ny = int(s['pixlin']), int(s['pixsam'])
x = np.linspace(1, nx,nx)
y = np.linspace(1, ny,ny)
phase_matrix = np.zeros((nx+1, ny+1))
for i in x:
for j in y:
sdf = df.loc[(df['pixlin'] == i) & (df['pixsam'] == j)]
phase = sdf.loc[:,'phase'].values[0]
phase_matrix[int(i),int(j)] = phase
plt.imshow(phase_matrix)
plt.axis('off')
plt.show()
if __name__ == '__main__':
output("../tests/spice4mertis.csv")
|
C Copyright(C) 2008 Sandia Corporation. Under the terms of Contract
C DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
C certain rights in this software
C
C Redistribution and use in source and binary forms, with or without
C modification, are permitted provided that the following conditions are
C met:
C
C * Redistributions of source code must retain the above copyright
C notice, this list of conditions and the following disclaimer.
C
C * Redistributions in binary form must reproduce the above
C copyright notice, this list of conditions and the following
C disclaimer in the documentation and/or other materials provided
C with the distribution.
C
C * Neither the name of Sandia Corporation nor the names of its
C contributors may be used to endorse or promote products derived
C from this software without specific prior written permission.
C
C THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
C "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
C LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
C A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
C OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
C SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
C LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
C DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
C THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
C (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
C OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
C
C=======================================================================
SUBROUTINE NUMSTR (NNUM, NSIG, RNUM, RSTR, LSTR)
C=======================================================================
C --*** NUMSTR *** (STRLIB) Convert real numbers to strings
C --
C --NUMSTR converts a set of real numbers into a consistent set of
C --strings. It will convert to engineering notation with all
C --exponents the same, if possible.
C --
C --Parameters:
C -- NNUM - IN - the number of real numbers in the set
C -- NSIG - IN - the maximum number of significant digits, max of 8
C -- RNUM - IN - the array of real numbers to be converted
C -- RSTR - OUT - the set of real number strings
C -- LSTR - OUT - the maximum length of the number strings
C --Routines Called:
C -- IENGRX - (included) Get engineering notation exponent
INTEGER NNUM
INTEGER NSIG
REAL RNUM(*)
CHARACTER*(*) RSTR(*)
INTEGER LSTR
CHARACTER*20 BLANKS
CHARACTER*10 SCRFMT
CHARACTER*20 SCRSTR
CHARACTER*20 TMPSTR
CHARACTER*15 FFMT
C --Convert all to E notation and find the minimum and maximum exponent
C -- MINE and MAXE are the minimum and maximum exponents
C -- ISIGN is the number of digits for the sign
C -- (0 if all positive, 1 if any number negative)
BLANKS = ' '
WRITE (SCRFMT, 10000, IOSTAT=IDUM) NSIG+7, NSIG
10000 FORMAT ('(0PE', I2.2, '.', I2.2, ')')
ISIGN = 0
MINE = 9999
MINE2 = 9999
MAXE = -9999
MAXES = MAXE
DO 100 I = 1, NNUM
IF (RNUM(I) .NE. 0.0) THEN
WRITE (SCRSTR(1:NSIG+7), SCRFMT, IOSTAT=IDUM) RNUM(I)
READ (SCRSTR(NSIG+5:NSIG+7), '(I3)', IOSTAT=IDUM) IE
IF (MINE .GT. IE) MINE2 = MINE
MINE = MIN (MINE, IE)
MAXE = MAX (MAXE, IE)
IF (RNUM(I) .LT. 0.0) THEN
ISIGN = 1
MAXES = MAX (MAXES, IE)
END IF
END IF
100 CONTINUE
C --Correct for one very small number (should be zero)
IF ((MINE2 .LT. 1000) .AND. ((MINE2 - MINE) .GE. 6)) MINE = MINE2
C --Handle all zero case
IF (MINE .GT. MAXE) THEN
MINE = 0
MAXE = 0
MAXES = 0
END IF
C --Determine the new exponent NEWEXP (use engineering notation)
NEWEXP = IENGRX (MAXE, MINE)
IF (ISIGN .EQ. 1) THEN
IF (MAX (1, MAXE - NEWEXP) .GT. MAX (1, MAXES - NEWEXP))
& ISIGN = 0
END IF
C --Check if the numbers can all be sensibly converted to a common exponent
IF (((MAXE - NEWEXP) .LE. 4)
& .AND. ((NEWEXP - MINE) .LE. 2)
& .AND. (-MINE .LT. (NSIG - MAXE))) THEN
C --Determine the new F format
C -- EXPDIV is the number to divide by to get the number
C -- without an exponent
C -- NWHOLE is the number of digits before the decimal
C -- NFRAC is the number of digits after the decimal
C -- NTOTAL is the total number of digits
C --The new exponent is tagged on the end of the F-format number
EXPDIV = 10.0 ** NEWEXP
NWHOLE = MAX (1, MAXE - NEWEXP)
NFRAC = MAX (0, MIN (NEWEXP - MINE + NSIG,
& NSIG - (MAXE - NEWEXP)))
NTOTAL = ISIGN + NWHOLE + 1 + NFRAC
IF (EXPDIV .NE. 0.0) THEN
WRITE (FFMT, 10010, IOSTAT=IDUM) NTOTAL, NFRAC
10010 FORMAT ('(F', I2.2, '.', I2.2, ')')
ELSE
WRITE (FFMT, 10020, IOSTAT=IDUM) NTOTAL
10020 FORMAT ('(A', I2.2, 3X, ')')
END IF
IF (NEWEXP .EQ. 0) THEN
LSTR = NTOTAL
ELSE IF ((NEWEXP .LE. -10) .OR. (NEWEXP .GE. 10)) THEN
WRITE (FFMT(8:15), 10030, IOSTAT=IDUM) NEWEXP
10030 FORMAT (',''E', SP, I3.2, ''')')
LSTR = NTOTAL + 4
ELSE
WRITE (FFMT(8:15), 10040, IOSTAT=IDUM) NEWEXP
10040 FORMAT (',''E', SP, I2.1, ''')')
LSTR = NTOTAL + 3
END IF
C --Convert all numbers to the new exponent by using the F format
IF (EXPDIV .NE. 0.0) THEN
DO 110 I = 1, NNUM
WRITE (RSTR(I), FFMT, IOSTAT=IDUM) RNUM(I)/EXPDIV
if (rstr(i)(:1) .eq. '*') then
C ... Roundoff occurred. Adjust format and try again...
IF (EXPDIV .NE. 0.0) THEN
WRITE (FFMT(:7), 10010, IOSTAT=IDUM) NTOTAL,
$ NFRAC-1
WRITE (RSTR(I), FFMT, IOSTAT=IDUM) RNUM(I)/EXPDIV
end if
end if
110 CONTINUE
ELSE
DO 120 I = 1, NNUM
WRITE (RSTR(I), FFMT, IOSTAT=IDUM) '********************'
120 CONTINUE
END IF
ELSE
C --Do not try to use a common exponent, but use engineering notation;
C --Algorithm as above
LSTR = 0
MINEXP = IENGRX (MINE, MINE)
MAXEXP = IENGRX (MAXE, MAXE)
DO 130 I = 1, NNUM
WRITE (SCRSTR(1:NSIG+7), SCRFMT, IOSTAT=IDUM) RNUM(I)
READ (SCRSTR(NSIG+5:NSIG+7), '(I3)', IOSTAT=IDUM) IE
ISIGN = 0
IF (RNUM(I) .LT. 0.0) ISIGN = 1
NEWEXP = IENGRX (IE, IE)
EXPDIV = 10.0 ** NEWEXP
NWHOLE = MAX (1, IE - NEWEXP)
NFRAC = MAX (0, MIN (NEWEXP - IE + NSIG,
& NSIG - (IE - NEWEXP)))
IF ((RNUM(I) .EQ. 0.0) .AND. (MINE .GE. 0))
& NFRAC = NFRAC - 1
NTOTAL = ISIGN + NWHOLE + 1 + NFRAC
IF (EXPDIV .NE. 0.0) THEN
WRITE (FFMT, 10010, IOSTAT=IDUM) NTOTAL, NFRAC
ELSE
WRITE (FFMT, 10020, IOSTAT=IDUM) NTOTAL
END IF
IF ((MINEXP .LE. -10) .OR. (MAXEXP .GE. 10)) THEN
WRITE (FFMT(8:15), 10030, IOSTAT=IDUM) NEWEXP
LSTR = MAX (LSTR, NTOTAL + 4)
ELSE
WRITE (FFMT(8:15), 10040, IOSTAT=IDUM) NEWEXP
LSTR = MAX (LSTR, NTOTAL + 3)
END IF
IF (EXPDIV .NE. 0.0) THEN
WRITE (RSTR(I), FFMT, IOSTAT=IDUM) RNUM(I)/EXPDIV
if (rstr(i)(:1) .eq. '*') then
C ... Roundoff occurred. Adjust format and try again...
IF (EXPDIV .NE. 0.0) THEN
WRITE (FFMT(:7), 10010, IOSTAT=IDUM) NTOTAL,
$ NFRAC-1
WRITE (RSTR(I), FFMT, IOSTAT=IDUM) RNUM(I)/EXPDIV
end if
end if
ELSE
WRITE (RSTR(I), FFMT, IOSTAT=IDUM) '********************'
END IF
130 CONTINUE
C --Adjust the strings so that they are right-justified at
C --a common length
DO 140 I = 1, NNUM
IB = INDEX (RSTR(I)(:LSTR), ' ')
IF (IB .GT. 0) THEN
NB = LSTR - IB + 1
TMPSTR = RSTR(I)(:IB-1)
RSTR(I) = BLANKS(:NB) // TMPSTR
END IF
140 CONTINUE
END IF
RETURN
END
|
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 5 14:35:38 2021
@author: ag
"""
import numpy as np
from glob import glob
import pandas as pd
import matplotlib.pyplot as plt
from tqdm import tqdm
import corner
import hadcrut5
import re
from settings import datafolder
comparisonfile = f'{datafolder}/raw_data/ComparisonEstimates/ComparisonSLRrates.xlsx'
sheets = ['GMSL', 'Steric', 'GIC', 'GrIS', 'AIS', 'WAIS', 'EAIS', 'PEN', 'All but GIC']
output = []
for sheet in sheets:
df = pd.read_excel(comparisonfile, sheet, comment="#")
if len(df)<2:
print(f'insufficient historical data to estimate TSLS for {sheet}')
continue
df['Tanom'] = df.apply(lambda row: hadcrut5.getTstats(row['Period start'],row['Period start'])['Tanom'], axis=1)
df['sigmaT'] = df.apply(lambda row: hadcrut5.getTstats(row['Period start'],row['Period start'])['sigmaT'], axis=1)
for min_year in (1000,):#,1990):
ix = df['Period start']>min_year
subset = df[ix]
x = subset['Tanom'].values
y = subset['Rate'].values/1000 #m/yr
sigmax = subset['sigmaT'].values
sigmay = subset['RateSigma'].values/1000 #m/yr
if (sheet=='GrIS') or (sheet=='AIS'):
ix = df['Period start']>1990
p = np.polyfit(x[ix],y[ix],1,w=1/sigmay[ix])
print(f'{sheet} observational TSLS post 1990: {p[0]*1000:.2f}')
#note this assumes independent errors...
Nmc = 1000
slopes = np.full((Nmc),np.nan)
T0s = np.full((Nmc),np.nan)
o_intercept = np.full((Nmc),np.nan)
for ii in range(Nmc):
p = np.polyfit(x+np.random.randn(x.size)*sigmax,
y+np.random.randn(y.size)*sigmay,1,w=1/sigmay)
slopes[ii] = p[0]
o_intercept[ii] = p[1]
T0s[ii] = -p[1] / p[0]
ptiles = np.percentile(slopes,[5,17,50,83,95])
output.append({
'component': sheet,
'period start': subset['Period start'].min(),
'period end': subset['Period end'].max(),
'TSLS': np.mean(slopes),
'T0': np.mean(T0s),
'Srate0': np.mean(o_intercept),
'sigmaTSLS': np.std(slopes),
'TSLS_P5': ptiles[0],
'TSLS_P17': ptiles[1],
'TSLS_P50': ptiles[2],
'TSLS_P83': ptiles[3],
'TSLS_P95': ptiles[4],
'sigmaT0': np.std(T0s),
'sigmaSrate0': np.std(o_intercept),
})
output = pd.DataFrame(output)
output.to_csv(f'{datafolder}/processed_data/TSLS_estimates/tsls_observations.csv')
# plt.errorbar(x,y,xerr=sigmax,yerr=sigmay)
# plt.title(sheet)
|
/-
Copyright (c) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl
Ported by: Anatole Dedecker
! This file was ported from Lean 3 source module order.chain
! leanprover-community/mathlib commit c227d107bbada5d0d9d20287e3282c0a7f1651a0
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Data.Set.Pairwise.Basic
import Mathlib.Data.Set.Lattice
import Mathlib.Data.SetLike.Basic
/-!
# Chains and flags
This file defines chains for an arbitrary relation and flags for an order and proves Hausdorff's
Maximality Principle.
## Main declarations
* `IsChain s`: A chain `s` is a set of comparable elements.
* `maxChain_spec`: Hausdorff's Maximality Principle.
* `Flag`: The type of flags, aka maximal chains, of an order.
## Notes
Originally ported from Isabelle/HOL. The
[original file](https://isabelle.in.tum.de/dist/library/HOL/HOL/Zorn.html) was written by Jacques D.
Fleuriot, Tobias Nipkow, Christian Sternagel.
-/
open Classical Set
variable {α β : Type _}
/-! ### Chains -/
section Chain
variable (r : α → α → Prop)
/-- In this file, we use `≺` as a local notation for any relation `r`. -/
local infixl:50 " ≺ " => r
/-- A chain is a set `s` satisfying `x ≺ y ∨ x = y ∨ y ≺ x` for all `x y ∈ s`. -/
def IsChain (s : Set α) : Prop :=
s.Pairwise fun x y => x ≺ y ∨ y ≺ x
#align is_chain IsChain
/-- `SuperChain s t` means that `t` is a chain that strictly includes `s`. -/
def SuperChain (s t : Set α) : Prop :=
IsChain r t ∧ s ⊂ t
#align super_chain SuperChain
/-- A chain `s` is a maximal chain if there does not exists a chain strictly including `s`. -/
def IsMaxChain (s : Set α) : Prop :=
IsChain r s ∧ ∀ ⦃t⦄, IsChain r t → s ⊆ t → s = t
#align is_max_chain IsMaxChain
variable {r} {c c₁ c₂ c₃ s t : Set α} {a b x y : α}
theorem isChain_empty : IsChain r ∅ :=
Set.pairwise_empty _
#align is_chain_empty isChain_empty
theorem Set.Subsingleton.isChain (hs : s.Subsingleton) : IsChain r s :=
hs.pairwise _
#align set.subsingleton.is_chain Set.Subsingleton.isChain
theorem IsChain.mono : s ⊆ t → IsChain r t → IsChain r s :=
Set.Pairwise.mono
#align is_chain.mono IsChain.mono
theorem IsChain.mono_rel {r' : α → α → Prop} (h : IsChain r s) (h_imp : ∀ x y, r x y → r' x y) :
IsChain r' s :=
h.mono' fun x y => Or.imp (h_imp x y) (h_imp y x)
#align is_chain.mono_rel IsChain.mono_rel
/-- This can be used to turn `IsChain (≥)` into `IsChain (≤)` and vice-versa. -/
theorem IsChain.symm (h : IsChain r s) : IsChain (flip r) s :=
h.mono' fun _ _ => Or.symm
#align is_chain.symm IsChain.symm
theorem isChain_of_trichotomous [IsTrichotomous α r] (s : Set α) : IsChain r s :=
fun a _ b _ hab => (trichotomous_of r a b).imp_right fun h => h.resolve_left hab
#align is_chain_of_trichotomous isChain_of_trichotomous
theorem IsChain.insert (hs : IsChain r s) (ha : ∀ b ∈ s, a ≠ b → a ≺ b ∨ b ≺ a) :
IsChain r (insert a s) :=
hs.insert_of_symmetric (fun _ _ => Or.symm) ha
#align is_chain.insert IsChain.insert
theorem isChain_univ_iff : IsChain r (univ : Set α) ↔ IsTrichotomous α r := by
refine' ⟨fun h => ⟨fun a b => _⟩, fun h => @isChain_of_trichotomous _ _ h univ⟩
rw [or_left_comm, or_iff_not_imp_left]
exact h trivial trivial
#align is_chain_univ_iff isChain_univ_iff
theorem IsChain.image (r : α → α → Prop) (s : β → β → Prop) (f : α → β)
(h : ∀ x y, r x y → s (f x) (f y)) {c : Set α} (hrc : IsChain r c) : IsChain s (f '' c) :=
fun _ ⟨_, ha₁, ha₂⟩ _ ⟨_, hb₁, hb₂⟩ =>
ha₂ ▸ hb₂ ▸ fun hxy => (hrc ha₁ hb₁ <| ne_of_apply_ne f hxy).imp (h _ _) (h _ _)
#align is_chain.image IsChain.image
section Total
variable [IsRefl α r]
theorem IsChain.total (h : IsChain r s) (hx : x ∈ s) (hy : y ∈ s) : x ≺ y ∨ y ≺ x :=
(eq_or_ne x y).elim (fun e => Or.inl <| e ▸ refl _) (h hx hy)
#align is_chain.total IsChain.total
theorem IsChain.directedOn (H : IsChain r s) : DirectedOn r s := fun x hx y hy =>
((H.total hx hy).elim fun h => ⟨y, hy, h, refl _⟩) fun h => ⟨x, hx, refl _, h⟩
#align is_chain.directed_on IsChain.directedOn
protected theorem IsChain.directed {f : β → α} {c : Set β} (h : IsChain (f ⁻¹'o r) c) :
Directed r fun x : { a : β // a ∈ c } => f x :=
fun ⟨a, ha⟩ ⟨b, hb⟩ =>
(by_cases fun hab : a = b => by
simp only [hab, exists_prop, and_self_iff, Subtype.exists]
exact ⟨b, hb, refl _⟩)
fun hab => ((h ha hb hab).elim fun h => ⟨⟨b, hb⟩, h, refl _⟩) fun h => ⟨⟨a, ha⟩, refl _, h⟩
#align is_chain.directed IsChain.directed
theorem IsChain.exists3 (hchain : IsChain r s) [IsTrans α r] {a b c} (mem1 : a ∈ s) (mem2 : b ∈ s)
(mem3 : c ∈ s) : ∃ (z : _) (_ : z ∈ s), r a z ∧ r b z ∧ r c z := by
rcases directedOn_iff_directed.mpr (IsChain.directed hchain) a mem1 b mem2 with ⟨z, mem4, H1, H2⟩
rcases directedOn_iff_directed.mpr (IsChain.directed hchain) z mem4 c mem3 with
⟨z', mem5, H3, H4⟩
exact ⟨z', mem5, _root_.trans H1 H3, _root_.trans H2 H3, H4⟩
#align is_chain.exists3 IsChain.exists3
end Total
theorem IsMaxChain.isChain (h : IsMaxChain r s) : IsChain r s :=
h.1
#align is_max_chain.is_chain IsMaxChain.isChain
theorem IsMaxChain.not_superChain (h : IsMaxChain r s) : ¬SuperChain r s t := fun ht =>
ht.2.ne <| h.2 ht.1 ht.2.1
#align is_max_chain.not_super_chain IsMaxChain.not_superChain
theorem IsMaxChain.bot_mem [LE α] [OrderBot α] (h : IsMaxChain (· ≤ ·) s) : ⊥ ∈ s :=
(h.2 (h.1.insert fun _ _ _ => Or.inl bot_le) <| subset_insert _ _).symm ▸ mem_insert _ _
#align is_max_chain.bot_mem IsMaxChain.bot_mem
theorem IsMaxChain.top_mem [LE α] [OrderTop α] (h : IsMaxChain (· ≤ ·) s) : ⊤ ∈ s :=
(h.2 (h.1.insert fun _ _ _ => Or.inr le_top) <| subset_insert _ _).symm ▸ mem_insert _ _
#align is_max_chain.top_mem IsMaxChain.top_mem
open Classical
/-- Given a set `s`, if there exists a chain `t` strictly including `s`, then `SuccChain s`
is one of these chains. Otherwise it is `s`. -/
def SuccChain (r : α → α → Prop) (s : Set α) : Set α :=
if h : ∃ t, IsChain r s ∧ SuperChain r s t then choose h else s
#align succ_chain SuccChain
theorem succChain_spec (h : ∃ t, IsChain r s ∧ SuperChain r s t) :
SuperChain r s (SuccChain r s) := by
have : IsChain r s ∧ SuperChain r s (choose h) :=
@choose_spec _ (fun t => IsChain r s ∧ SuperChain r s t) _
simpa [SuccChain, dif_pos, exists_and_left.mp h] using this.2
#align succ_chain_spec succChain_spec
theorem IsChain.succ (hs : IsChain r s) : IsChain r (SuccChain r s) :=
if h : ∃ t, IsChain r s ∧ SuperChain r s t then (succChain_spec h).1
else by
rw [exists_and_left] at h
simpa [SuccChain, dif_neg, h] using hs
#align is_chain.succ IsChain.succ
theorem IsChain.superChain_succChain (hs₁ : IsChain r s) (hs₂ : ¬IsMaxChain r s) :
SuperChain r s (SuccChain r s) := by
simp only [IsMaxChain, not_and, not_forall, exists_prop, exists_and_left] at hs₂
obtain ⟨t, ht, hst⟩ := hs₂ hs₁
exact succChain_spec ⟨t, hs₁, ht, ssubset_iff_subset_ne.2 hst⟩
#align is_chain.super_chain_succ_chain IsChain.superChain_succChain
theorem subset_succChain : s ⊆ SuccChain r s :=
if h : ∃ t, IsChain r s ∧ SuperChain r s t then (succChain_spec h).2.1
else by
rw [exists_and_left] at h
simp [SuccChain, dif_neg, h, Subset.rfl]
#align subset_succ_chain subset_succChain
/-- Predicate for whether a set is reachable from `∅` using `SuccChain` and `⋃₀`. -/
inductive ChainClosure (r : α → α → Prop) : Set α → Prop
| succ : ∀ {s}, ChainClosure r s → ChainClosure r (SuccChain r s)
| union : ∀ {s}, (∀ a ∈ s, ChainClosure r a) → ChainClosure r (⋃₀s)
#align chain_closure ChainClosure
/-- An explicit maximal chain. `maxChain` is taken to be the union of all sets in `ChainClosure`.
-/
def maxChain (r : α → α → Prop) : Set α :=
⋃₀ setOf (ChainClosure r)
#align max_chain maxChain
theorem chainClosure_empty : ChainClosure r ∅ := by
have : ChainClosure r (⋃₀∅) := ChainClosure.union fun a h => False.rec h
simpa using this
#align chain_closure_empty chainClosure_empty
theorem chainClosure_maxChain : ChainClosure r (maxChain r) :=
ChainClosure.union fun _ => id
#align chain_closure_max_chain chainClosure_maxChain
private theorem chainClosure_succ_total_aux (hc₁ : ChainClosure r c₁) (_ : ChainClosure r c₂)
(h : ∀ ⦃c₃⦄, ChainClosure r c₃ → c₃ ⊆ c₂ → c₂ = c₃ ∨ SuccChain r c₃ ⊆ c₂) :
SuccChain r c₂ ⊆ c₁ ∨ c₁ ⊆ c₂ := by
induction hc₁
case succ c₃ hc₃ ih =>
cases' ih with ih ih
· exact Or.inl (ih.trans subset_succChain)
· exact (h hc₃ ih).imp_left fun (h : c₂ = c₃) => h ▸ Subset.rfl
case union s _ ih =>
refine' or_iff_not_imp_left.2 fun hn => unionₛ_subset fun a ha => _
exact (ih a ha).resolve_left fun h => hn <| h.trans <| subset_unionₛ_of_mem ha
private theorem chainClosure_succ_total (hc₁ : ChainClosure r c₁) (hc₂ : ChainClosure r c₂)
(h : c₁ ⊆ c₂) : c₂ = c₁ ∨ SuccChain r c₁ ⊆ c₂ := by
induction hc₂ generalizing c₁ hc₁
case succ c₂ hc₂ ih =>
refine' ((chainClosure_succ_total_aux hc₁ hc₂) fun c₁ => ih).imp h.antisymm' fun h₁ => _
obtain rfl | h₂ := ih hc₁ h₁
· exact Subset.rfl
· exact h₂.trans subset_succChain
case union s hs ih =>
apply Or.imp_left h.antisymm'
apply by_contradiction
simp only [unionₛ_subset_iff, not_or, not_forall, exists_prop, and_imp, forall_exists_index]
intro c₃ hc₃ h₁ h₂
obtain h | h := chainClosure_succ_total_aux hc₁ (hs c₃ hc₃) fun c₄ => ih _ hc₃
· exact h₁ (subset_succChain.trans h)
obtain h' | h' := ih c₃ hc₃ hc₁ h
· exact h₁ h'.subset
· exact h₂ (h'.trans <| subset_unionₛ_of_mem hc₃)
theorem ChainClosure.total (hc₁ : ChainClosure r c₁) (hc₂ : ChainClosure r c₂) :
c₁ ⊆ c₂ ∨ c₂ ⊆ c₁ :=
((chainClosure_succ_total_aux hc₂ hc₁) fun _ hc₃ => chainClosure_succ_total hc₃ hc₁).imp_left
subset_succChain.trans
#align chain_closure.total ChainClosure.total
theorem ChainClosure.succ_fixpoint (hc₁ : ChainClosure r c₁) (hc₂ : ChainClosure r c₂)
(hc : SuccChain r c₂ = c₂) : c₁ ⊆ c₂ := by
induction hc₁
case succ s₁ hc₁ h => exact (chainClosure_succ_total hc₁ hc₂ h).elim (fun h => h ▸ hc.subset) id
case union s _ ih => exact unionₛ_subset ih
#align chain_closure.succ_fixpoint ChainClosure.succ_fixpoint
theorem ChainClosure.succ_fixpoint_iff (hc : ChainClosure r c) :
SuccChain r c = c ↔ c = maxChain r :=
⟨fun h => (subset_unionₛ_of_mem hc).antisymm <| chainClosure_maxChain.succ_fixpoint hc h,
fun h => subset_succChain.antisymm' <| (subset_unionₛ_of_mem hc.succ).trans h.symm.subset⟩
#align chain_closure.succ_fixpoint_iff ChainClosure.succ_fixpoint_iff
theorem ChainClosure.isChain (hc : ChainClosure r c) : IsChain r c := by
induction hc
case succ c _ h => exact h.succ
case union s hs h =>
exact fun c₁ ⟨t₁, ht₁, (hc₁ : c₁ ∈ t₁)⟩ c₂ ⟨t₂, ht₂, (hc₂ : c₂ ∈ t₂)⟩ hneq =>
((hs _ ht₁).total <| hs _ ht₂).elim (fun ht => h t₂ ht₂ (ht hc₁) hc₂ hneq) fun ht =>
h t₁ ht₁ hc₁ (ht hc₂) hneq
#align chain_closure.is_chain ChainClosure.isChain
/-- **Hausdorff's maximality principle**
There exists a maximal totally ordered set of `α`.
Note that we do not require `α` to be partially ordered by `r`. -/
theorem maxChain_spec : IsMaxChain r (maxChain r) :=
by_contradiction fun h =>
let ⟨_, H⟩ := chainClosure_maxChain.isChain.superChain_succChain h
H.ne (chainClosure_maxChain.succ_fixpoint_iff.mpr rfl).symm
#align max_chain_spec maxChain_spec
end Chain
/-! ### Flags -/
/-- The type of flags, aka maximal chains, of an order. -/
structure Flag (α : Type _) [LE α] where
/-- The `carrier` of a flag is the underlying set. -/
carrier : Set α
/-- By definition, a flag is a chain -/
Chain' : IsChain (· ≤ ·) carrier
/-- By definition, a flag is a maximal chain -/
max_chain' : ∀ ⦃s⦄, IsChain (· ≤ ·) s → carrier ⊆ s → carrier = s
#align flag Flag
namespace Flag
section LE
variable [LE α] {s t : Flag α} {a : α}
instance : SetLike (Flag α) α where
coe := carrier
coe_injective' s t h := by
cases s
cases t
congr
@[ext]
theorem ext : (s : Set α) = t → s = t :=
SetLike.ext'
#align flag.ext Flag.ext
-- Porting note: `simp` can now prove this
-- @[simp]
theorem mem_coe_iff : a ∈ (s : Set α) ↔ a ∈ s :=
Iff.rfl
#align flag.mem_coe_iff Flag.mem_coe_iff
@[simp]
theorem coe_mk (s : Set α) (h₁ h₂) : (mk s h₁ h₂ : Set α) = s :=
rfl
#align flag.coe_mk Flag.coe_mk
@[simp]
theorem mk_coe (s : Flag α) : mk (s : Set α) s.Chain' s.max_chain' = s :=
ext rfl
#align flag.mk_coe Flag.mk_coe
theorem chain_le (s : Flag α) : IsChain (· ≤ ·) (s : Set α) :=
s.Chain'
#align flag.chain_le Flag.chain_le
protected theorem maxChain (s : Flag α) : IsMaxChain (· ≤ ·) (s : Set α) :=
⟨s.chain_le, s.max_chain'⟩
#align flag.max_chain Flag.maxChain
theorem top_mem [OrderTop α] (s : Flag α) : (⊤ : α) ∈ s :=
s.maxChain.top_mem
#align flag.top_mem Flag.top_mem
theorem bot_mem [OrderBot α] (s : Flag α) : (⊥ : α) ∈ s :=
s.maxChain.bot_mem
#align flag.bot_mem Flag.bot_mem
end LE
section Preorder
variable [Preorder α] {a b : α}
protected theorem le_or_le (s : Flag α) (ha : a ∈ s) (hb : b ∈ s) : a ≤ b ∨ b ≤ a :=
s.chain_le.total ha hb
#align flag.le_or_le Flag.le_or_le
instance [OrderTop α] (s : Flag α) : OrderTop s :=
Subtype.orderTop s.top_mem
instance [OrderBot α] (s : Flag α) : OrderBot s :=
Subtype.orderBot s.bot_mem
instance [BoundedOrder α] (s : Flag α) : BoundedOrder s :=
Subtype.boundedOrder s.bot_mem s.top_mem
end Preorder
section PartialOrder
variable [PartialOrder α]
theorem chain_lt (s : Flag α) : IsChain (· < ·) (s : Set α) := fun _ ha _ hb h =>
(s.le_or_le ha hb).imp h.lt_of_le h.lt_of_le'
#align flag.chain_lt Flag.chain_lt
instance [@DecidableRel α (· ≤ ·)] [@DecidableRel α (· < ·)] (s : Flag α) :
LinearOrder s :=
{ Subtype.partialOrder _ with
le_total := fun a b => s.le_or_le a.2 b.2
decidable_le := Subtype.decidableLE
decidable_lt := Subtype.decidableLT }
end PartialOrder
instance [LinearOrder α] : Unique (Flag α) where
default := ⟨univ, isChain_of_trichotomous _, fun s _ => s.subset_univ.antisymm'⟩
uniq s := SetLike.coe_injective <| s.3 (isChain_of_trichotomous _) <| subset_univ _
end Flag
|
[STATEMENT]
lemma loc_srj_5: "\<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk>
\<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
assume A1: "nat_to_sch (sch_to_nat sch1) = sch1"
[PROOF STATE]
proof (state)
this:
nat_to_sch (sch_to_nat sch1) = sch1
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
assume A2: "nat_to_sch (sch_to_nat sch2) = sch2"
[PROOF STATE]
proof (state)
this:
nat_to_sch (sch_to_nat sch2) = sch2
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
let ?x = "c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
have S1: "?x > 1"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. 1 < c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))
[PROOF STEP]
by (simp add: c_pair_def sf_def)
[PROOF STATE]
proof (state)
this:
1 < c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
from S1
[PROOF STATE]
proof (chain)
picking this:
1 < c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))
[PROOF STEP]
have S2: "nat_to_sch ?x = (let u=mod7 (c_fst ?x); v=c_snd ?x; v1=c_fst v; v2 = c_snd v; sch1=nat_to_sch v1; sch2=nat_to_sch v2 in loc_f u sch1 sch2)" (is "_ = ?R")
[PROOF STATE]
proof (prove)
using this:
1 < c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))
goal (1 subgoal):
1. nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = (let u = mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))); v = c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))); v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1))
[PROOF STEP]
by (rule loc_srj_lm_2)
[PROOF STATE]
proof (state)
this:
nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = (let u = mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))); v = c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))); v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1))
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
have S3: "c_fst ?x = 6"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = 6
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = 6
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
have S4: "c_snd ?x = c_pair (sch_to_nat sch1) (sch_to_nat sch2)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = c_pair (sch_to_nat sch1) (sch_to_nat sch2)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = c_pair (sch_to_nat sch1) (sch_to_nat sch2)
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
from S3
[PROOF STATE]
proof (chain)
picking this:
c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = 6
[PROOF STEP]
have S5: "mod7 (c_fst ?x) = 6"
[PROOF STATE]
proof (prove)
using this:
c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = 6
goal (1 subgoal):
1. mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))) = 6
[PROOF STEP]
by (simp add: mod7_def)
[PROOF STATE]
proof (state)
this:
mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))) = 6
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
from A1 A2 S4 S5
[PROOF STATE]
proof (chain)
picking this:
nat_to_sch (sch_to_nat sch1) = sch1
nat_to_sch (sch_to_nat sch2) = sch2
c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = c_pair (sch_to_nat sch1) (sch_to_nat sch2)
mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))) = 6
[PROOF STEP]
have "?R = Rec_op sch1 sch2"
[PROOF STATE]
proof (prove)
using this:
nat_to_sch (sch_to_nat sch1) = sch1
nat_to_sch (sch_to_nat sch2) = sch2
c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = c_pair (sch_to_nat sch1) (sch_to_nat sch2)
mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))) = 6
goal (1 subgoal):
1. (let u = mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))); v = c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))); v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1)) = Rec_op sch1 sch2
[PROOF STEP]
by (simp add: Let_def c_fst_at_0 c_snd_at_0 loc_f_def)
[PROOF STATE]
proof (state)
this:
(let u = mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))); v = c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))); v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1)) = Rec_op sch1 sch2
goal (1 subgoal):
1. \<lbrakk>nat_to_sch (sch_to_nat sch1) = sch1; nat_to_sch (sch_to_nat sch2) = sch2\<rbrakk> \<Longrightarrow> nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
with S2
[PROOF STATE]
proof (chain)
picking this:
nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = (let u = mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))); v = c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))); v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1))
(let u = mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))); v = c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))); v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1)) = Rec_op sch1 sch2
[PROOF STEP]
show ?thesis
[PROOF STATE]
proof (prove)
using this:
nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = (let u = mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))); v = c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))); v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1))
(let u = mod7 (c_fst (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2)))); v = c_snd (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))); v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1)) = Rec_op sch1 sch2
goal (1 subgoal):
1. nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
nat_to_sch (c_pair 6 (c_pair (sch_to_nat sch1) (sch_to_nat sch2))) = Rec_op sch1 sch2
goal:
No subgoals!
[PROOF STEP]
qed
|
||| Spec: https://webassembly.github.io/spec/core/valid/types.html#global-types
module WebAssembly.Validation.Types.GlobalTypes
import WebAssembly.Structure
-------------------------------------------------------------------------------
-- Validation Rules
-------------------------------------------------------------------------------
public export
data ValidGlobalType : GlobalType -> Type where
MkGlobalValidType : (globalType: GlobalType) -> ValidGlobalType globalType
-------------------------------------------------------------------------------
-- Decidablity of Validation
-------------------------------------------------------------------------------
total public export
isGlobalTypeValid : (globalType : GlobalType) -> Dec (ValidGlobalType globalType)
isGlobalTypeValid globalType = Yes (MkGlobalValidType globalType)
|
[STATEMENT]
lemma swapEnv_psubstEnv:
assumes "goodEnv rho" and "goodEnv rho'"
shows "((rho &[rho']) &[z1 \<and> z2]_zs) = ((rho &[z1 \<and> z2]_zs) &[rho' &[z1 \<and> z2]_zs])"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. rho &[rho'] &[z1 \<and> z2]_zs = rho &[z1 \<and> z2]_zs &[rho' &[z1 \<and> z2]_zs]
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
goodEnv rho
goodEnv rho'
goal (1 subgoal):
1. rho &[rho'] &[z1 \<and> z2]_zs = rho &[z1 \<and> z2]_zs &[rho' &[z1 \<and> z2]_zs]
[PROOF STEP]
apply(intro ext)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>x xa. \<lbrakk>goodEnv rho; goodEnv rho'\<rbrakk> \<Longrightarrow> (rho &[rho'] &[z1 \<and> z2]_zs) x xa = rho &[z1 \<and> z2]_zs &[rho' &[z1 \<and> z2]_zs] x xa
[PROOF STEP]
subgoal for xs x
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>goodEnv rho; goodEnv rho'\<rbrakk> \<Longrightarrow> (rho &[rho'] &[z1 \<and> z2]_zs) xs x = rho &[z1 \<and> z2]_zs &[rho' &[z1 \<and> z2]_zs] xs x
[PROOF STEP]
by (cases "rho xs (x @xs[z1 \<and> z2]_zs)")
(auto simp: lift_def swapEnv_defs swap_psubst)
[PROOF STATE]
proof (prove)
goal:
No subgoals!
[PROOF STEP]
.
|
Check (forall A:Set, A -> A).
Definition id (A:Set) (a:A) : A := a.
Check (forall A B:Set, (A -> A -> B) -> A -> B).
Definition diag (A B:Set) (f:A -> A -> B) (a:A) : B := f a a.
Check (forall A B C:Set, (A -> B -> C) -> B -> A -> C).
Definition permute (A B C:Set) (f:A -> B -> C) (b:B) (a:A) : C := f a b.
Require Import ZArith.
Check (forall A:Set, (nat -> A) -> Z -> A).
Definition f_nat_Z (A:Set) (f:nat -> A) (z:Z) : A := f (Zabs_nat z).
|
(* Title: HOL/Auth/n_g2kAbsAfter_lemma_inv__19_on_rules.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_g2kAbsAfter Protocol Case Study*}
theory n_g2kAbsAfter_lemma_inv__19_on_rules imports n_g2kAbsAfter_lemma_on_inv__19
begin
section{*All lemmas on causal relation between inv__19*}
lemma lemma_inv__19_on_rules:
assumes b1: "r \<in> rules N" and b2: "(f=inv__19 )"
shows "invHoldForRule s f r (invariants N)"
proof -
have c1: "(\<exists> d. d\<le>N\<and>r=n_n_Store_i1 d)\<or>
(\<exists> d. d\<le>N\<and>r=n_n_AStore_i1 d)\<or>
(r=n_n_SendReqS_j1 )\<or>
(r=n_n_SendReqEI_i1 )\<or>
(r=n_n_SendReqES_i1 )\<or>
(r=n_n_RecvReq_i1 )\<or>
(r=n_n_SendInvE_i1 )\<or>
(r=n_n_SendInvS_i1 )\<or>
(r=n_n_SendInvAck_i1 )\<or>
(r=n_n_RecvInvAck_i1 )\<or>
(r=n_n_SendGntS_i1 )\<or>
(r=n_n_SendGntE_i1 )\<or>
(r=n_n_RecvGntS_i1 )\<or>
(r=n_n_RecvGntE_i1 )\<or>
(r=n_n_ASendReqIS_j1 )\<or>
(r=n_n_ASendReqSE_j1 )\<or>
(r=n_n_ASendReqEI_i1 )\<or>
(r=n_n_ASendReqES_i1 )\<or>
(r=n_n_SendReqEE_i1 )\<or>
(r=n_n_ARecvReq_i1 )\<or>
(r=n_n_ASendInvE_i1 )\<or>
(r=n_n_ASendInvS_i1 )\<or>
(r=n_n_ASendInvAck_i1 )\<or>
(r=n_n_ARecvInvAck_i1 )\<or>
(r=n_n_ASendGntS_i1 )\<or>
(r=n_n_ASendGntE_i1 )\<or>
(r=n_n_ARecvGntS_i1 )\<or>
(r=n_n_ARecvGntE_i1 )"
apply (cut_tac b1, auto) done
moreover {
assume d1: "(\<exists> d. d\<le>N\<and>r=n_n_Store_i1 d)"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_Store_i1Vsinv__19) done
}
moreover {
assume d1: "(\<exists> d. d\<le>N\<and>r=n_n_AStore_i1 d)"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_AStore_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_SendReqS_j1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendReqS_j1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_SendReqEI_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendReqEI_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_SendReqES_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendReqES_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_RecvReq_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_RecvReq_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_SendInvE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendInvE_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_SendInvS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendInvS_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_SendInvAck_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendInvAck_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_RecvInvAck_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_RecvInvAck_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_SendGntS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendGntS_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_SendGntE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendGntE_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_RecvGntS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_RecvGntS_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_RecvGntE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_RecvGntE_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ASendReqIS_j1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendReqIS_j1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ASendReqSE_j1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendReqSE_j1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ASendReqEI_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendReqEI_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ASendReqES_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendReqES_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_SendReqEE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_SendReqEE_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ARecvReq_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ARecvReq_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ASendInvE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendInvE_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ASendInvS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendInvS_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ASendInvAck_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendInvAck_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ARecvInvAck_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ARecvInvAck_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ASendGntS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendGntS_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ASendGntE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ASendGntE_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ARecvGntS_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ARecvGntS_i1Vsinv__19) done
}
moreover {
assume d1: "(r=n_n_ARecvGntE_i1 )"
have "invHoldForRule s f r (invariants N)"
apply (cut_tac b2 d1, metis n_n_ARecvGntE_i1Vsinv__19) done
}
ultimately show "invHoldForRule s f r (invariants N)"
by satx
qed
end
|
!< Henrick alpha (non linear weights) object.
module wenoof_alpha_int_m
!< Henrick alpha (non linear weights) object.
!<
!< @note The provided alpha implements the alpha coefficients defined in *Mapped weighted essentially non-oscillatory schemes:
!< Achieving optimal order near critical points*, Andrew K. Henrick, Tariq D. Aslam, Joseph M. Powers, JCP,
!< 2005, vol. 207, pp. 542-567, doi:10.1016/j.jcp.2005.01.023
use penf, only : I_P, R_P, str
use wenoof_alpha_object, only : alpha_object, alpha_object_constructor
use wenoof_alpha_rec_js, only : alpha_rec_js, alpha_rec_js_constructor
use wenoof_alpha_rec_z, only : alpha_rec_z, alpha_rec_z_constructor
use wenoof_base_object, only : base_object, base_object_constructor
implicit none
private
public :: alpha_int_m
public :: alpha_int_m_constructor
type, extends(alpha_object_constructor) :: alpha_int_m_constructor
!< Henrick alpha (non linear weights) object constructor.
character(len=:), allocatable :: base_type !< Base alpha coefficient type.
contains
! public deferred methods
procedure, pass(lhs) :: constr_assign_constr !< `=` operator.
endtype alpha_int_m_constructor
type, extends(alpha_object) :: alpha_int_m
!< Henrick alpha (non linear weights) object.
!<
!< @note The provided alpha implements the alpha coefficients defined in *Mapped weighted essentially non-oscillatory schemes:
!< Achieving optimal order near critical points*, Andrew K. Henrick, Tariq D. Aslam, Joseph M. Powers,
!< JCP, 2005, vol. 207, pp. 542-567, doi:10.1016/j.jcp.2005.01.023.
class(alpha_object), allocatable :: alpha_base !< Base alpha to be re-mapped.
contains
! public deferred methods
procedure, pass(self) :: create !< Create alpha.
procedure, pass(self) :: compute_int !< Compute alpha (interpolate).
procedure, pass(self) :: compute_rec !< Compute alpha (reconstruct).
procedure, pass(self) :: description !< Return object string-description.
procedure, pass(self) :: destroy !< Destroy alpha.
procedure, pass(lhs) :: object_assign_object !< `=` operator.
endtype alpha_int_m
contains
! constructor
! deferred public methods
subroutine constr_assign_constr(lhs, rhs)
!< `=` operator.
class(alpha_int_m_constructor), intent(inout) :: lhs !< Left hand side.
class(base_object_constructor), intent(in) :: rhs !< Right hand side.
call lhs%assign_(rhs=rhs)
select type(rhs)
type is(alpha_int_m_constructor)
if (allocated(rhs%base_type)) lhs%base_type = rhs%base_type
endselect
endsubroutine constr_assign_constr
! deferred public methods
subroutine create(self, constructor)
!< Create alpha.
class(alpha_int_m), intent(inout) :: self !< Alpha.
class(base_object_constructor), intent(in) :: constructor !< Alpha constructor.
call self%destroy
call self%create_(constructor=constructor)
select type(constructor)
type is(alpha_int_m_constructor)
if (allocated(constructor%base_type)) then
select case(constructor%base_type)
case('JS')
if (allocated(self%alpha_base)) deallocate(self%alpha_base)
allocate(alpha_rec_js :: self%alpha_base)
call self%alpha_base%create(constructor=constructor)
case('Z')
if (allocated(self%alpha_base)) deallocate(self%alpha_base)
allocate(alpha_rec_z :: self%alpha_base)
call self%alpha_base%create(constructor=constructor)
endselect
endif
class default
! TODO add error handling
endselect
endsubroutine create
pure subroutine compute_int(self, beta, kappa, values)
!< Compute alpha (interpolate).
class(alpha_int_m), intent(in) :: self !< Alpha.
real(R_P), intent(in) :: beta(0:) !< Beta [0:S-1].
real(R_P), intent(in) :: kappa(0:) !< Kappa [0:S-1].
real(R_P), intent(out) :: values(0:) !< Alpha values [0:S-1].
real(R_P) :: alpha_base(0:self%S-1) !< Alpha base coefficients.
real(R_P) :: alpha_base_sum !< Sum of alpha base coefficients.
real(R_P) :: kappa_base !< Kappa base coefficient.
integer(I_P) :: s1 !< Counter.
call self%alpha_base%compute(beta=beta, kappa=kappa, values=alpha_base)
alpha_base_sum = sum(alpha_base)
do s1=0, self%S - 1 ! stencil loops
kappa_base = alpha_base(s1) / alpha_base_sum
values(s1) = &
(kappa_base * (kappa(s1) + kappa(s1) * kappa(s1) - 3._R_P * kappa(s1) * kappa_base + kappa_base * kappa_base)) / &
(kappa(s1) * kappa(s1) + kappa_base * (1._R_P - 2._R_P * kappa(s1)))
enddo
endsubroutine compute_int
pure subroutine compute_rec(self, beta, kappa, values)
!< Compute alpha (reconstruct).
class(alpha_int_m), intent(in) :: self !< Alpha coefficient.
real(R_P), intent(in) :: beta(1:,0:) !< Beta [1:2,0:S-1].
real(R_P), intent(in) :: kappa(1:,0:) !< Kappa [1:2,0:S-1].
real(R_P), intent(out) :: values(1:,0:) !< Alpha values [1:2,0:S-1].
! empty procedure
endsubroutine compute_rec
pure function description(self, prefix) result(string)
!< Return object string-descripition.
class(alpha_int_m), intent(in) :: self !< Alpha coefficient.
character(len=*), intent(in), optional :: prefix !< Prefixing string.
character(len=:), allocatable :: string !< String-description.
character(len=:), allocatable :: prefix_ !< Prefixing string, local variable.
character(len=1), parameter :: NL=new_line('a') !< New line char.
prefix_ = '' ; if (present(prefix)) prefix_ = prefix
string = prefix_//'Jiang-Shu alpha coefficients object for interpolation:'//NL
string = string//prefix_//' - S = '//trim(str(self%S))//NL
string = string//prefix_//' - eps = '//trim(str(self%eps))//NL
associate(alpha_base=>self%alpha_base)
select type(alpha_base)
type is(alpha_rec_js)
string = string//prefix_//' - base-mapped-alpha type = Jiang-Shu'
type is(alpha_rec_z)
string = string//prefix_//' - base-mapped-alpha type = Bogeg'
endselect
endassociate
endfunction description
elemental subroutine destroy(self)
!< Destroy alpha.
class(alpha_int_m), intent(inout) :: self !< Alpha.
call self%destroy_
if (allocated(self%alpha_base)) deallocate(self%alpha_base)
endsubroutine destroy
pure subroutine object_assign_object(lhs, rhs)
!< `=` operator.
class(alpha_int_m), intent(inout) :: lhs !< Left hand side.
class(base_object), intent(in) :: rhs !< Right hand side.
call lhs%assign_(rhs=rhs)
select type(rhs)
type is(alpha_int_m)
if (allocated(rhs%alpha_base)) then
if (.not.allocated(lhs%alpha_base)) allocate(lhs%alpha_base, mold=rhs%alpha_base)
lhs%alpha_base = rhs%alpha_base
else
if (allocated(lhs%alpha_base)) deallocate(lhs%alpha_base)
endif
endselect
endsubroutine object_assign_object
endmodule wenoof_alpha_int_m
|
bilinear.interp<-function(x,f){
#interpolate a 2d point for fn f
indx<-trunc(x[1]*(res-1)+1)
indy<-trunc(x[2]*(res-1)+1)
seq.Out<-seq(0,1,length.out=res)
fr1<- (seq.Out[indx+1]-x[1])/(seq.Out[indx+1]-seq.Out[indx]) * f[indx,indy] + (x[1]-seq.Out[indx])/(seq.Out[indx+1]-seq.Out[indx]) * f[indx+1,indy]
fr2<- (seq.Out[indx+1]-x[1])/(seq.Out[indx+1]-seq.Out[indx]) * f[indx,indy+1] + (x[1]-seq.Out[indx])/(seq.Out[indx+1]-seq.Out[indx]) * f[indx+1,indy+1]
fp<- (seq.Out[indy+1]-x[2])/(seq.Out[indy+1]-seq.Out[indy]) * fr1 + (x[2]-seq.Out[indy])/(seq.Out[indy+1]-seq.Out[indy]) * fr2
return(fp)
}
bilinear.interp(c(.4,.5),matrix(rnorm(res^2),res,res))
univ.interp<-function(x,f){
seq.Out<-seq(0,1,length.out=res)
indx<-trunc(x*(res-1)+1)
(seq.Out[indx+1]-x)/(seq.Out[indx+1]-seq.Out[indx]) * f[indx] + (x-seq.Out[indx])/(seq.Out[indx+1]-seq.Out[indx]) * f[indx+1]
}
univ.interp(.4,1:res)
tree.mix.lik<-function(x,edge_den,beliefs,edgelist,tree.list,weights,part_fn){
e<- dim(edgelist)[1]
d<-dim(beliefs)[1]
uni.prod<-mapply(function(u){
log(univ.interp(x[u],beliefs[u,]))
},1:d)
if(e==0){
return(sum(uni.prod))
}
if(any(is.na(uni.prod))) print("help!")
biv.prod<-mapply(
function(l){
s<- edgelist[l,1]
t<- edgelist[l,2]
log(bilinear.interp(c(x[s],x[t]) , edge_den[,,l])) - (uni.prod[s]) - (uni.prod[t])
},
1:e
)
tree.prod<- lapply(tree.list,
function(t){
tree<- graph.adjacency(t,mode="undirected")
el1<-apply(get.edgelist(tree), 1, paste, collapse="-")
el2<-apply(get.edgelist(tree), 1, function(x)paste(rev(x),collapse="-"))
el<-apply(edgelist, 1, paste, collapse="-")
ekeep<- (el %in% el1) | (el %in% el2)
sum( biv.prod[ekeep] )
})
tree.prod<- unlist(tree.prod)
tmax<- max(tree.prod)
#tmax<-0
#tree.weight<- exp(tree.prod-tmax)*weights
#out<- sum( uni.prod ) + tmax + log( sum( tree.weight ) )
out<- sum( uni.prod ) + weights * tree.prod
return(out)
}
# risk_path_tree<-lapply(path,function(x){
# outvec<-lapply(1:dim(test)[1],
# function(i){
# tree.mix.lik(test[i,],
# x$edge_den,
# x$beliefs,
# x$edgelist,
# x$tree_obj$tree.list,
# x$tree_obj$weight.list)
# })
# outvec<- unlist(outvec)
# return(- mean(outvec))
# })
# #risk_path_tree
#
# #
# # lik<-tree.mix.lik(test[1,],
# # fit$edge_den,
# # fit$beliefs,
# # edgelist,
# # tree_obj$tree.list,
# # tree_obj$weight.list
# # )
|
This versatile one of a kind trademarked 58"/45" Imperial Old Fashioned Dotted Swiss consists of 65% polyester 35% combed cotton fabric. This lightweight fabric offers a soft touch with a nice drape and wrinkle resistant. Suitable for shirting/blouses, children's/baby clothes, smocking, and much more! Available in 4 colors. Machine Washable.
|
using jInv.Mesh
using jInv.Utils
using Test
# setup 3D mesh
nc = [5, 7, 8]
x0 = rand(3)
domain = [x0[1], 4, x0[2], 2, x0[3], 6]
h = (domain[2:2:end]-domain[1:2:end])./nc
h1 = h[1]*ones(nc[1])
h2 = h[2]*ones(nc[2])
h3 = h[3]*ones(nc[3])
Mt = getTensorMesh3D(h1,h2,h3,x0)
Mt2 = getTensorMesh3D(h1,h2,h3,x0)
Mr = getRegularMesh(domain,nc)
Mr2 = getRegularMesh(domain,nc)
# test if Mt and Mt2 are equal
@test Mt == Mt2
@test Mr == Mr2
Meshes = (Mt,Mt2,Mr,Mr2)
function buildOps!(M)
D = getDivergenceMatrix(M)
G = getNodalGradientMatrix(M)
C = getCurlMatrix(M)
Af = getFaceAverageMatrix(M)
Ae = getEdgeAverageMatrix(M)
An = getNodalAverageMatrix(M)
V = getVolume(M)
F = getFaceArea(M)
L = getLength(M)
Vi = getVolumeInv(M)
Fi = getFaceAreaInv(M)
Li = getLengthInv(M)
Lap = getNodalLaplacianMatrix(M)
end
# first all fields should be empty
for k=length(Meshes)
@test isempty(Meshes[k].Div )
@test isempty(Meshes[k].Grad)
@test isempty(Meshes[k].Curl)
@test isempty(Meshes[k].Af )
@test isempty(Meshes[k].Ae )
@test isempty(Meshes[k].An )
@test isempty(Meshes[k].V )
@test isempty(Meshes[k].F )
@test isempty(Meshes[k].L )
@test isempty(Meshes[k].Vi )
@test isempty(Meshes[k].Fi )
@test isempty(Meshes[k].Li )
@test isempty(Meshes[k].nLap)
end
# build all matrices
buildOps!(Mt)
buildOps!(Mt2)
buildOps!(Mr)
buildOps!(Mr2)
@test Mt == Mt2
@test Mr == Mr2
# now all fields should be non-empty
for k=length(Meshes)
@test !isempty(Meshes[k].Div )
@test !isempty(Meshes[k].Grad)
@test !isempty(Meshes[k].Curl)
@test !isempty(Meshes[k].Af )
@test !isempty(Meshes[k].Ae )
@test !isempty(Meshes[k].An )
@test !isempty(Meshes[k].V )
@test !isempty(Meshes[k].F )
@test !isempty(Meshes[k].L )
@test !isempty(Meshes[k].Vi )
@test !isempty(Meshes[k].Fi )
@test !isempty(Meshes[k].Li )
@test !isempty(Meshes[k].nLap)
end
clear!(Mt)
clear!(Mt2)
clear!(Mr)
clear!(Mr2)
@test Mt == Mt2
@test Mr == Mr2
# now all matrices should be gone
for k=length(Meshes)
@test isempty(Meshes[k].Div )
@test isempty(Meshes[k].Grad)
@test isempty(Meshes[k].Curl)
@test isempty(Meshes[k].Af )
@test isempty(Meshes[k].Ae )
@test isempty(Meshes[k].An )
@test isempty(Meshes[k].V )
@test isempty(Meshes[k].F )
@test isempty(Meshes[k].L )
@test isempty(Meshes[k].Vi )
@test isempty(Meshes[k].Fi )
@test isempty(Meshes[k].Li )
@test isempty(Meshes[k].nLap)
end
|
import cv2
from matplotlib import pyplot as plt
import os
import numpy as np
def imread(*vars, **kwargs):
return cv2.imread(*vars, **kwargs)[...,::-1].astype(np.uint8)
img_dir = "img"
xbar_path = os.path.join(img_dir, "mapchips/Hakoniwa_X_axis.png")
mapchip_names = [f"land{i}" for i in range(17)] + [f"monster{i}" for i in range(9)] + ["monument0", "f02"]
mapchip_paths = {f: os.path.join(img_dir, f"mapchips/{f}.png") for f in mapchip_names}
mapchip_int = {k:i for i, k in enumerate(mapchip_names)}
mapchip_jp = {k:"海荒草村町都森農工ミ防山底痕瀬鉱油緑赤黒王硬三九メ霊礎巨"[i]
for i, k in enumerate(mapchip_names)}
mapchip_sim_int = {k:[0,2,4,5,6,7,9,11,14,18,19,20,23,3,1,21,24,33,36,37,41,35,34,39,32,38,25,32][i] for i,k in enumerate(mapchip_names)}
mapchip_size = 60
mapchip_half = mapchip_size // 2
map_w = mapchip_size*12 + mapchip_half
map_h = mapchip_size*12
mapchip_dict = {i: cv2.resize(imread(mapchip_paths[i]),(mapchip_size,mapchip_size)) for i in mapchip_paths}
def crop_area(map_path, xbar_path):
# read and resize input img
map_img = imread(map_path)
h, w, *_ = map_img.shape
ratio = map_w / w
map_img = cv2.resize(map_img, dsize=None, fx = ratio, fy = ratio)
# find x axis
xbar_img = imread(xbar_path)
result = cv2.matchTemplate(map_img, xbar_img, cv2.TM_CCOEFF_NORMED)
*_, maxLoc = cv2.minMaxLoc(result)
# crop area
top = maxLoc[1] + xbar_img.shape[0]
left = 0
bottom = top + map_h
right = map_w
return map_img[top:bottom, left:right]
def convert_coord_to_img_coord(x,y):
left = mapchip_size * x
if y % 2 == 0: # has offset when evens
left += mapchip_half
top = mapchip_size * y
return top, left
def crop_coord(img, x,y, *vars, **kwargs):
t,l = convert_coord_to_img_coord(x,y, *vars, **kwargs)
return img[t:t+mapchip_size,l:l+mapchip_size]
def img_diff(img1, img2):
return ((img1 - img2)**2).mean()**0.5
def decide_mapchip(map_img):
result = []
for x in range(12):
result_x = []
for y in range(12):
img = crop_coord(map_img, x,y)
diffs = [(k, img_diff(img, v)) for k,v in mapchip_dict.items()] # compare with each mapchip
closesest = sorted(diffs, key = lambda x:x[1])[0]
result_x.append(closesest[0])
result.append(result_x)
return result
def gen_map_from_arr(arr):
newmap = np.zeros((map_h + mapchip_half, map_w, 3)).astype(int)
fpath = os.path.join(img_dir, f"mapchips/xbar.png")
newmap[0:mapchip_half] = cv2.resize(imread(fpath), dsize=(map_w,mapchip_half))
for i in range(12):
t,l = i*mapchip_size+mapchip_half,0
if i % 2 == 1:
l = 720
fpath = os.path.join(img_dir, f"mapchips/space{i}.png")
newmap[t:t+mapchip_size,l:l+mapchip_half] = cv2.resize(imread(fpath), (mapchip_half,h))
for x in range(12):
for y in range(12):
t,l = convert_coord_to_img_coord(x,y)
t += mapchip_half
newmap[t:t+mapchip_size,l:l+mapchip_size] = mapchip_dict[arr[x][y]]
return newmap
def convert_to_sim(arr):
arr_t = list(zip(*arr))
result = []
arr_t += [["land0"]*16]*4
for row in arr_t:
row = list(row)
row += ["land0"]*4
for x in row:
result.append(mapchip_sim_int[x])
return ",".join(map(str,result))
|
data _≡_ {A : Set}(x : A) : A → Set where
refl : x ≡ x
data * : Set where ! : *
postulate
prop : ∀ x → x ≡ !
record StrictTotalOrder : Set where
field compare : *
open StrictTotalOrder
module M (Key : StrictTotalOrder) where
postulate
intersection′-₁ : ∀ x → x ≡ compare Key
-- Doesn't termination check, but shouldn't get __IMPOSSIBLE__
-- when termination checking!
to-∈-intersection′ : * → * → Set
to-∈-intersection′ x h with intersection′-₁ x
to-∈-intersection′ ._ h | refl with prop h
to-∈-intersection′ ._ ._ | refl | refl = to-∈-intersection′ ! !
|
Galveston / <unk> / is a coastal city located on Galveston Island and Pelican Island in the U.S. state of Texas . The community of 208 @.@ 3 square miles ( 539 km2 ) , with its population of 47 @,@ 762 people ( 2012 Census estimate ) , is the county seat and second @-@ largest municipality of Galveston County . It is located within Houston – The Woodlands – Sugar Land metropolitan area .
|
#define ELPP_DISABLE_DEFAULT_CRASH_HANDLING 1
#define ELPP_DEFAULT_LOG_FILE "logs/swgchat.log"
#include "easylogging++.h"
#include "StationChatApp.hpp"
#include <boost/program_options.hpp>
#include <chrono>
#include <fstream>
#include <iostream>
#include <thread>
#ifdef __GNUC__
#include <execinfo.h>
#endif
INITIALIZE_EASYLOGGINGPP
StationChatConfig BuildConfiguration(int argc, const char* argv[]);
#ifdef __GNUC__
void SignalHandler(int sig);
#endif
int main(int argc, const char* argv[]) {
#ifdef __GNUC__
signal(SIGSEGV, SignalHandler);
#endif
auto config = BuildConfiguration(argc, argv);
el::Loggers::setDefaultConfigurations(config.loggerConfig, true);
START_EASYLOGGINGPP(argc, argv);
StationChatApp app{config};
while (app.IsRunning()) {
app.Tick();
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
return 0;
}
StationChatConfig BuildConfiguration(int argc, const char* argv[]) {
namespace po = boost::program_options;
StationChatConfig config;
std::string configFile;
// Declare a group of options that will be
// allowed only on command line
po::options_description generic("Generic options");
generic.add_options()
("help,h", "produces help message")
("config,c", po::value<std::string>(&configFile)->default_value("swgchat.cfg"),
"sets path to the configuration file")
("logger_config", po::value<std::string>(&config.loggerConfig)->default_value("logger.cfg"),
"sets path to the logger configuration file")
;
po::options_description options("Configuration");
options.add_options()
("gateway_address", po::value<std::string>(&config.gatewayAddress)->default_value("127.0.0.1"),
"address for gateway connections")
("gateway_port", po::value<uint16_t>(&config.gatewayPort)->default_value(5001),
"port for gateway connections")
("registrar_address", po::value<std::string>(&config.registrarAddress)->default_value("127.0.0.1"),
"address for registrar connections")
("registrar_port", po::value<uint16_t>(&config.registrarPort)->default_value(5000),
"port for registrar connections")
("bind_to_ip", po::value<bool>(&config.bindToIp)->default_value(false),
"when set to true, binds to the config address; otherwise, binds on any interface")
("database_path", po::value<std::string>(&config.chatDatabasePath)->default_value("chat.db"),
"path to the sqlite3 database file")
;
po::options_description cmdline_options;
cmdline_options.add(generic).add(options);
po::options_description config_file_options;
config_file_options.add(options);
po::variables_map vm;
po::store(po::command_line_parser(argc, argv).options(cmdline_options).allow_unregistered().run(), vm);
po::notify(vm);
std::ifstream ifs(configFile.c_str());
if (!ifs) {
throw std::runtime_error("Cannot open configuration file: " + configFile);
}
po::store(po::parse_config_file(ifs, config_file_options), vm);
po::notify(vm);
if (vm.count("help")) {
std::cout << cmdline_options << "\n";
exit(EXIT_SUCCESS);
}
return config;
}
#ifdef __GNUC__
void SignalHandler(int sig) {
const int BACKTRACE_LIMIT = 10;
void *arr[BACKTRACE_LIMIT];
auto size = backtrace(arr, BACKTRACE_LIMIT);
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(arr, size, STDERR_FILENO);
exit(1);
}
#endif
|
lemma continuous_on_sgn[continuous_intros]: fixes f :: "'a::topological_space \<Rightarrow> 'b::real_normed_vector" assumes "continuous_on s f" and "\<forall>x\<in>s. f x \<noteq> 0" shows "continuous_on s (\<lambda>x. sgn (f x))"
|
import numpy as np
class MeanIonization:
""" Compute the mean ionization state (<Z> or Zbar) for a given system.
Parameters
----------
Am : float or arrary_like
Atomic mass of element (or isotope) in units of grams [g].
mass_density : float or array_like
Range of mass densities in units of grams per
cubic centimeter [g/cc].
T : float or array_like
Temperature range in units of elevtron-volts [eV]
Z : int or arrray_like
Atomic number for each element
"""
def __init__(self, Am, mass_density, T, Z):
# Check type of input and deal with float cases
self.Am = Am
if str(type(self.Am)) != "<class 'numpy.ndarray'>":
self.Am = np.array([Am])
self.Z = Z
if str(type(self.Z)) != "<class 'numpy.ndarray'>":
self.Z = np.array([Z])
try:
self.num_density = np.tile(mass_density, len(Am))/np.repeat(Am, len(mass_density))
self.num_density = np.reshape(self.num_density, (len(Am) ,len(mass_density)))
except:
self.num_density = np.array([mass_density])/Am
self.T = T
if str(type(self.T)) != "<class 'numpy.ndarray'>":
self.T = np.array([T])
def tf_zbar(self):
""" Thomas Fermi Zbar model.
References
----------
Finite Temperature Thomas Fermi Charge State using
R.M. More, "Pressure Ionization, Resonances, and the
Continuity of Bound and Free States", Adv. in Atomic
Mol. Phys., Vol. 21, p. 332 (Table IV).
"""
# Single mass density, single element
if len(self.num_density.shape) == 1 and len(self.Z) == 1:
alpha = 14.3139
beta = 0.6624
a1 = 0.003323
a2 = 0.9718
a3 = 9.26148e-5
a4 = 3.10165
b0 = -1.7630
b1 = 1.43175
b2 = 0.31546
c1 = -0.366667
c2 = 0.983333
convert = self.num_density * 1.6726219e-24
R = convert/self.Z
T0 = self.T/self.Z**(4./3.)
Tf = T0/(1 + T0)
A = a1*T0**a2 + a3*T0**a4
B = -np.exp(b0 + b1*Tf + b2*Tf**7)
C = c1*Tf + c2
Q1 = A*R**B
Q = (R**C + Q1**C)**(1/C)
x = alpha*Q**beta
Zbar = self.Z * x/(1 + x + np.sqrt(1 + 2*x))
# Single mass density, multiple elements
elif len(self.num_density.shape) == 1 and len(self.Z) != 1:
Zbar = np.zeros([1, len(self.T), len(self.Z)])
for k in range(len(self.Z)):
alpha = 14.3139
beta = 0.6624
a1 = 0.003323
a2 = 0.9718
a3 = 9.26148e-5
a4 = 3.10165
b0 = -1.7630
b1 = 1.43175
b2 = 0.31546
c1 = -0.366667
c2 = 0.983333
convert = self.num_density[k] * 1.6726219e-24
R = convert/self.Z[k]
T0 = self.T/self.Z[k]**(4./3.)
Tf = T0/(1 + T0)
A = a1*T0**a2 + a3*T0**a4
B = -np.exp(b0 + b1*Tf + b2*Tf**7)
C = c1*Tf + c2
Q1 = A*R**B
Q = (R**C + Q1**C)**(1/C)
x = alpha*Q**beta
Zbar[0,:,k] = self.Z[k] * x/(1 + x + np.sqrt(1 + 2*x))
# Multiple mass densities, multiple elements
else:
Zbar = np.zeros([self.num_density.shape[1], len(self.T), len(self.Z)])
for k in range(len(self.Z)):
for i in range(self.num_density.shape[1]):
alpha = 14.3139
beta = 0.6624
a1 = 0.003323
a2 = 0.9718
a3 = 9.26148e-5
a4 = 3.10165
b0 = -1.7630
b1 = 1.43175
b2 = 0.31546
c1 = -0.366667
c2 = 0.983333
convert = self.num_density[k,i] * 1.6726219e-24
R = convert/self.Z[k]
T0 = self.T/self.Z[k]**(4./3.)
Tf = T0/(1 + T0)
A = a1*T0**a2 + a3*T0**a4
B = -np.exp(b0 + b1*Tf + b2*Tf**7)
C = c1*Tf + c2
Q1 = A*R**B
Q = (R**C + Q1**C)**(1/C)
x = alpha*Q**beta
Zbar[i,:,k] = self.Z[k] * x/(1 + x + np.sqrt(1 + 2*x))
return Zbar
|
[STATEMENT]
lemma res_i3: "residuated f \<Longrightarrow> f (residual f (f (residual f x))) = f (residual f x)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. residuated f \<Longrightarrow> f (residual f (f (residual f x))) = f (residual f x)
[PROOF STEP]
by (metis local.antisym_conv res_c1 res_c3 res_i1 residual_galois)
|
physics.mass.calculate <- function(gravity, radius) {
return(gravity * radius^2 / gravity.constant)
}
|
Formal statement is: theorem has_derivative_inverse_on: fixes f :: "'n::euclidean_space \<Rightarrow> 'n" assumes "open S" and derf: "\<And>x. x \<in> S \<Longrightarrow> (f has_derivative f'(x)) (at x)" and "\<And>x. x \<in> S \<Longrightarrow> g (f x) = x" and "f' x \<circ> g' x = id" and "x \<in> S" shows "(g has_derivative g'(x)) (at (f x))" Informal statement is: If $f$ is a differentiable function on an open set $S$ and $g$ is its inverse, then $g$ is differentiable at $f(x)$ for all $x \in S$.
|
# Autogenerated wrapper script for CUDA_jll for powerpc64le-linux-gnu
export compute_sanitizer, libcublas, libcublasLt, libcudadevrt, libcudart, libcufft, libcufftw, libcupti, libcurand, libcusolver, libcusolverMg, libcusparse, libdevice, libnppc, libnppial, libnppicc, libnppidei, libnppif, libnppig, libnppim, libnppist, libnppisu, libnppitc, libnpps, libnvblas, libnvtoolsext, libnvvm, nvdisasm
JLLWrappers.@generate_wrapper_header("CUDA")
JLLWrappers.@declare_executable_product(compute_sanitizer)
JLLWrappers.@declare_library_product(libcublas, "libcublas.so.11")
JLLWrappers.@declare_library_product(libcublasLt, "libcublasLt.so.11")
JLLWrappers.@declare_file_product(libcudadevrt)
JLLWrappers.@declare_library_product(libcudart, "libcudart.so.11.0")
JLLWrappers.@declare_library_product(libcufft, "libcufft.so.10")
JLLWrappers.@declare_library_product(libcufftw, "libcufftw.so.10")
JLLWrappers.@declare_library_product(libcupti, "libcupti.so.11.5")
JLLWrappers.@declare_library_product(libcurand, "libcurand.so.10")
JLLWrappers.@declare_library_product(libcusolver, "libcusolver.so.11")
JLLWrappers.@declare_library_product(libcusolverMg, "libcusolverMg.so.11")
JLLWrappers.@declare_library_product(libcusparse, "libcusparse.so.11")
JLLWrappers.@declare_file_product(libdevice)
JLLWrappers.@declare_library_product(libnppc, "libnppc.so.11")
JLLWrappers.@declare_library_product(libnppial, "libnppial.so.11")
JLLWrappers.@declare_library_product(libnppicc, "libnppicc.so.11")
JLLWrappers.@declare_library_product(libnppidei, "libnppidei.so.11")
JLLWrappers.@declare_library_product(libnppif, "libnppif.so.11")
JLLWrappers.@declare_library_product(libnppig, "libnppig.so.11")
JLLWrappers.@declare_library_product(libnppim, "libnppim.so.11")
JLLWrappers.@declare_library_product(libnppist, "libnppist.so.11")
JLLWrappers.@declare_library_product(libnppisu, "libnppisu.so.11")
JLLWrappers.@declare_library_product(libnppitc, "libnppitc.so.11")
JLLWrappers.@declare_library_product(libnpps, "libnpps.so.11")
JLLWrappers.@declare_library_product(libnvblas, "libnvblas.so.11")
JLLWrappers.@declare_library_product(libnvtoolsext, "libnvToolsExt.so.1")
JLLWrappers.@declare_library_product(libnvvm, "libnvvm.so.4")
JLLWrappers.@declare_executable_product(nvdisasm)
function __init__()
JLLWrappers.@generate_init_header()
JLLWrappers.@init_executable_product(
compute_sanitizer,
"bin/compute-sanitizer",
)
JLLWrappers.@init_library_product(
libcublas,
"lib/libcublas.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libcublasLt,
"lib/libcublasLt.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_file_product(
libcudadevrt,
"lib/libcudadevrt.a",
)
JLLWrappers.@init_library_product(
libcudart,
"lib/libcudart.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libcufft,
"lib/libcufft.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libcufftw,
"lib/libcufftw.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libcupti,
"lib/libcupti.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libcurand,
"lib/libcurand.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libcusolver,
"lib/libcusolver.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libcusolverMg,
"lib/libcusolverMg.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libcusparse,
"lib/libcusparse.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_file_product(
libdevice,
"share/libdevice/libdevice.10.bc",
)
JLLWrappers.@init_library_product(
libnppc,
"lib/libnppc.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnppial,
"lib/libnppial.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnppicc,
"lib/libnppicc.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnppidei,
"lib/libnppidei.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnppif,
"lib/libnppif.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnppig,
"lib/libnppig.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnppim,
"lib/libnppim.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnppist,
"lib/libnppist.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnppisu,
"lib/libnppisu.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnppitc,
"lib/libnppitc.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnpps,
"lib/libnpps.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnvblas,
"lib/libnvblas.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnvtoolsext,
"lib/libnvToolsExt.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_library_product(
libnvvm,
"lib/libnvvm.so",
RTLD_LAZY | RTLD_DEEPBIND,
)
JLLWrappers.@init_executable_product(
nvdisasm,
"bin/nvdisasm",
)
JLLWrappers.@generate_init_footer()
end # __init__()
|
\docType{data}
\name{elmaslar}
\alias{elmaslar}
\title{50 bin adetten fazla yuvarlak kesim elmasın fiyatları}
\format{53.940 gözlem ve 10 değişkenden oluşan bir data.frame
\describe{
\item{karat}{Elmasın ağırlığı (0,2-5,01 ct)}
\item{kesim}{Kesim kalitesi (Vasat, İyi, Çok iyi, Birinci sınıf, İdeal)}
\item{renk}{Elmas rengi, D'den (en iyi) J'ye (en kötü)}
\item{berraklık}{Elmasın berraklık ölçüsü (I1 (en kötü), SI1, SI2, VS1, VS2, VVS1, VVS2, IF (en iyi))}
\item{derinlik}{Toplam derinlik yüzdesi = z / mean(x, y) = 2 * z / (x + y) (43-79)}
\item{yüzey}{Elmasın düz üst yüzeyinin genişliği (43-95 mm)}
\item{fiyat}{Amerikan doları cinsinden fiyat (326$-18.823$)}
\item{x}{Uzunluk (mm)}
\item{y}{Genişlik (mm)}
\item{z}{Derinlik (mm)}
}}
\usage{elmaslar}
\description{Neredeyse 54 bin elmasın fiyatlarını ve diğer özelliklerini içeren bir veri kümesi.}
\seealso{\code{\link[ggplot2]{diamonds}}}
\keyword{datasets}
|
(* Author: Tobias Nipkow *)
subsection "Hoare Logic for Total Correctness"
theory Hoare_Total
imports Hoare_Examples
begin
subsubsection "Hoare Logic for Total Correctness --- Separate Termination Relation"
text{* Note that this definition of total validity @{text"\<Turnstile>\<^sub>t"} only
works if execution is deterministic (which it is in our case). *}
definition hoare_tvalid :: "assn \<Rightarrow> com \<Rightarrow> assn \<Rightarrow> bool"
("\<Turnstile>\<^sub>t {(1_)}/ (_)/ {(1_)}" 50) where
"\<Turnstile>\<^sub>t {P}c{Q} \<longleftrightarrow> (\<forall>s. P s \<longrightarrow> (\<exists>t. (c,s) \<Rightarrow> t \<and> Q t))"
text{* Provability of Hoare triples in the proof system for total
correctness is written @{text"\<turnstile>\<^sub>t {P}c{Q}"} and defined
inductively. The rules for @{text"\<turnstile>\<^sub>t"} differ from those for
@{text"\<turnstile>"} only in the one place where nontermination can arise: the
@{term While}-rule. *}
inductive
hoaret :: "assn \<Rightarrow> com \<Rightarrow> assn \<Rightarrow> bool" ("\<turnstile>\<^sub>t ({(1_)}/ (_)/ {(1_)})" 50)
where
Skip: "\<turnstile>\<^sub>t {P} SKIP {P}" |
Assign: "\<turnstile>\<^sub>t {\<lambda>s. P(s(x:=aval a s))} x::=a {P}" |
Seq: "\<lbrakk> \<turnstile>\<^sub>t {P\<^sub>1} c\<^sub>1 {P\<^sub>2}; \<turnstile>\<^sub>t {P\<^sub>2} c\<^sub>2 {P\<^sub>3} \<rbrakk> \<Longrightarrow> \<turnstile>\<^sub>t {P\<^sub>1} c\<^sub>1;;c\<^sub>2 {P\<^sub>3}" |
If: "\<lbrakk> \<turnstile>\<^sub>t {\<lambda>s. P s \<and> bval b s} c\<^sub>1 {Q}; \<turnstile>\<^sub>t {\<lambda>s. P s \<and> \<not> bval b s} c\<^sub>2 {Q} \<rbrakk>
\<Longrightarrow> \<turnstile>\<^sub>t {P} IF b THEN c\<^sub>1 ELSE c\<^sub>2 {Q}" |
While:
"(\<And>n::nat.
\<turnstile>\<^sub>t {\<lambda>s. P s \<and> bval b s \<and> T s n} c {\<lambda>s. P s \<and> (\<exists>n'<n. T s n')})
\<Longrightarrow> \<turnstile>\<^sub>t {\<lambda>s. P s \<and> (\<exists>n. T s n)} WHILE b DO c {\<lambda>s. P s \<and> \<not>bval b s}" |
conseq: "\<lbrakk> \<forall>s. P' s \<longrightarrow> P s; \<turnstile>\<^sub>t {P}c{Q}; \<forall>s. Q s \<longrightarrow> Q' s \<rbrakk> \<Longrightarrow>
\<turnstile>\<^sub>t {P'}c{Q'}"
text{* The @{term While}-rule is like the one for partial correctness but it
requires additionally that with every execution of the loop body some measure
relation @{term[source]"T :: state \<Rightarrow> nat \<Rightarrow> bool"} decreases.
The following functional version is more intuitive: *}
lemma While_fun:
"\<lbrakk> \<And>n::nat. \<turnstile>\<^sub>t {\<lambda>s. P s \<and> bval b s \<and> n = f s} c {\<lambda>s. P s \<and> f s < n}\<rbrakk>
\<Longrightarrow> \<turnstile>\<^sub>t {P} WHILE b DO c {\<lambda>s. P s \<and> \<not>bval b s}"
by (rule While [where T="\<lambda>s n. n = f s", simplified])
text{* Building in the consequence rule: *}
lemma Assign': "\<forall>s. P s \<longrightarrow> Q(s(x:=aval a s)) \<Longrightarrow> \<turnstile>\<^sub>t {P} x ::= a {Q}"
by (simp add: strengthen_pre[OF _ Assign])
lemma While_fun':
assumes "\<And>n::nat. \<turnstile>\<^sub>t {\<lambda>s. P s \<and> bval b s \<and> n = f s} c {\<lambda>s. P s \<and> f s < n}"
and "\<forall>s. P s \<and> \<not> bval b s \<longrightarrow> Q s"
shows "\<turnstile>\<^sub>t {P} WHILE b DO c {Q}"
by(blast intro: assms(1) weaken_post[OF While_fun assms(2)])
text{* Our standard example: *}
lemma "\<turnstile>\<^sub>t {\<lambda>s. s ''x'' = i} ''y'' ::= N 0;; wsum {\<lambda>s. s ''y'' = sum i}"
apply(rule Seq)
prefer 2
apply(rule While_fun' [where P = "\<lambda>s. (s ''y'' = sum i - sum(s ''x''))"
and f = "\<lambda>s. nat(s ''x'')"])
apply(rule Seq)
prefer 2
apply(rule Assign)
apply(rule Assign')
apply simp
apply(simp)
apply(rule Assign')
apply simp
done
text{* The soundness theorem: *}
theorem hoaret_sound: "\<turnstile>\<^sub>t {P}c{Q} \<Longrightarrow> \<Turnstile>\<^sub>t {P}c{Q}"
proof(unfold hoare_tvalid_def, induction rule: hoaret.induct)
case (While P b T c)
{
fix s n
have "\<lbrakk> P s; T s n \<rbrakk> \<Longrightarrow> \<exists>t. (WHILE b DO c, s) \<Rightarrow> t \<and> P t \<and> \<not> bval b t"
proof(induction "n" arbitrary: s rule: less_induct)
case (less n)
thus ?case by (metis While.IH WhileFalse WhileTrue)
qed
}
thus ?case by auto
next
case If thus ?case by auto blast
qed fastforce+
text{*
The completeness proof proceeds along the same lines as the one for partial
correctness. First we have to strengthen our notion of weakest precondition
to take termination into account: *}
definition wpt :: "com \<Rightarrow> assn \<Rightarrow> assn" ("wp\<^sub>t") where
"wp\<^sub>t c Q = (\<lambda>s. \<exists>t. (c,s) \<Rightarrow> t \<and> Q t)"
lemma [simp]: "wp\<^sub>t (x ::= e) Q = (\<lambda>s. Q(s(x := aval e s)))"
by(auto intro!: ext simp: wpt_def)
lemma [simp]: "wp\<^sub>t (c\<^sub>1;;c\<^sub>2) Q = wp\<^sub>t c\<^sub>1 (wp\<^sub>t c\<^sub>2 Q)"
unfolding wpt_def
apply(rule ext)
apply auto
done
lemma [simp]:
"wp\<^sub>t (IF b THEN c\<^sub>1 ELSE c\<^sub>2) Q = (\<lambda>s. wp\<^sub>t (if bval b s then c\<^sub>1 else c\<^sub>2) Q s)"
apply(unfold wpt_def)
apply(rule ext)
apply auto
done
text{* Now we define the number of iterations @{term "WHILE b DO c"} needs to
terminate when started in state @{text s}. Because this is a truly partial
function, we define it as an (inductive) relation first: *}
inductive Its :: "bexp \<Rightarrow> com \<Rightarrow> state \<Rightarrow> nat \<Rightarrow> bool" where
Its_0: "\<not> bval b s \<Longrightarrow> Its b c s 0" |
Its_Suc: "\<lbrakk> bval b s; (c,s) \<Rightarrow> s'; Its b c s' n \<rbrakk> \<Longrightarrow> Its b c s (Suc n)"
text{* The relation is in fact a function: *}
lemma Its_fun: "Its b c s n \<Longrightarrow> Its b c s n' \<Longrightarrow> n=n'"
proof(induction arbitrary: n' rule:Its.induct)
case Its_0 thus ?case by(metis Its.cases)
next
case Its_Suc thus ?case by(metis Its.cases big_step_determ)
qed
text{* For all terminating loops, @{const Its} yields a result: *}
lemma WHILE_Its: "(WHILE b DO c,s) \<Rightarrow> t \<Longrightarrow> \<exists>n. Its b c s n"
proof(induction "WHILE b DO c" s t rule: big_step_induct)
case WhileFalse thus ?case by (metis Its_0)
next
case WhileTrue thus ?case by (metis Its_Suc)
qed
lemma wpt_is_pre: "\<turnstile>\<^sub>t {wp\<^sub>t c Q} c {Q}"
proof (induction c arbitrary: Q)
case SKIP show ?case by (auto intro:hoaret.Skip)
next
case Assign show ?case by (auto intro:hoaret.Assign)
next
case Seq thus ?case by (auto intro:hoaret.Seq)
next
case If thus ?case by (auto intro:hoaret.If hoaret.conseq)
next
case (While b c)
let ?w = "WHILE b DO c"
let ?T = "Its b c"
have "\<forall>s. wp\<^sub>t ?w Q s \<longrightarrow> wp\<^sub>t ?w Q s \<and> (\<exists>n. Its b c s n)"
unfolding wpt_def by (metis WHILE_Its)
moreover
{ fix n
let ?R = "\<lambda>s'. wp\<^sub>t ?w Q s' \<and> (\<exists>n'<n. ?T s' n')"
{ fix s t assume "bval b s" and "?T s n" and "(?w, s) \<Rightarrow> t" and "Q t"
from `bval b s` and `(?w, s) \<Rightarrow> t` obtain s' where
"(c,s) \<Rightarrow> s'" "(?w,s') \<Rightarrow> t" by auto
from `(?w, s') \<Rightarrow> t` obtain n' where "?T s' n'"
by (blast dest: WHILE_Its)
with `bval b s` and `(c, s) \<Rightarrow> s'` have "?T s (Suc n')" by (rule Its_Suc)
with `?T s n` have "n = Suc n'" by (rule Its_fun)
with `(c,s) \<Rightarrow> s'` and `(?w,s') \<Rightarrow> t` and `Q t` and `?T s' n'`
have "wp\<^sub>t c ?R s" by (auto simp: wpt_def)
}
hence "\<forall>s. wp\<^sub>t ?w Q s \<and> bval b s \<and> ?T s n \<longrightarrow> wp\<^sub>t c ?R s"
unfolding wpt_def by auto
(* by (metis WhileE Its_Suc Its_fun WHILE_Its lessI) *)
note strengthen_pre[OF this While.IH]
} note hoaret.While[OF this]
moreover have "\<forall>s. wp\<^sub>t ?w Q s \<and> \<not> bval b s \<longrightarrow> Q s"
by (auto simp add:wpt_def)
ultimately show ?case by (rule conseq)
qed
text{*\noindent In the @{term While}-case, @{const Its} provides the obvious
termination argument.
The actual completeness theorem follows directly, in the same manner
as for partial correctness: *}
theorem hoaret_complete: "\<Turnstile>\<^sub>t {P}c{Q} \<Longrightarrow> \<turnstile>\<^sub>t {P}c{Q}"
apply(rule strengthen_pre[OF _ wpt_is_pre])
apply(auto simp: hoare_tvalid_def wpt_def)
done
corollary hoaret_sound_complete: "\<turnstile>\<^sub>t {P}c{Q} \<longleftrightarrow> \<Turnstile>\<^sub>t {P}c{Q}"
by (metis hoaret_sound hoaret_complete)
end
|
Formal statement is: lemma monom_0: "monom a 0 = pCons a 0" Informal statement is: The monomial $a^0$ is equal to the polynomial $a$.
|
%-------------------------------------------------------
% DOCUMENT CONFIGURATIONS
%-------------------------------------------------------
%-------------------------------------------------------
% START OF ARCHITECTURE ANNEXES
%-------------------------------------------------------
\subsection{Screenshots}
\begin{figure}[htpb]
\centering
\begin{adjustbox}{center}
\includegraphics[scale=0.41]{annexes/screenshots/oc-webgate-screenshot-main.png}
\end{adjustbox}
\caption{Screenshot from the main page of Webgate
\label{fig:oc-webgate-screenshot-main}}
\end{figure}
\begin{figure}[htpb]
\centering
\begin{adjustbox}{center}
\includegraphics[scale=0.41]{annexes/screenshots/oc-webgate-screenshot-advanced.png}
\end{adjustbox}
\caption{Screenshot from the advanced page of Webgate
\label{fig:oc-webgate-screenshot-advanced}}
\end{figure}
\begin{figure}[htpb]
\centering
\begin{adjustbox}{center}
\includegraphics[scale=0.41]{annexes/screenshots/oc-webgate-screenshot-advanced-detailed.png}
\end{adjustbox}
\caption{Screenshot from the advanced page with details of Webgate
\label{fig:oc-webgate-screenshot-advanced-detailed}}
\end{figure}
%-------------------------------------------------------
% END OF ARCHITECTURE ANNEXES
%-------------------------------------------------------
|
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{float}
\usepackage{tabularx}
\usepackage{cite}
\usepackage{url}
\usepackage{hyperref}
\title{Merkle trees and I.T. clouds}
\author{LogSentinel}
\date{2018}
\graphicspath{ {./images/} }
\begin{document}
\maketitle
\begin{abstract}
This document includes basic information about the structure and function of Merkle trees as an efficient way to certify the integrity of data records. The generation of Merkle trees and Merkle audit and consistency proofs is described in detail. Furthermore, a resource-efficient method for using Merkle trees and a sample server implementation of a system log based on a Merkle tree are introduced.
\end{abstract}
\tableofcontents
\section{Merkle trees}
\subsection{Definitions}
\begin{enumerate}
\item $ HASH(x) $ - denotes the operation of generating a cryptographic hash over the data $ x $ using a specific algorithm
\item $ x_{1} | x_{2} $ - denotes the concatenation of $ x_{1} $ and $ x_{2} $
\item $ D_{n} $ - denotes a list of n entries (e.g. $ D_{3} $ is a list of three entries)
\item $ d(x) $ - denotes the (x - 1)-th element of a list $ D_{n} $ of n entries (e.g. $ d(3) from D_{5} $ denotes the fourth element from a list with five entries)
\item $ D_{x, n}^{y} $
\end{enumerate}
\subsection{Basics}
\begin{figure}[H]
\caption{A sample Merkle tree with eleven entries}
\includegraphics[width=\textwidth]{images/"Merkle tree with node layers".png}
\end{figure}
A Merkle tree consists of leaves, nodes and a tree head (hash). The input to the Merkle tree is an ordered list of binary data entries (E 1-11). \\
These entries are hashed in order to form the Merkle tree leaves.
\[HASH(E1)=L1, HASH(E2)=L2, ..., HASH(E11)=L11\]
The leaves (the binary data entries that were hashed in the previous step) are now hashed pairwise. Each hash forms a Merkle tree node. Together, all hashes of the Merkle tree leaves form the first layer of Merkle tree nodes. If the number of leaves is odd, the last leaf is not hashed for a second time, as it does not have a partner leaf to be hashed pairwise with.
\[HASH(E1|E2)=A, HASH(E2|E3)=B, ..., HASH(E9|10)=E\]
The Merkle tree nodes from the (first) layer - generated in the previous step - are once again to be hashed pairwise, in this way forming new hashes that then form a new (second) layer of nodes. This cycle continues until only two nodes remain. By hashing them, one receives the Merkle Tree Hash (MTH) of the given tree. The last nodes of odd-sized layers of nodes are hashed cross-layer. \\
\subsection{Important properties of Merkle trees}
Merkle trees provide a fast and efficient way to prove that:
\begin{enumerate}
\item all data entries have been consistently appended to the database.
\item a particular data entry has been appended to the log.
\end{enumerate}
\subsubsection{Parameter k}
The parameter $ k $ is the largest power of two smaller than n (i.e.,$ k \textless n \leq 2k $). In the context of Merkle trees, by calculating k, one receives the largest number of leaves that can be used to build a Merkle tree with entirely even-sized node layers in an original, bigger Merkle tree with odd- or even-sized node layers.
\subsubsection{Generating a Merkle Tree Hash}
The input to the Merkle Tree Hash (MTH) generation method \textit{GenerateMTH} is an ordered list of data entries \textit{$ D_{n} $} of size $ n $. The output is a single hash value. \\
\textbf{GenerateMTH(\textit{$ D_{n} $} d)}
\begin{enumerate}
\item Define $ n $ as the size of $ d $
\item The MTH of an empty list (n = 0) is the hash of an empty string. \[Return: HASH().\]
\item The MTH of a list with one entry (n = 1) is defined as a leaf hash. \[Return: HASH(0x00 | d(0)).\]
\item The MTH of a list with more than one entries (n \textgreater 1) is generated as follows:
\begin{enumerate}
\item Calculate the parameter $ k $ for $ n $
\item Create a new list of data entries $ D_{0, k}^{k} = [ d(0), d(1), d(2), ..., d(k - 1) ] $ of size $ k $
\item Create a new list of data entries $ D_{k, n - k}^{n} = [d(k), d(k+1), d(k+2), d(n - 1) ]$ of size $ n - k $
\item Using a recursion, the MTH is calculated as follows: \[Return: HASH(0x01 | GenerateMTH( D_{0, k}^{k}) | GenerateMTH(D_{k, n - k}^{n}))\]
\end{enumerate}
\end{enumerate}
\subsubsection{Explaining the recursion during the MTH generation}
In a recursion, the abovedescribed method for generating Merkle Tree Hashes (MTH) splits the original Merkle tree into smaller ones and calculates their MTHs. This process of generating smaller and smaller trees continues until the tree leaves are reached. The resulting MTHs of the subtrees are sent back on the chain in the opposite direction of the tree separation in order to form the MTH of the original tree.
First, the parameter k must be calculated based on n. Each tree, beginning with the original one, is then split in two new trees with leaves from 1 to k and, respectively, leaves from k to n. The same operation of recalculating k and splitting the tree in two, smaller trees is performed for these two newly generated trees and then for the resulting from this operation two trees and so on.
When the leaves of the original tree are reached, their leaf hash is calculated. The hash of the concatenated leaf hashes of two entries form the MTH of the smallest trees. The hash of the concatenated MTHs of two related trees, split by k, form the MTH of their parent tree. This calculation of the MTHs from smaller trees to bigger trees continues until only two subtrees exist. The hash of their concatenated MTHs form the MTH of the original tree.
The following figures illustrate this behavior. The orange boxes represent the trees with leaves from 1 to k. The red boxes represent the trees with leaves from k to n.
\begin{figure}[H]
\centering
\caption{This is the original Merkle tree. Its MTH (\textbf{J}) is calculated by concatenating the MTHs of the two subtrees (I and H) with leaves from $ 1 $ to $ k=8 $ [$ L1 \rightarrow L8 $] and with leaves from $ k=8 $ to $ n=11 $ [$ L8 \rightarrow L11 $].}
\includegraphics[width=\textwidth]{images/"Building Merkle trees n11".png}
\end{figure}
\begin{figure}[H]
\centering
\caption{This is the first subtree of the original tree $ n=11 $. Its MTH (\textbf{I}) is calculated by concatenating the MTHs of its two subtrees (F and G) with leaves from $ 1 $ to $ k=4 $ [$ L1 \rightarrow L4 $] and with leaves from $ k=4 $ to $ n=8 $ [$ L5 \rightarrow L8 $]. This subtree's MTH is used to calculate its parent tree's MTH (J = \textbf{I} + H).}
\includegraphics[height=6cm]{images/"Building Merkle trees n8".png}
\end{figure}
\begin{figure}[H]
\centering
\caption{This is the other subtree of the original tree $ n=11 $. Its MTH (\textbf{H}) is calculated by concatenating the MTH of its one subtree (E) with leaves from $ 1 $ to $ k=2 $ [$ L9 \rightarrow L10 $] and with the leaf hash of 3 [L11]. This subtree's MTH is used to calculate its parent tree's MTH (J = I + \textbf{H}).}
\includegraphics[height=4.5cm]{images/"Building Merkle trees n3".png}
\end{figure}
\begin{figure}[H]
\centering
\caption{This is the first subtree of the previously generated subtree $ n=8 $. Its MTH (\textbf{F}) is calculated by concatenating the MTHs of its two subtrees (A and B) with leaves from $ 1 $ to $ k=2 $ [$ L1 \rightarrow L2 $] and with leaves from $ k=2 $ to $ n=4 $ [$ L3 \rightarrow L4 $]. This subtree's MTH is used to calculate its parent tree's MTH (I = \textbf{F} + G).}
\includegraphics[height=4.5cm]{images/"Building Merkle trees n4".png}
\end{figure}
\begin{figure}[H]
\centering
\caption{This is the first subtree of the previously generated subtree $ n=4 $. Its MTH (\textbf{A}) is calculated by concatenating the leaf hashes of its two leaves L1 and L2 and used to calculate its parent tree's MTH (F = \textbf{A} + B).}
\includegraphics[height=2.5cm]{images/"Building Merkle trees n2".png}
\end{figure}
\subsection{Verifying proper inclusion}
\subsection{Verifying consistency}
\section{Merkle tree usage}
\subsection{Required database tables}
\subsubsection{PendingEntries}
The \textit{PendingEntries} table stores the data of log entries that were processed by the system but were not merged with the current Merkle tree. The \textit{Id} of the record is a preassigned Merkle tree leaf index and is calculated by getting the size of the current Merkle tree plus the number of pending entries plus one. The structured data of the log entry is stored in the \textit{Data} field of the table. A time stamp is added for information purposes.
\begin{table}[H]
\centering
\caption{Database table \textit{PendingEntries}}
\label{pendingEntriesDbTable1}
\begin{tabular}{|c|c|c|} \hline
\textbf{Id} & \textbf{Data} & \textbf{TimeStamp} \\ \hline
INTEGER & BLOB & INTEGER \\ \hline
NOT NULL & NOT NULL & NOT NULL\\
UNIQUE && \\
PRIMARY KEY && \\ \hline
\end{tabular}
\end{table}
\subsubsection{Entries}
The \textit{Entries} table stores all Merkle tree leaves that reside in the current Merkle tree and that were used to calculate the latest Merkle Tree Hash (MTH). The \textit{Id}, \textit{Data} and \textit{TimeStamp} fields are identical to those of the \textit{PendingEntries} table. They are simply copied to this table when a new Merkle tree is being generated. The additional field \textit{TreeSize} denotes the size of the resulting Merkle tree in order to make a connection between a historical Merkle Tree Head of a Merkle tree of size \textit{TreeSize} and a particular Merkle tree leaf. This table has to be append-only.
\begin{table}[H]
\centering
\caption{Database table \textit{Entries}}
\label{entriesDbTable1}
\begin{tabular}{|c|c|c|c|} \hline
\textbf{Id} & \textbf{Data} & \textbf{TimeStamp} & \textbf{TreeSize} \\ \hline
INTEGER & BLOB & INTEGER & INTEGER \\ \hline
NOT NULL & NOT NULL & NOT NULL & NOT NULL \\
UNIQUE &&& \\
PRIMARY KEY &&& \\ \hline
\end{tabular}
\end{table}
\subsubsection{TreeHeads}
The \textit{TreeHeads} table stores all historical Merkle Tree Heads that were generated during the operation of the system. It also includes the latest Merkle Tree Head - this is the Merkle Tree Head of the greatest \textit{TreeSize}. The Merkle Tree Head (Hash) is stored in the \textit{TreeHash} field. The \textit{Id} field is not important and can be set to auto-increment. The signature over the corresponding \textit{TreeHash} is stored in the \textit{Signature} field. \textit{TreeSize} denotes the size of the Merkle tree during the generation of the corresponding Merkle Tree Head, and \textit{TimeStamp} - the time of the generation of the corresponding Merkle Tree Head. This table has to be append-only.
\begin{table}[H]
\centering
\caption{Database table \textit{TreeHeads}}
\label{treeHeadsDbTable1}
\begin{tabular}{|c|c|c|c|c|} \hline
\textbf{Id} & \textbf{TreeHash} & \textbf{TimeStamp} & \textbf{TreeSize} & \textbf{Signature} \\ \hline
INTEGER & BLOB & INTEGER & INTEGER & BLOB \\ \hline
NOT NULL & NOT NULL & NOT NULL & NOT NULL & NOT NULL \\
UNIQUE & & & & \\
PRIMARY KEY & & & & \\ \hline
\end{tabular}
\end{table}
\subsubsection{CachedEntries}
The \textit{CachedEntries} table stores the hash values of important nodes in the current Merkle Tree. The hash of an important node is stored in the \textit{Hash} field of the table. The \textit{Start} field denotes the leaf index of the first Merkle tree leaf in the sequence, used to generate the particular node, and the \textit{Stop} field - the leaf index of the last Merkle tree leaf in the sequence. The \textit{Id} field is not important and can be set to auto-increment. Please refer to Section \ref{saving-important-nodes} for more information on how important nodes are selected. As some important nodes change when a new Merkle tree is generated, this table has to be updated regularly.
\begin{table}[H]
\centering
\caption{Database table \textit{CachedNodes}}
\label{cachedNodesDbTable1}
\begin{tabular}{|c|c|c|c|} \hline
\textbf{Id} & \textbf{Start} & \textbf{Stop} & \textbf{Hash} \\ \hline
INTEGER & INTEGER & INTEGER & BLOB \\ \hline
NOT NULL & NOT NULL & NOT NULL & NOT NULL \\
UNIQUE &&& \\
PRIMARY KEY &&& \\ \hline
\end{tabular}
\end{table}
\subsection{Interactions}
\subsubsection{Log entry submission and Merkle tree generation}
An application submits a log entry through the official LogSentinel API endpoints. The log entry data is then structured (encoded) in a special way, so that two entries with the same data but of different attribute order result in the same structured data. The ASN.1 or TLS encoding schemes could be used for this purpose. Basic encoding schemes such as key-value concatenation are acceptable as well, as long as they have the desired, above-mentioned property. \underline{The hash} of the structured (encoded) log entry data is then saved in the \textit{PendingEntries} table in a remote database. The \textit{Id} of the record is a preassigned Merkle tree leaf index and is calculated by getting the size of the current Merkle tree plus the number of pending entries plus one. Please note that the number of pending entries increases with every record inserted.
Every $x$ hours a new Merkle tree is built. The maximum time needed to merge pending entries with the current Merkle tree is called MMD or Maximum Merge Delay. A reasonable MMD is a MMD of 24 hours.
When a new Merkle tree has to be built, all entries in the \textit{PendingEntries} table are transfered to the \textit{Entries} table. The \textit{Id}, \textit{Data} and \textit{TimeStamp} properties of each new record in the \textit{Entries} table are copied from the corresponding record from the \textit{PendingEntries} table without modification. The \textit{TreeSize} property in the new records is calculated by getting the size of the current Merkle tree plus the size of the \textit{PendingEntries} table. When the transfer of all entries in the \textit{Entries} table has been completed, all records in the \textit{PendingEntries} table are to be deleted.
With all entries in the \textit{Entries} table, the program generates a list of all leaves that are to be included in the new Merkle tree. This list should only include the leaf index of the corresponding leaves. Practically, this list has to contain all indexes from 1 to $ n $, where $ n $ is the size of the \textit{Entries} table. Then, a function is called that generates a Merkle Tree Head given a list of leaf indexes, generated in the previous step.
The MTH generation function returns a hash that has to be signed by the server and inserted in the \textit{TreeHash} field of the \textit{TreeHeads} table. This database record also includes the time of generation (\textit{TimeStamp}) and the size of the current Merkle Tree (\textit{TreeSize}). The record incorporates the calculated cryptographic signature as well.
\subsubsection{Merkle inclusion proof generation}
If a client wants to verify whether a particular log entry resides in the current Merkle tree, the system can produce an inclusion proof that is used for verification. For this purpose, the index of the leaf to be verified for inclusion is needed. The client can directly specify the leaf index or perform a search:
\begin{enumerate}
\item raw log entry data is submitted and the system generates the corresponding structured data hash. The systems performs a search in the database based on it. A leaf index is returned if a single entry is found. If there are more than one tree leaves of the same content, a list of indexes is returned.
\item the log entry data is structured and hashed client-side and the resulting hash is submitted. The systems performs a search in the database based on it. A leaf index is returned if a single entry is found. If there are more than one tree leaves of the same content, a list of indexes is returned.
\end{enumerate}
The program generates a list of all leaves that are included in the current Merkle tree. This list should only include the leaf index of the corresponding leaves. Given this list and the leaf index, a function is then called that returns a list of intermediate nodes - the inclusion proof. By using them, the client can reconstruct the current Merkle tree and calculate the Merkle Tree Hash. It can then be compared to the one, advertised by the system.
\subsubsection{Merkle consistency proof generation}
If a client wants to verify the consistency between two advertised Merkle Tree Hashes, i.e. verify that any two versions of a log are consistent, the system can produce a consistency proof that is used for verification. For this purpose, the tree size of the previous (\textit{tree\_size1}) and the tree size of the newer tree (\textit{tree\_size2}) are needed (0 \textless \textit{tree\_size1} \textless \textit{tree\_size2}). If only one tree size is specified, the system assumes that the consistency between the specified Merkle tree and the current Merkle tree should be returned.
The program generates a list of leaves of size \textit{tree\_size2}. This list should only include the leaf index of the corresponding leaves. Given this list and \textit{tree\_size1}, a function is then called that returns a list of nodes - the consistency proof. By using them, the client can reconstruct the current Merkle tree (and the old one) and calculate the Merkle Tree Hash. It can then be compared to the one, advertised by the system. Additionally, the Merkle Tree Hash of the reconstructed old Merkle tree can be compared to the externally fetched one.
\subsection{API endpoints}
\subsubsection{Retrieve general information}
\textbf{GET} https://api.logsentinel.com/api/merkle/info \\
\noindent Outputs:
\begin{enumerate}
\item hashAlgorithm: The OID of the hash algorithm that is used by the system.
\item signatureAlgorithm: The OID of the signature algorithm that is used by the system.
\item publicKey: The public key that corresponds to the cryptographic key pair used by the system to sign Merkle Tree Hashes (MTHs).
\end{enumerate}
\subsubsection{Retrieve the current Merkle Tree Hash (MTH)}
\textbf{GET} https://api.logsentinel.com/api/merkle/sth \\
\noindent Outputs:
\begin{enumerate}
\item treeSize: The size of the current Merkle tree.
\item mth: The Merkle Tree Hash (MTH) of the current Merkle tree.
\item signature: The cryptographic signature over the current Merkle Tree Hash (MTH).
\item timestamp: The time of generation of the current Merkle Tree Hash (MTH).
\end{enumerate}
\subsubsection{Submit a log entry for inclusion in the Merkle tree}
\textbf{POST} https://api.logsentinel.com/api/merkle/submit \\
\noindent Authentication: basic \\
\noindent Inputs:
\begin{enumerate}
\item applicationId: Application ID, identifying a target application (obtained from the API credentials page). Required.
\item entry: Base64-encoded entry of any format about the event that is to be stored in the Merkle tree. Required.
\end{enumerate}
\noindent Outputs:
\begin{enumerate}
\item leafIndex: The preassigned leaf index of the submitted entry.
\end{enumerate}
\noindent Error codes:
\begin{table}[H]
\centering
\caption{Error codes}
\label{merkle-submit-error-codes}
\begin{tabular}{|l|l|}
\hline
\multicolumn{1}{|c|}{Code} & \multicolumn{1}{c|}{Meaning} \\ \hline
400 & One of the required inputs is missing. \\ \hline
401 & The specified \textit{applicationId} was not found or the provided \\
& authentication credentials were wrong. \\ \hline
500 & The system cannot include this entry in the Merkle tree for unknown \\ & reasons. \\ \hline
\end{tabular}
\end{table}
\subsubsection{Get an inclusion proof for a log entry}
\textbf{GET} https://api.logsentinel.com/api/merkle/inclusion \\
\noindent Authentication: basic \\
\noindent Inputs:
\begin{enumerate}
\item applicationId: Application ID, identifying a target application (obtained from the API credentials page). Required.
\item leafIndex: Leaf index of the entry for which an inclusion proof has to be returned. Can be found using the search option of the API. Required.
\end{enumerate}
\noindent Outputs:
\begin{enumerate}
\item inclusion: A list of Base64-encoded nodes or leaves that prove the inclusion of the specified entry in the current Merkle tree.
\item sth: The current Merkle Signed Tree Head (STH).
\end{enumerate}
\noindent Error codes:
\begin{table}[H]
\centering
\caption{Error codes}
\label{merkle-inclusion-error-codes}
\begin{tabular}{|l|l|}
\hline
\multicolumn{1}{|c|}{Code} & \multicolumn{1}{c|}{Meaning} \\ \hline
400 & One of the required inputs is missing. \\ \hline
401 & The specified \textit{applicationId} was not found or the provided \\
& authentication credentials were wrong. \\ \hline
404 & The specified \textit{leafIndex} was not found. \\ \hline
500 & The system cannot provide the inclusion proof for this entry \\ & in the Merkle tree for unknown reasons. \\ \hline
\end{tabular}
\end{table}
\subsubsection{Retrieve the consistency proof for two versions of the Merkle tree}
\textbf{GET} https://api.logsentinel.com/api/merkle/consistency \\
\noindent Authentication: basic \\
\noindent Inputs:
\begin{enumerate}
\item applicationId: Application ID, identifying a target application (obtained from the API credentials page). Required.
\item firstTreeSize: Size of the older tree. Required.
\item secondTreeSize: Size of the newer tree. Optional. If not specified, the system assumes that a consistency proof between the older tree and the current tree has to be returned.
\end{enumerate}
\noindent Outputs:
\begin{enumerate}
\item consistency: A list of Base64-encoded nodes that prove the consistency between the two specified versions of the Merkle tree.
\end{enumerate}
\noindent Error codes:
\begin{table}[H]
\centering
\caption{Error codes}
\label{merkle-consistency-error-codes}
\begin{tabular}{|l|l|}
\hline
\multicolumn{1}{|c|}{Code} & \multicolumn{1}{c|}{Meaning} \\ \hline
400 & One of the required inputs is missing or \textit{firstTreeSize} is \\
& greater than \textit{secondTreeSize}. \\ \hline
401 & The specified \textit{applicationId} was not found or the provided \\
& authentication credentials were wrong. \\ \hline
404 & The specified tree(s) was/were not found. \\ \hline
500 & The system cannot provide the consistency proof for the \\ & specified versions of the Merkle tree for unknown reasons. \\ \hline
\end{tabular}
\end{table}
\subsubsection{Retrieve leaves from database}
\textbf{GET} https://api.logsentinel.com/api/merkle/get \\
\noindent Authentication: basic \\
\noindent Inputs:
\begin{enumerate}
\item applicationId: Application ID, identifying a target application (obtained from the API credentials page). Required.
\item start: 0-based index of first leaf to retrieve. Required.
\item stop: 0-based index of the last leaf to retrieve. Optional. If not specified, the system assumes that all leaves from \textit{start} to \textit{size} of the current Merkle tree have to be returned.
\end{enumerate}
\noindent Outputs:
\begin{enumerate}
\item leaves: A list of Base64-encoded leaves with leaf indexes between \textit{start} and \textit{stop}.
\end{enumerate}
\noindent Error codes:
\begin{table}[H]
\centering
\caption{Error codes}
\label{merkle-get-error-codes}
\begin{tabular}{|l|l|}
\hline
\multicolumn{1}{|c|}{Code} & \multicolumn{1}{c|}{Meaning} \\ \hline
400 & One of the required inputs is missing or \textit{start} is \\
& greater than \textit{stop}. \\ \hline
401 & The specified \textit{applicationId} was not found or the provided \\
& authentication credentials were wrong. \\ \hline
500 & The system cannot provide the requested leaves \\ & for unknown reasons. \\ \hline
\end{tabular}
\end{table}
\subsubsection{Search for a specific leaf in the database}
\textbf{GET} https://api.logsentinel.com/api/merkle/search \\
\noindent Authentication: basic \\
\noindent Inputs:
\begin{enumerate}
\item applicationId: Application ID, identifying a target application (obtained from the API credentials page). Required.
\item hash: The hash of the log entry, for which a leaf index has to be returned. Required.
\end{enumerate}
\noindent Outputs:
\begin{enumerate}
\item indexes: A list of indexes of leafs that match the search criteria. If only one entry was found, matching the search criteria, the list contains only one leaf index.
\end{enumerate}
\noindent Error codes:
\begin{table}[H]
\centering
\caption{Error codes}
\label{merkle-search-error-codes}
\begin{tabular}{|l|l|}
\hline
\multicolumn{1}{|c|}{Code} & \multicolumn{1}{c|}{Meaning} \\ \hline
400 & One of the required inputs is missing. \\ \hline
401 & The specified \textit{applicationId} was not found or the provided \\
& authentication credentials were wrong. \\ \hline
404 & No leaves were found matching the specified hash. \\ \hline
500 & The system cannot provide the requested leaf indexes \\ & for unknown reasons. \\ \hline
\end{tabular}
\end{table}
\section{Resource-efficient storage and generation of Merkle trees}
\subsection{Saving important nodes in the database}
\label{saving-important-nodes}
\cite{CT:2} \cite{cryptoeprint:2016:683}
\cite{ct:org}
\bibliography{References}{}
\bibliographystyle{apalike}
\end{document}
|
Require Import Crypto.Specific.Framework.RawCurveParameters.
Require Import Crypto.Util.LetIn.
(***
Modulus : 2^150 - 5
Base: 37.5
***)
Definition curve : CurveParameters :=
{|
sz := 4%nat;
base := 37 + 1/2;
bitwidth := 64;
s := 2^150;
c := [(1, 5)];
carry_chains := Some [seq 0 (pred 4); [0; 1]]%nat;
a24 := None;
coef_div_modulus := Some 2%nat;
goldilocks := None;
karatsuba := None;
montgomery := false;
freeze := Some true;
ladderstep := false;
mul_code := None;
square_code := None;
upper_bound_of_exponent_loose := None;
upper_bound_of_exponent_tight := None;
allowable_bit_widths := None;
freeze_extra_allowable_bit_widths := None;
modinv_fuel := None
|}.
Ltac extra_prove_mul_eq _ := idtac.
Ltac extra_prove_square_eq _ := idtac.
|
If $a$ and $b$ are coprime, then $a$ is an $n$th power if and only if $b$ is an $n$th power.
|
module Svg where
import Data.Maybe
import Control.Applicative
import Data.Complex
data ViewBox = ViewBox {
viewBoxX :: String,
viewBoxY :: String,
viewBoxWidth :: String,
viewBoxHeight :: String
} deriving Eq
viewBoxToString :: ViewBox -> String
viewBoxToString vb = "viewBox=\"" ++ viewBoxX vb ++ " " ++ viewBoxY vb ++ " " ++
viewBoxWidth vb ++ " " ++ viewBoxHeight vb ++ "\""
data WidthHeight = WidthHeight {
width :: String,
height :: String
} deriving Eq
switchOrientation :: WidthHeight -> WidthHeight
switchOrientation (WidthHeight w h) = WidthHeight h w
widthHeightToString :: WidthHeight -> String
widthHeightToString (WidthHeight w h) = "width=\"" ++ w ++ "\" height=\"" ++ h ++ "\""
a4PortraitWidthHeight :: WidthHeight
a4PortraitWidthHeight = WidthHeight "210mm" "297mm"
data Stroke = Stroke {
strokeColorMaybe :: Maybe String,
strokeWidthMaybe :: Maybe Double
} deriving Eq
strokeToString :: Stroke -> String
strokeToString (Stroke cm wm) = maybeToAttr cm colorToString ++
maybeToAttr wm widthToString where
colorToString c = "stroke=\"" ++ c ++ "\""
widthToString w = "stroke-width=\"" ++ show w ++ "\""
strokeWidthMap :: (Double -> Double) -> Stroke -> Stroke
strokeWidthMap f (Stroke cm wm) = Stroke cm (f <$> wm)
maybeToAttr :: Maybe a -> (a -> String) -> String
maybeToAttr maybe toStr =
fromMaybe "" (((' ' :) . toStr) <$> maybe)
maybePrefix :: Maybe String -> String
maybePrefix m = fromMaybe "" ((++ ":") <$> m)
prologue :: Maybe String -> String -> Maybe WidthHeight -> Maybe ViewBox -> String
prologue svgPrefixMaybe xlinkPrefix widthHeightMaybe viewBoxMaybe =
"<" ++ maybePrefix svgPrefixMaybe ++
"svg xmlns" ++ (fromMaybe "" ((':' :) <$> svgPrefixMaybe)) ++
"=\"http://www.w3.org/2000/svg\" xmlns:" ++
xlinkPrefix ++ "=\"http://www.w3.org/1999/xlink\"" ++
maybeToAttr widthHeightMaybe widthHeightToString ++
maybeToAttr viewBoxMaybe viewBoxToString ++
"><" ++ maybePrefix svgPrefixMaybe ++ "g transform=\"scale(1 -1)\">"
epilogue :: Maybe String -> String
epilogue svgPrefixMaybe = let pref = maybePrefix svgPrefixMaybe in
"</" ++ pref ++ "g></" ++ pref ++ "svg>"
drawGraph :: Maybe String -> Double -> Double -> Stroke -> [(Double, Double)] -> String
drawGraph svgPrefixMaybe xScale yScale stroke pnts =
let scaledPnts = map (\(x, y) -> (x * xScale, y * yScale)) pnts
pairToString (x, y) = show x ++ " " ++ show y
in
"<" ++ maybePrefix svgPrefixMaybe ++ "path" ++
strokeToString stroke ++
" fill=\"none\" d=\"M " ++ pairToString (head scaledPnts) ++
" L" ++ (foldr (\s1 s2 -> (' ' : s1) ++ s2) "" (map pairToString (tail scaledPnts))) ++
"\" />"
drawComplex :: Show a => Complex a -> Maybe String -> Stroke -> String
drawComplex (a :+ b) svgPrefixMaybe stroke =
"<" ++ maybePrefix svgPrefixMaybe ++ "line" ++ strokeToString stroke ++
" x1=\"0\" y1=\"0\" x2=\"" ++ show a ++ "\" y2=\"" ++ show b ++ "\" />"
|
// Creates a Lightbridge at the corresponding ACV_PortalOut of every area effect cloud named ACV_PortalIn with tag ACV_createLightBridges_PARAM that is in the same block of a ACV_LightBridgeEnd.
// This is achieved by summoning an ACV_LightBridge_Idle at ACV_PortalIn wich will get teleported to ACV_PortalOut in the next tick.
// The ACV_LightBridge_Idle will then be transformed to an ACV_LightBridge.
// Params: area_effect_cloud named ACV_PortalIn tagged with ACV_createLightBridges_PARAM
// Return: area_effect_cloud named ACV_LightBridge_Idle
impulse process ACV_createLightBridges {
if: /testfor @e[type=area_effect_cloud,name=ACV_PortalIn,score_ACV_COLOR_min=0,score_ACV_COLOR=0]
then { // only create light- and anti-bridge if the connection is open
if: /testfor @e[type=area_effect_cloud,name=ACV_PortalIn,score_ACV_COLOR_min=1,score_ACV_COLOR=1]
then {
/execute @e[type=area_effect_cloud,name=ACV_PortalIn,tag=ACV_createLightBridges_PARAM,score_ACV_COLOR_min=0,score_ACV_COLOR=1] ~ ~ ~ execute @e[type=area_effect_cloud,name=ACV_LightBridgeEnd,tag=!ACV_BlueOrange,dy=0] ~ ~ ~ summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_LightBridge_Idle",Tags:[ACV_RotationProof,ACV_BlueOrange],Duration:2147483647}
/execute @e[type=area_effect_cloud,name=ACV_PortalIn,tag=ACV_createLightBridges_PARAM,score_ACV_COLOR_min=0,score_ACV_COLOR=1] ~ ~ ~ execute @e[type=area_effect_cloud,name=ACV_LightBridgeEnd,tag=!ACV_BlueOrange,dy=0] ~ ~ ~ summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_AntiBridge_Idle",Tags:[ACV_RotationProof],Duration:2147483647}
}
}
if: /testfor @e[type=area_effect_cloud,name=ACV_PortalIn,score_ACV_COLOR_min=2,score_ACV_COLOR=2]
then { // only create light- and anti-bridge if the connection is open
if: /testfor @e[type=area_effect_cloud,name=ACV_PortalIn,score_ACV_COLOR_min=3,score_ACV_COLOR=3]
then {
/execute @e[type=area_effect_cloud,name=ACV_PortalIn,tag=ACV_createLightBridges_PARAM,score_ACV_COLOR_min=2,score_ACV_COLOR=3] ~ ~ ~ execute @e[type=area_effect_cloud,name=ACV_LightBridgeEnd,tag=!ACV_PurpleRed,dy=0] ~ ~ ~ summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_LightBridge_Idle",Tags:[ACV_RotationProof,ACV_PurpleRed],Duration:2147483647}
/execute @e[type=area_effect_cloud,name=ACV_PortalIn,tag=ACV_createLightBridges_PARAM,score_ACV_COLOR_min=2,score_ACV_COLOR=3] ~ ~ ~ execute @e[type=area_effect_cloud,name=ACV_LightBridgeEnd,tag=!ACV_PurpleRed,dy=0] ~ ~ ~ summon area_effect_cloud ~ ~ ~ {CustomName:"ACV_AntiBridge_Idle",Tags:[ACV_RotationProof],Duration:2147483647}
}
}
/execute @e[type=area_effect_cloud,name=ACV_LightBridgeEnd,tag=ACV_BlueOrange] ~ ~ ~ scoreboard players tag @e[type=area_effect_cloud,name=ACV_LightBridge_Idle,dy=0] add ACV_BlueOrange
/execute @e[type=area_effect_cloud,name=ACV_LightBridgeEnd,tag=ACV_PurpleRed] ~ ~ ~ scoreboard players tag @e[type=area_effect_cloud,name=ACV_LightBridge_Idle,dy=0] add ACV_PurpleRed
/scoreboard players tag @e remove ACV_createLightBridges_PARAM
start ACV_lightBridges
}
|
module Network.Curl.Types.CurlEOption
import Network.Curl.Types.Code
import Network.Curl.Types.OptType
import Data.Buffer
import Util -- difference
import Derive.Enum
%language ElabReflection
public export
data CurlEOption : OptType -> Type where
CURLOPT_WRITEDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_URL : CurlEOption CURLOPTTYPE_STRINGPOINT --CURLOPTTYPE_OBJECTPOINT
CURLOPT_PORT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROXY : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_USERPWD : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXYUSERPWD : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_RANGE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_READDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_ERRORBUFFER : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_WRITEFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_READFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_TIMEOUT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_INFILESIZE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_POSTFIELDS : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_REFERER : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_FTPPORT : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_USERAGENT : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_LOW_SPEED_LIMIT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_LOW_SPEED_TIME : CurlEOption CURLOPTTYPE_LONG
CURLOPT_RESUME_FROM : CurlEOption CURLOPTTYPE_LONG
CURLOPT_COOKIE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_HTTPHEADER : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_HTTPPOST : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSLCERT : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_KEYPASSWD : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_CRLF : CurlEOption CURLOPTTYPE_LONG
CURLOPT_QUOTE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_HEADERDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_COOKIEFILE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSLVERSION : CurlEOption CURLOPTTYPE_LONG
CURLOPT_TIMECONDITION : CurlEOption CURLOPTTYPE_LONG
CURLOPT_TIMEVALUE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CUSTOMREQUEST : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_STDERR : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_POSTQUOTE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_OBSOLETE40 : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_VERBOSE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_HEADER : CurlEOption CURLOPTTYPE_LONG
CURLOPT_NOPROGRESS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_NOBODY : CurlEOption CURLOPTTYPE_LONG
CURLOPT_FAILONERROR : CurlEOption CURLOPTTYPE_LONG
CURLOPT_UPLOAD : CurlEOption CURLOPTTYPE_LONG
CURLOPT_POST : CurlEOption CURLOPTTYPE_LONG
CURLOPT_DIRLISTONLY : CurlEOption CURLOPTTYPE_LONG
CURLOPT_APPEND : CurlEOption CURLOPTTYPE_LONG
CURLOPT_NETRC : CurlEOption CURLOPTTYPE_LONG
CURLOPT_FOLLOWLOCATION : CurlEOption CURLOPTTYPE_LONG
CURLOPT_TRANSFERTEXT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PUT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROGRESSFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_XFERINFODATA : CurlEOption CURLOPTTYPE_OBJECTPOINT -- aka CURLOPT_PROGRESSDATA
CURLOPT_AUTOREFERER : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROXYPORT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_POSTFIELDSIZE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_HTTPPROXYTUNNEL : CurlEOption CURLOPTTYPE_LONG
CURLOPT_INTERFACE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_KRBLEVEL : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSL_VERIFYPEER : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CAINFO : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_MAXREDIRS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_FILETIME : CurlEOption CURLOPTTYPE_LONG
CURLOPT_TELNETOPTIONS : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_MAXCONNECTS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_OBSOLETE72 : CurlEOption CURLOPTTYPE_LONG
CURLOPT_FRESH_CONNECT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_FORBID_REUSE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_RANDOM_FILE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_EGDSOCKET : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_CONNECTTIMEOUT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_HEADERFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_HTTPGET : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSL_VERIFYHOST : CurlEOption CURLOPTTYPE_LONG
CURLOPT_COOKIEJAR : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSL_CIPHER_LIST : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_HTTP_VERSION : CurlEOption CURLOPTTYPE_LONG
CURLOPT_FTP_USE_EPSV : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSLCERTTYPE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSLKEY : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSLKEYTYPE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSLENGINE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSLENGINE_DEFAULT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_DNS_USE_GLOBAL_CACHE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_DNS_CACHE_TIMEOUT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PREQUOTE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_DEBUGFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_DEBUGDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_COOKIESESSION : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CAPATH : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_BUFFERSIZE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_NOSIGNAL : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SHARE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXYTYPE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_ACCEPT_ENCODING : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PRIVATE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_HTTP200ALIASES : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_UNRESTRICTED_AUTH : CurlEOption CURLOPTTYPE_LONG
CURLOPT_FTP_USE_EPRT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_HTTPAUTH : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSL_CTX_FUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_SSL_CTX_DATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_FTP_CREATE_MISSING_DIRS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROXYAUTH : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SERVER_RESPONSE_TIMEOUT : CurlEOption CURLOPTTYPE_LONG -- aka CURLOPT_FTP_RESPONSE_TIMEOUT
CURLOPT_IPRESOLVE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_MAXFILESIZE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_INFILESIZE_LARGE : CurlEOption CURLOPTTYPE_OFF_T
CURLOPT_RESUME_FROM_LARGE : CurlEOption CURLOPTTYPE_OFF_T
CURLOPT_MAXFILESIZE_LARGE : CurlEOption CURLOPTTYPE_OFF_T
CURLOPT_NETRC_FILE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_USE_SSL : CurlEOption CURLOPTTYPE_LONG
CURLOPT_POSTFIELDSIZE_LARGE : CurlEOption CURLOPTTYPE_OFF_T
CURLOPT_TCP_NODELAY : CurlEOption CURLOPTTYPE_LONG
CURLOPT_FTPSSLAUTH : CurlEOption CURLOPTTYPE_LONG
CURLOPT_IOCTLFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_IOCTLDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_FTP_ACCOUNT : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_COOKIELIST : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_IGNORE_CONTENT_LENGTH : CurlEOption CURLOPTTYPE_LONG
CURLOPT_FTP_SKIP_PASV_IP : CurlEOption CURLOPTTYPE_LONG
CURLOPT_FTP_FILEMETHOD : CurlEOption CURLOPTTYPE_LONG
CURLOPT_LOCALPORT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_LOCALPORTRANGE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CONNECT_ONLY : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CONV_FROM_NETWORK_FUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_CONV_TO_NETWORK_FUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_CONV_FROM_UTF8_FUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_MAX_SEND_SPEED_LARGE : CurlEOption CURLOPTTYPE_OFF_T
CURLOPT_MAX_RECV_SPEED_LARGE : CurlEOption CURLOPTTYPE_OFF_T
CURLOPT_FTP_ALTERNATIVE_TO_USER : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SOCKOPTFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_SOCKOPTDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSL_SESSIONID_CACHE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSH_AUTH_TYPES : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSH_PUBLIC_KEYFILE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSH_PRIVATE_KEYFILE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_FTP_SSL_CCC : CurlEOption CURLOPTTYPE_LONG
CURLOPT_TIMEOUT_MS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CONNECTTIMEOUT_MS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_HTTP_TRANSFER_DECODING : CurlEOption CURLOPTTYPE_LONG
CURLOPT_HTTP_CONTENT_DECODING : CurlEOption CURLOPTTYPE_LONG
CURLOPT_NEW_FILE_PERMS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_NEW_DIRECTORY_PERMS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_POSTREDIR : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSH_HOST_PUBLIC_KEY_MD5 : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_OPENSOCKETFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_OPENSOCKETDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_COPYPOSTFIELDS : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_TRANSFER_MODE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SEEKFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_SEEKDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_CRLFILE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_ISSUERCERT : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_ADDRESS_SCOPE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CERTINFO : CurlEOption CURLOPTTYPE_LONG
CURLOPT_USERNAME : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PASSWORD : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXYUSERNAME : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXYPASSWORD : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_NOPROXY : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_TFTP_BLKSIZE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SOCKS5_GSSAPI_SERVICE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SOCKS5_GSSAPI_NEC : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROTOCOLS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_REDIR_PROTOCOLS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSH_KNOWNHOSTS : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSH_KEYFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_SSH_KEYDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_MAIL_FROM : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_MAIL_RCPT : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_FTP_USE_PRET : CurlEOption CURLOPTTYPE_LONG
CURLOPT_RTSP_REQUEST : CurlEOption CURLOPTTYPE_LONG
CURLOPT_RTSP_SESSION_ID : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_RTSP_STREAM_URI : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_RTSP_TRANSPORT : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_RTSP_CLIENT_CSEQ : CurlEOption CURLOPTTYPE_LONG
CURLOPT_RTSP_SERVER_CSEQ : CurlEOption CURLOPTTYPE_LONG
CURLOPT_INTERLEAVEDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_INTERLEAVEFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_WILDCARDMATCH : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CHUNK_BGN_FUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_CHUNK_END_FUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_FNMATCH_FUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_CHUNK_DATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_FNMATCH_DATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_RESOLVE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_TLSAUTH_USERNAME : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_TLSAUTH_PASSWORD : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_TLSAUTH_TYPE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_TRANSFER_ENCODING : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CLOSESOCKETFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_CLOSESOCKETDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_GSSAPI_DELEGATION : CurlEOption CURLOPTTYPE_LONG
CURLOPT_DNS_SERVERS : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_ACCEPTTIMEOUT_MS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_TCP_KEEPALIVE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_TCP_KEEPIDLE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_TCP_KEEPINTVL : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSL_OPTIONS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_MAIL_AUTH : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SASL_IR : CurlEOption CURLOPTTYPE_LONG
CURLOPT_XFERINFOFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_XOAUTH2_BEARER : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_DNS_INTERFACE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_DNS_LOCAL_IP4 : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_DNS_LOCAL_IP6 : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_LOGIN_OPTIONS : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSL_ENABLE_NPN : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSL_ENABLE_ALPN : CurlEOption CURLOPTTYPE_LONG
CURLOPT_EXPECT_100_TIMEOUT_MS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROXYHEADER : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_HEADEROPT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PINNEDPUBLICKEY : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_UNIX_SOCKET_PATH : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SSL_VERIFYSTATUS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSL_FALSESTART : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PATH_AS_IS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROXY_SERVICE_NAME : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SERVICE_NAME : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PIPEWAIT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_DEFAULT_PROTOCOL : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_STREAM_WEIGHT : CurlEOption CURLOPTTYPE_LONG
CURLOPT_STREAM_DEPENDS : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_STREAM_DEPENDS_E : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_TFTP_NO_OPTIONS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CONNECT_TO : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_TCP_FASTOPEN : CurlEOption CURLOPTTYPE_LONG
CURLOPT_KEEP_SENDING_ON_ERROR : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROXY_CAINFO : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_CAPATH : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_SSL_VERIFYPEER : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROXY_SSL_VERIFYHOST : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROXY_SSLVERSION : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PROXY_TLSAUTH_USERNAME : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_TLSAUTH_PASSWORD : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_TLSAUTH_TYPE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_SSLCERT : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_SSLCERTTYPE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_SSLKEY : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_SSLKEYTYPE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_KEYPASSWD : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_SSL_CIPHER_LIST : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_CRLFILE : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_SSL_OPTIONS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_PRE_PROXY : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_PINNEDPUBLICKEY : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_ABSTRACT_UNIX_SOCKET : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SUPPRESS_CONNECT_HEADERS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_REQUEST_TARGET : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_SOCKS5_AUTH : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSH_COMPRESSION : CurlEOption CURLOPTTYPE_LONG
CURLOPT_MIMEPOST : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_TIMEVALUE_LARGE : CurlEOption CURLOPTTYPE_OFF_T
CURLOPT_HAPPY_EYEBALLS_TIMEOUT_MS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_RESOLVER_START_FUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_RESOLVER_START_DATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_HAPROXYPROTOCOL : CurlEOption CURLOPTTYPE_LONG
CURLOPT_DNS_SHUFFLE_ADDRESSES : CurlEOption CURLOPTTYPE_LONG
CURLOPT_TLS13_CIPHERS : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_TLS13_CIPHERS : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_DISALLOW_USERNAME_IN_URL : CurlEOption CURLOPTTYPE_LONG
CURLOPT_DOH_URL : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_UPLOAD_BUFFERSIZE : CurlEOption CURLOPTTYPE_LONG
CURLOPT_UPKEEP_INTERVAL_MS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_CURLU : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_TRAILERFUNCTION : CurlEOption CURLOPTTYPE_FUNCTIONPOINT
CURLOPT_TRAILERDATA : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_HTTP09_ALLOWED : CurlEOption CURLOPTTYPE_LONG
CURLOPT_ALTSVC_CTRL : CurlEOption CURLOPTTYPE_LONG
CURLOPT_ALTSVC : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_MAXAGE_CONN : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SASL_AUTHZID : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_MAIL_RCPT_ALLLOWFAILS : CurlEOption CURLOPTTYPE_LONG
CURLOPT_SSLCERT_BLOB : CurlEOption CURLOPTTYPE_BLOB
CURLOPT_SSLKEY_BLOB : CurlEOption CURLOPTTYPE_BLOB
CURLOPT_PROXY_SSLCERT_BLOB : CurlEOption CURLOPTTYPE_BLOB
CURLOPT_PROXY_SSLKEY_BLOB : CurlEOption CURLOPTTYPE_BLOB
CURLOPT_ISSUERCERT_BLOB : CurlEOption CURLOPTTYPE_BLOB
CURLOPT_PROXY_ISSUERCERT : CurlEOption CURLOPTTYPE_OBJECTPOINT
CURLOPT_PROXY_ISSUERCERT_BLOB : CurlEOption CURLOPTTYPE_BLOB
CURLOPT_LASTENTRY : CurlEOption UnusedOptType
curlEOptEnumList : List Int
curlEOptEnumList = difference [1..298]
[8,30,35,38,49,55,66,67,73,122,123,124,125,126,127,128,132,133]
-- ^ remove enums omitted from curl.h
[derivedToCode] ToCode (CurlEOption ty) where
toCode = enumTo curlEOptEnumList
-- Automate toCode plussing with the power of named instances
public export
{ty : _} -> ToCode (CurlEOption ty) where
toCode opt = toCode @{derivedToCode} opt + toCode ty
-- from is a little more complicated to automate since we'll need to case ty
-- somehow during elab. tough but we need that if we query curl for current
-- options. We can always do it manually though, but what a mess if so.
-- [derivedFromCode] {ty :_} -> FromCode (CurlEOption ty) where
-- fromCode {ty} = ?aSDFfd_1
public export
Show (CurlEOption ty) where
show = showEnum
public export
total
paramType : {ty : _} -> CurlEOption ty -> Type
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_WRITEFUNCTION
= Buffer -> (itemsize : Int) -> (len : Int) -> AnyPtr -> PrimIO Int
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_READFUNCTION
= Buffer -> (itemsize : Int) -> (len : Int) -> AnyPtr -> PrimIO Int
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_PROGRESSFUNCTION
= Int -- use CURLOPT_XFERINFOFUNCTION
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_HEADERFUNCTION
= Buffer -> (size : Int) -> (len : Int) -> AnyPtr -> PrimIO Int
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_DEBUGFUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_SSL_CTX_FUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_IOCTLFUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_CONV_FROM_NETWORK_FUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_CONV_TO_NETWORK_FUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_CONV_FROM_UTF8_FUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_SOCKOPTFUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_OPENSOCKETFUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_SEEKFUNCTION
= Int -- AnyPtr -> Bits64 -> Int -> PrimIO Int -- not implemented (yet) NB useful
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_SSH_KEYFUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_INTERLEAVEFUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_CHUNK_BGN_FUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_CHUNK_END_FUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_FNMATCH_FUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_CLOSESOCKETFUNCTION
= AnyPtr -> (socket : Int) -> PrimIO Int
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_XFERINFOFUNCTION
= AnyPtr -> (dl_total : Bits64) -> (dl_now : Bits64)
-> (ul_total : Bits64) -> (ul_now : Bits64) -> PrimIO Int
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_RESOLVER_START_FUNCTION
= Int -- not implemented (yet)
paramType {ty = CURLOPTTYPE_FUNCTIONPOINT} CURLOPT_TRAILERFUNCTION
= Int -- not implemented (yet)
paramType opt = optType ty
-- paramType CURLOPT_WRITEFUNCTION
-- = Buffer -> (size : Int) -> (nmemb : Int) -> AnyPtr -> PrimIO Int -- returns amount dealth with
|
import pseudo_normed_group.CLC
import rescale.LC
open_locale classical nnreal
open opposite ProFiltPseuNormGrpWithTinv
open SemiNormedGroup opposite Profinite pseudo_normed_group category_theory breen_deligne
open profinitely_filtered_pseudo_normed_group
universe variable u
variables (r : ℝ≥0) (V : SemiNormedGroup) (r' : ℝ≥0) [fact (0 < r')]
variables (c c₁ c₂ c₃ c₄ : ℝ≥0) (m n : ℕ)
@[simp] theorem CLCFP_rescale (N : ℝ≥0)
(M) [profinitely_filtered_pseudo_normed_group_with_Tinv r' M] :
(CLCFP V r' c n).obj (op (of r' (rescale N M))) =
(CLCFP V r' (c * N⁻¹) n).obj (op (of r' M)) := rfl
namespace breen_deligne
namespace universal_map
variables (ϕ : universal_map m n)
theorem eval_CLCFP_rescale [ϕ.suitable c₂ c₁]
(N : ℝ≥0)
(M : ProFiltPseuNormGrpWithTinv r') :
arrow.mk ((eval_CLCFP V r' c₁ c₂ ϕ).app (op (of r' (rescale N M)))) =
arrow.mk ((eval_CLCFP V r' (c₁ * N⁻¹) (c₂ * N⁻¹) ϕ).app (op M)) :=
by { dsimp only [eval_CLCFP, whisker_right_app], rw eval_LCFP_rescale, cases M, refl }
end universal_map
end breen_deligne
|
#' HDF5 Matrix Operations
#'
#' @description
#' Some out-of-core matrix operations via HDF5.
#'
#' @import float
#' @importFrom R6 R6Class
#'
#' @docType package
#' @name hdfmat-package
#' @author Drew Schmidt
#' @keywords package
NULL
|
function J = computeCostMulti(X, y, theta)
%COMPUTECOSTMULTI Compute cost for linear regression with multiple variables
% J = COMPUTECOSTMULTI(X, y, theta) computes the cost of using theta as the
% parameter for linear regression to fit the data points in X and y
% Initialize some useful values
m = length(y); % number of training examples
% You need to return the following variables correctly
J = 0;
% ====================== YOUR CODE HERE ======================
% Instructions: Compute the cost of a particular choice of theta
% You should set J to the cost.
y_pred = X * theta; % X.shape=(m,3) theta.shape=(3,1)
J = 1/(2*m) * sum((y_pred - y).^2);
% =========================================================================
end
|
\clearpage
\section{simple operation}
\label{sec:simple}
Command-line syntax: \\
%Syntax of \textbf{simple} operation: \\
kmc\_tools [global\_params] simple $<$input1 [input1\_params]$>$ $<$input2 [input2\_params]$>$ $<$oper1 output1 [output\_params1]$>$ [$<$oper2 output2 [output\_params2]$>$ ...] \\
where:
\begin{itemize}
\item \textsf{input1, input2} --- paths to the databases generated by \textsf{KMC} (\textsf{KMC} generates 2 files with the same name, but different extensions --- here only name without extension should be given),
\item \textsf{oper1, oper2, ...} --- set operations to be performed on input1 and input2,
\item \textsf{output1, output2, ...} --- paths of the output databases.
\end{itemize}
For each \textsf{input} there are additional parameters which can be set:
\begin{itemize}
\item \textsf{-ci$<$value$>$} --- exclude $k$-mers occurring less than <value> times,
\item \textsf{-cx$<$value$>$} --- exclude $k$-mers occurring more of than <value> times.
\end{itemize}
If additional parameters are not given they are taken from the appropriate input database.
For each output there are also additional parameters:
\begin{itemize}
\item \textsf{-ci$<$value$>$} --- exclude $k$-mers occurring less than <value> times,
\item \textsf{-cx$<$value$>$} --- exclude $k$-mers occurring more than <value> times,
\item \textsf{-cs$<$value$>$} --- maximal value of a counter,
\item \textsf{-oc$<$value$>$} --- redefine counter calculation mode for equal $k$-mers.
Available values:
\begin{itemize}
\item \textsf{min} --- get lower value of a $k$-mer counter,
\item \textsf{max} --- get upper value of a $k$-mer counter,
\item \textsf{sum} --- get sum of counters from both databases,
\item \textsf{diff} --- get difference between counters,
\item \textsf{left} --- get counter from first database (input1),
\item \textsf{right} --- get counter from second database (input2)
\end{itemize}
\end{itemize}
If parameters are not given they are deduced based on input databases and specified operation.
Valid values for \textsf{oper1, oper2, ...} are:
\begin{itemize}
\item \textsf{intersect} --- output database will contains only $k$-mers that are present in \textbf{both} input sets,
\item \textsf{union} --- output database will contains each $k$-mer present in \textbf{any} of input sets,
\item \textsf{kmers\_subtract} --- difference of input sets based on k-mers. Output database will contains only $k$-mers that are \textbf{present in the first} input set but \textbf{absent in the second} one,
\item \textsf{counters\_subtract} --- difference of input sets based on k-mers and their counters (weaker version of kmers\_subtract). Output database will contains all $k$-mers that are present in the first input, without those for which counter operation will lead to remove such $k$-mer (i.e. counter equal to 0 or negative number),
\item \textsf{reverse\_kmers\_subtract} --- same as kmers\_subtract but treat input2 as first and input1 as second,
\item \textsf{reverse\_counters\_subtract} --- same as counters\_subtract but treat input2 as first and input1 as second.
\end{itemize}
Each operation may be specified multiple times (which may be useful to produce two output sets with different cutoffs or counter calculation modes).
\begin{table}[H]
\centering
\begin{tabular}{|l|l|}
\hline
\textbf{operation} & \textbf{counter calculation mode} \\
\hline
\textsf{intersect} & \textsf{min} \\
\hline
\textsf{union} & \textsf{sum} \\
\hline
\textsf{kmers\_subtract} & NONE \\
\hline
\textsf{reverse\_kmers\_subtract} & NONE \\
\hline
\textsf{counters\_subtract} & \textsf{diff} \\
\hline
\textsf{reverse\_counters\_subtract} & \textsf{diff} (but input1 and input2 are swapped) \\
\hline
\end{tabular}
\caption{Default values of -oc switch for each operation}
\label{table:defaults_counter_mode}
\end{table}
For \textsf{kmers\_subtract} and \textsf{reverse\_kmers\_subtract} equal $k$-mers will never be present in the output database, which is the reason of NONE values in \cref{table:defaults_counter_mode}.
\subsection*{example 1}
kmc -k28 file1.fastq kmers1 tmp \\
kmc -k28 file2.fastq kmers2 tmp \\
kmc\_tools simple kmers1 -ci10 -cx200 kmers2 -ci4 -cx100 intersect kmers1\_kmers2\_intersect -ci20 -cx150 \\
\subsection*{example 2}
kmc -k28 file1.fastq kmers1 tmp \\
kmc -k28 file2.fastq kmers2 tmp \\
kmc\_tools simple kmers1 kmers2 intersect inter\_k1\_k2\_max -ocmax intersect inter\_k1\_k2\_min union union\_k1\_k2 -ci10
|
// Copyright Oliver Kowalke 2009.
// 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)
#ifndef BOOST_COROUTINES_STACK_ALLOCATOR_H
#define BOOST_COROUTINES_STACK_ALLOCATOR_H
#include <boost/config.hpp>
#if defined (BOOST_WINDOWS)
#include <boost/coroutine/detail/stack_allocator_windows.hpp>
#else
#include <boost/coroutine/detail/stack_allocator_posix.hpp>
#endif
namespace boost {
namespace coroutines {
using detail::stack_allocator;
}}
#endif // BOOST_COROUTINES_STACK_ALLOCATOR_H
|
module Typing.TypeChecking
import Typing.Common
import Typing.Util
import Typing.Unification
export
inferify : Term -> TypeChecker Inferred
export
checkify : Term -> Term -> TypeChecker Term
export
checkifyCaseMotive : CaseMotive -> TypeChecker CaseMotive
export
checkifyPattern : Pattern -> Term -> TypeChecker (Pattern >< Term)
export
checkifyClause : Clause -> CaseMotive -> TypeChecker Clause
export
checkifyClauses : List Clause -> CaseMotive -> TypeChecker (List Clause)
-- Y8Y 8o 0 8YYYY 8YYYY 8YYYo Y8Y 8YYYY 0 0
-- 0 8Yo 8 8___ 8___ 8___P 0 8___ "o o"
-- 0 8 Yo8 8""" 8""" 8""Yo 0 8""" 0
-- o8o 0 8 0 8oooo 0 0 o8o 0 0
-- 8_ _8 8YYYY YY8YY o8o
-- ____ 8"o_o"8 8___ 0 8 8
-- """" 0 8 0 8""" 0 8YYY8
-- 0 0 8oooo 0 0 0
inferify (Meta i) = throw $ "The metavariable " ++ show (Meta i)
++ " appears in checkable code, when it should not."
-- 0 0 o8o 8YYYo
-- ____ 0 0 8 8 8___P
-- """" "o o" 8YYY8 8""Yo
-- "8" 0 0 0 0
inferify (Var (Name x0)) = do
((m,x),t) <- typeInDefinitions x0
pure $ AbsoluteDottedVar m x <:> t
inferify (Var (Generated x i)) = do
t <- typeInContext i
pure $ Var (Generated x i) <:> t
inferify (DottedVar m x) = do
((m',x'),t) <- dottedTypeInDefinitions m x
pure $ AbsoluteDottedVar m' x' <:> t
inferify (AbsoluteDottedVar m x) = do
((m',x'),t) <- absoluteDottedTypeInDefinitions m x
pure $ AbsoluteDottedVar m' x'<:> t
-- o8o 8o 0 8o 0
-- ____ 8 8 8Yo 8 8Yo 8
-- """" 8YYY8 8 Yo8 8 Yo8
-- 0 0 0 8 0 8
inferify (Ann m t) = do
t' <- checkify t Star
et' <- evaluate t'
m' <- checkify m et'
subs <- substitution
pure $ instantiateMetas subs m' <:> instantiateMetas subs et'
-- oYYYo YY8YY o8o 8YYYo
-- ____ %___ 0 8 8 8___P
-- """" `"""p 0 8YYY8 8""Yo
-- YoooY 0 0 0 0 0
inferify Star = pure $ Star <:> Star
-- 8YYYo Y8Y
-- ____ 8___P 0
-- """" 8""" 0
-- 0 o8o
inferify (Pi plic arg sc) = do
arg' <- checkify arg Star
i <- newName
case head' (names sc) of
Nothing => throw "Should not happen"
Just hsc => do
ret' <- extendContext [(i, hsc, arg')] $ checkify (instantiate sc [Var (Generated hsc i)]) Star
let sc' = the (Scope Term Term) $ NewScope (names sc) (abstractOver [i] ret')
subs <- substitution
pure $ instantiateMetas subs (Pi plic arg' sc') <:> Star
-- 0 o8o 8_ _8
-- ____ 0 8 8 8"o_o"8
-- """" 0 8YYY8 0 8 0
-- 8ooo 0 0 0 0
inferify (Lam _ _) = throw "Cannot infer the type of a lambda expression."
-- o8o 8YYYo 8YYYo
-- ____ 8 8 8___P 8___P
-- """" 8YYY8 8""" 8"""
-- 0 0 0 0
inferify (App plic f a) = do
(f0 <:> t0) <- inferify f
et0 <- evaluate t0
(app' <:> t') <- insertImplicits f0 plic et0
subs <- substitution
pure $ instantiateMetas subs app' <:> instantiateMetas subs t'
where
insertImplicits : Term -> Plict -> Term -> TypeChecker Inferred
insertImplicits f' Expl (Pi Expl arg sc) = do
earg <- evaluate arg
a' <- checkify a earg
pure $ App Expl f' a' <:> instantiate sc [a']
insertImplicits f' Impl (Pi Impl arg sc) = do
earg <- evaluate arg
a' <- checkify a earg
pure $ App Impl f' a' <:> instantiate sc [a']
insertImplicits f' Expl (Pi Impl _ sc) = do
meta <- newMetaVar
let impla = Meta meta
let newF' = App Impl f' impla
newT' <- evaluate (instantiate sc [impla])
insertImplicits newF' Expl newT'
insertImplicits _ Impl (Pi Expl _ _)
= throw $ "Expected an explicit argument but found an implicit argument "
++ "when applying " ++ show f ++ " to " ++ show a ++ " in "
++ "the expression " ++ show (App plic f a)
insertImplicits _ _ t
= throw $ "Cannot insert implicit arguments for non-function type " ++ show t
-- oYYo _YYY_ 8o 0
-- ____ 0 " 0 0 8Yo 8
-- """" 0 , 0 0 8 Yo8
-- YooY "ooo" 0 8
inferify (Con c as) = do
(unaliasedC,consig) <- typeInSignature c
(as' <:> ret) <- inferifyConArgs consig as consig
subs <- substitution
pure $ instantiateMetas subs (Con unaliasedC as') <:> instantiateMetas subs ret
where
inferifyConArgs : ConSig Term ->
List (Plict >< Term) ->
ConSig Term ->
TypeChecker (InferredF (List (Plict >< Term)) Term)
inferifyConArgs _ [] (ConSigNil ret) = pure $ [] <:> ret
inferifyConArgs consig ((Expl, m) :: ms) (ConSigCons Expl arg sc) = do
subs <- substitution
earg <- evaluate (instantiateMetas subs arg)
m' <- checkify m earg
(ms' <:> ret) <- inferifyConArgs consig ms (instantiate sc [m])
pure $ ((Expl,m') :: ms') <:> ret
inferifyConArgs consig ((Impl, m) :: ms) (ConSigCons Impl arg sc) = do
subs <- substitution
earg <- evaluate (instantiateMetas subs arg)
m' <- checkify m earg
(ms' <:> ret) <- inferifyConArgs consig ms (instantiate sc [m])
pure $ ((Impl,m') :: ms') <:> ret
inferifyConArgs consig ms (ConSigCons Impl _ sc) = do
meta <- newMetaVar
let implm = Meta meta
(ms' <:> ret) <- inferifyConArgs consig ms (instantiate sc [implm])
pure $ ((Impl,implm) :: ms') <:> ret
inferifyConArgs consig ((Impl,_) :: _) (ConSigCons Expl _ _)
= throw $ "Expected an explicit argument but found an implicit argument "
++ "when checking " ++ show (Con c as)
++ " matches the signature " ++ showConSig (Var . Name) consig
inferifyConArgs consig _ _ = do
let las = length as
let lsig = conSigLength (Var . Name) consig
throw $ show c ++ " expects " ++ show lsig ++ " "
++ (if lsig == 1 then "arg" else "args")
++ " but was given " ++ show las
-- oYYo o8o oYYYo 8YYYY
-- ____ 0 " 8 8 %___ 8___
-- """" 0 , 8YYY8 `"""p 8"""
-- YooY 0 0 YoooY 8oooo
inferify (Case ms0 mot cs) = do
mot' <- checkifyCaseMotive mot
ms0' <- checkifyCaseArgs ms0 mot'
cs' <- checkifyClauses cs mot'
ret <- auxMotive ms0' mot'
subs <- substitution
pure $ instantiateMetas subs (Case ms0' mot' cs') <:> instantiateMetas subs ret
where
checkifyCaseArgs : List Term -> CaseMotive -> TypeChecker (List Term)
checkifyCaseArgs [] (CaseMotiveNil _) = pure []
checkifyCaseArgs (m :: ms) (CaseMotiveCons a sc) = do
ea <- evaluate a
m' <- checkify m ea
ms' <- checkifyCaseArgs ms (instantiate sc [m])
pure $ (m' :: ms')
checkifyCaseArgs _ _ = do
let lms = length ms0
let lmot = caseMotiveLength mot
throw $ "Motive " ++ show mot ++ " expects " ++ show lmot ++ " case "
++ (if lmot == 1 then "arg" else "args")
++ " but was given " ++ show lms
auxMotive : List Term -> CaseMotive -> TypeChecker Term
auxMotive [] (CaseMotiveNil a) = pure a
auxMotive (m :: ms) (CaseMotiveCons _ sc) = auxMotive ms (instantiate sc [m])
auxMotive _ _ = do
let lms = length ms0
let lmot = caseMotiveLength mot
throw $ "Motive " ++ show mot ++ " expects " ++ show lmot ++ " case "
++ (if lmot == 1 then "arg" else "args")
++ " but was given " ++ show lms
-- 8YYYo 8YYYY oYYo _YYY_ 8YYYo 8888_ YY8YY 0 0 8YYYo 8YYYY
-- ____ 8___P 8___ 0 " 0 0 8___P 0 0 0 "o o" 8___P 8___
-- """" 8""Yo 8""" 0 , 0 0 8""Yo 0 0 0 0 8""" 8"""
-- 0 0 8oooo YooY "ooo" 0 0 8oooY 0 0 0 8oooo
inferify (RecordType tele) = do
tele' <- checkifyTelescope tele
pure $ RecordType tele' <:> Star
where
checkifyTelescope : Telescope -> TypeChecker Telescope
checkifyTelescope TelescopeNil = pure TelescopeNil
checkifyTelescope (TelescopeCons t sc) = do
t' <- checkify t Star
i <- newName
case head' (names sc) of
Nothing => throw "Should not happen"
Just hsc => do
m' <- extendContext [(i, hsc, t')]
$ checkifyTelescope (instantiate sc [Var (Generated hsc i)])
pure $ TelescopeCons t' (NewScope (names sc) (abstractOver [i] m'))
-- 8YYYo 8YYYY oYYo _YYY_ 8YYYo 8888_ oYYo _YYY_ 8o 0
-- ____ 8___P 8___ 0 " 0 0 8___P 0 0 0 " 0 0 8Yo 8
-- """" 8""Yo 8""" 0 , 0 0 8""Yo 0 0 0 , 0 0 8 Yo8
-- 0 0 8oooo YooY "ooo" 0 0 8oooY YooY "ooo" 0 8
inferify (RecordCon _) = throw "Cannot infer the type of a record expression."
-- 8YYYo 8YYYY oYYo _YYY_ 8YYYo 8888_ 8888_ _YYY_ YY8YY
-- ____ 8___P 8___ 0 " 0 0 8___P 0 0 0 0 0 0 0
-- """" 8""Yo 8""" 0 , 0 0 8""Yo 0 0 0 0 0 0 0
-- 0 0 8oooo YooY "ooo" 0 0 8oooY 8oooY "ooo" 0
inferify (Project m x) = do
(m' <:> t) <- inferify m
et <- evaluate t
case et of
RecordType tele => case lookupField m' x tele of
Nothing => throw $ "Missing field " ++ x
Just t' => pure $ Project m' x <:> t'
t' => throw $ "Expecting a record type but found " ++ show t'
where
lookupField : Term -> String -> Telescope -> Maybe Term
lookupField _ _ TelescopeNil = Nothing
lookupField m' f (TelescopeCons t sc) with (head' $ names sc)
| Nothing = Nothing
| Just (hsc) with (f == hsc)
| True = Just t
| _ = lookupField m' f $ instantiate sc [Project m' hsc]
-- oYYo 0 0 8YYYY oYYo 0 oY Y8Y 8YYYY 0 0
-- 0 " 8___8 8___ 0 " 8_oY 0 8___ "o o"
-- 0 , 8"""8 8""" 0 , 8"Yo 0 8""" 0
-- YooY 0 0 8oooo YooY 0 Yo o8o 0 0
-- 8_ _8 8YYYY YY8YY o8o
-- ____ 8"o_o"8 8___ 0 8 8
-- """" 0 8 0 8""" 0 8YYY8
-- 0 0 8oooo 0 0 0
checkify (Meta i) _ = throw $ "The metavariable " ++ show (Meta i)
++ " appears in checkable code, when it should not."
-- 0 o8o 8_ _8 8YYYo Y8Y
-- ____ 0 8 8 8"o_o"8 88 8___P 0
-- """" 0 8YYY8 0 8 0 8""" 0
-- 8ooo 0 0 0 0 88 0 o8o
checkify (Lam plic sc) t = do
et <- evaluate t
case (head' (names sc), plic, et) of
(Just hsc, Expl, Pi Expl arg sc') => do-- \x -> M : (x : A) -> B
i <- newName
eret <- evaluate (instantiate sc' [Var (Generated hsc i)])
m' <- extendContext [(i, hsc, arg)] $ checkify (instantiate sc [Var (Generated hsc i)]) eret
subs <- substitution
pure $ instantiateMetas subs (Lam Expl (NewScope (names sc) (abstractOver [i] m')))
(Just hsc, Impl, Pi Impl arg sc') => do -- \{y} -> M : {y : A} -> B
i <- newName
eret <- evaluate (instantiate sc' [Var (Generated hsc i)])
m' <- extendContext [(i, hsc, arg)] $ checkify (instantiate sc [Var (Generated hsc i)]) eret
subs <- substitution
pure $ instantiateMetas subs (Lam Impl (NewScope (names sc) (abstractOver [i] m')))
(Just hsc, Expl, Pi Impl arg sc') => do -- \x -> M : {y : A} -> B
i <- newName
eret <- evaluate (instantiate sc' [Var (Generated hsc i)])
f' <- extendContext [(i, hsc, arg)] $ checkify (Lam Expl sc) eret
subs <- substitution
pure $ instantiateMetas subs (Lam Impl (NewScope ["_"] (abstractOver (the (List String) []) f')))
(Just hsc, Impl, Pi Expl _ _) => -- \{y} -> M : (x : A) -> B
throw $ "Expected an explicit argument but found an implicit argument "
++ "when checking " ++ show (Lam plic sc)
++ " matches the signature " ++ show t
_ => throw $ "Cannot check term: " ++ show (Lam plic sc) ++ "\n"
++ "Against non-function type: " ++ show t
-- oYYo _YYY_ 8o 0 YY8YY
-- ____ 0 " 0 0 8Yo 8 88 0
-- """" 0 , 0 0 8 Yo8 0
-- YooY "ooo" 0 8 88 0
checkify (Con c as) t = do
(unaliasedC,consig) <- typeInSignature c
(ats, ret) <- dropConArgs as consig
unify t ret
as' <- traverse checkifyConArg ats
subs <- substitution
pure $ instantiateMetas subs (Con unaliasedC as')
where
dropConArgs : List (Plict >< Term) -> ConSig Term ->
TypeChecker (List ((Plict >< Term) \/ (Plict >< Term >< Term)) >< Term)
dropConArgs [] (ConSigNil ret) = pure ([], ret)
dropConArgs ((Expl,m) :: ms) (ConSigCons Expl arg sc) = do
(ats,ret) <- dropConArgs ms (instantiate sc [m])
pure (Right (Expl,m,arg) :: ats, ret)
dropConArgs ((Impl,m) :: ms) (ConSigCons Impl arg sc) = do
(ats,ret) <- dropConArgs ms (instantiate sc [m])
pure (Right (Impl,m,arg) :: ats, ret)
dropConArgs ms (ConSigCons Impl _ sc) = do
meta <- newMetaVar
let x = Meta meta
(ats, ret) <- dropConArgs ms (instantiate sc [x])
pure (Left (Impl,x) :: ats,ret)
dropConArgs ((Impl,_) :: _) (ConSigCons Expl _ _)
= throw $ "Mismatching plicits when checking " ++ show (Con c as)
++ " has type " ++ show t
dropConArgs _ _
= throw $ "Mismatching number of arguments when checking " ++ show (Con c as)
++ " has type " ++ show t
checkifyConArg : (Plict >< Term) \/ (Plict >< Term >< Term) -> TypeChecker (Plict >< Term)
checkifyConArg (Left pm) = pure pm
checkifyConArg (Right (plic, m, arg)) = do
subs <- substitution
earg <- evaluate (instantiateMetas subs arg)
m' <- checkify m earg
pure (plic,m')
-- 8YYYo 8YYYY oYYo _YYY_ 8YYYo 8888_
-- ____ 8___P 8___ 0 " 0 0 8___P 0 0
-- """" 8""Yo 8""" 0 , 0 0 8""Yo 0 0
-- 0 0 8oooo YooY "ooo" 0 0 8oooY
checkify (RecordCon fields) t = case t of
RecordType tele => do
fields' <- checkifyFields fields tele
pure $ RecordCon fields'
_ => throw $ "Cannot check a record against type " ++ show t
where
checkifyFields : List (String >< Term) -> Telescope -> TypeChecker (List (String >< Term))
checkifyFields [] TelescopeNil = pure []
checkifyFields [] (TelescopeCons _ sc) = throw $ "Missing record field " ++ unwords (names sc)
checkifyFields _ TelescopeNil = throw $ "Mismatching number of record fields."
checkifyFields xs (TelescopeCons t' sc) with (head' (names sc))
| Nothing = throw "Incorrect record field."
| Just hsc with (extract (\(x',_) => x' == hsc) xs)
| Nothing = throw $ "Missing record field " ++ unwords (names sc)
| Just ((x',m),xs') = do
et' <- evaluate t'
m' <- checkify m et'
fields' <- checkifyFields xs' (instantiate sc [m'])
pure $ (x',m') :: fields'
-- oYYo 8YYYY 8o 0 8YYYY 8YYYo o8o 0
-- ____ 0 __ 8___ 8Yo 8 8___ 8___P 8 8 0
-- """" 0 "8 8""" 8 Yo8 8""" 8""Yo 8YYY8 0
-- YooY 8oooo 0 8 8oooo 0 0 0 0 8ooo
checkify m t = do
(m' <:> t') <- inferify m
et <- evaluate t
et' <- evaluate t'
m'' <- subtype m' et' et
subs <- substitution
pure $ instantiateMetas subs m''
where
subtype : Term -> Term -> Term -> TypeChecker Term
subtype m (Pi Expl a sc) (Pi Expl a' sc') = do
unify a a'
subs <- substitution
i <- newName
case (head' $ names sc) of
Just hsc => do
let b = instantiateMetas subs (instantiate sc [Var (Generated hsc i)])
let b' = instantiateMetas subs (instantiate sc' [Var (Generated hsc i)])
subtype m b b'
Nothing => throw "Should not happen"
subtype m (Pi Expl a sc) (Pi Impl a' sc')
= throw $ "The type " ++ show (Pi Expl a sc)
++ " is not a subtype of " ++ show (Pi Impl a' sc')
subtype m (Pi Impl a sc) (Pi Expl a' sc') = do
i <- newMetaVar
subs <- substitution
let b = instantiate sc [Meta i]
subtype (App Impl m (Meta i)) b (Pi Expl a' sc')
subtype m (Pi Impl a sc) (Pi Impl a' sc') = do
unify a a'
i <- newName
subs <- substitution
case (head' $ names sc) of
Just hsc => do
let b = instantiateMetas subs (instantiate sc [Var (Generated hsc i)])
let b' = instantiateMetas subs (instantiate sc' [Var (Generated hsc i)])
subtype m b b'
Nothing => throw "Should not happen"
subtype m t t' = do
unify t t'
pure m
-- oYYo 0 0 8YYYY oYYo 0 oY Y8Y 8YYYY 0 0 oYYo o8o oYYYo 8YYYY 8_ _8 _YYY_ YY8YY Y8Y 0 0 8YYYY
-- 0 " 8___8 8___ 0 " 8_oY 0 8___ "o o" 0 " 8 8 %___ 8___ 8"o_o"8 0 0 0 0 0 0 8___
-- 0 , 8"""8 8""" 0 , 8"Yo 0 8""" 0 0 , 8YYY8 `"""p 8""" 0 8 0 0 0 0 0 "o o" 8"""
-- YooY 0 0 8oooo YooY 0 Yo o8o 0 0 YooY 0 0 YoooY 8oooo 0 0 "ooo" 0 o8o "8" 8oooo
checkifyCaseMotive (CaseMotiveNil a) = do
a' <- checkify a Star
pure $ CaseMotiveNil a'
checkifyCaseMotive (CaseMotiveCons a sc) with (head' $ names sc)
| Just hsc = do
a' <- checkify a Star
i <- newName
b' <- extendContext [(i, hsc, a')]
$ checkifyCaseMotive (instantiate sc [Var (Generated hsc i)])
subs <- substitution
pure $ instantiateMetasCaseMotive subs
$ CaseMotiveCons a' $ NewScope (names sc) (abstractOver [i] b')
| Nothing = throw "Should not happen"
-- oYYo 0 0 8YYYY oYYo 0 oY Y8Y 8YYYY 0 0 8YYYo o8o YY8YY YY8YY 8YYYY 8YYYo 8o 0
-- 0 " 8___8 8___ 0 " 8_oY 0 8___ "o o" 8___P 8 8 0 0 8___ 8___P 8Yo 8
-- 0 , 8"""8 8""" 0 , 8"Yo 0 8""" 0 8""" 8YYY8 0 0 8""" 8""Yo 8 Yo8
-- YooY 0 0 8oooo YooY 0 Yo o8o 0 0 0 0 0 0 0 8oooo 0 0 0 8
checkifyPattern (VarPat (Name x)) _ = pure (VarPat (Name x), Var (Name x))
checkifyPattern (VarPat (Generated x i)) t = do
t' <- typeInContext i
unify t t'
pure (VarPat (Generated x i), Var (Generated x i))
checkifyPattern (ConPat _ _) Star = throw "Cannot pattern match on a type."
checkifyPattern (ConPat c ps0) t = do
(unaliasedC,sig) <- typeInSignature c
(ps',xs,ret) <- checkifyPatConArgs sig ps0 sig
subs <- substitution
et <- evaluate (instantiateMetas subs t)
eret <- evaluate (instantiateMetas subs ret)
unify et eret
subs' <- substitution
pure (instantiateMetasPat subs' (ConPat unaliasedC ps'), instantiateMetas subs' (Con unaliasedC xs))
where
checkifyPatConArgs : ConSig Term -> List (Plict >< Pattern) ->
ConSig Term -> TypeChecker (List (Plict >< Pattern) >< List (Plict >< Term) >< Term)
checkifyPatConArgs _ [] (ConSigNil ret) = pure ([],[],ret)
checkifyPatConArgs consig ((Expl,p) :: ps) (ConSigCons Expl arg sc') = do
earg <- evaluate arg
(p',x) <- checkifyPattern p earg
(ps', xs, ret) <- checkifyPatConArgs consig ps (instantiate sc' [x])
pure ((Expl,p') :: ps', (Expl,x) :: xs, ret)
checkifyPatConArgs consig ((Impl,p) :: ps) (ConSigCons Impl arg sc') = do
earg <- evaluate arg
(p',x) <- checkifyPattern p earg
(ps',xs,ret) <- checkifyPatConArgs consig ps (instantiate sc' [x])
pure ((Impl,p') :: ps', (Impl,x) :: xs, ret)
checkifyPatConArgs consig ps (ConSigCons Impl _ sc') = do
meta <- newMetaVar
let x = Meta meta
(ps',xs,ret) <- checkifyPatConArgs consig ps (instantiate sc' [x])
pure ((Impl,AssertionPat x) :: ps', (Impl,x) :: xs, ret)
checkifyPatConArgs consig ((Impl,_) :: _) (ConSigCons Expl _ _)
= throw $ "Expected an explicit argument but found an implicit argument "
++ "when checking " ++ show (ConPat c ps0)
++ " matches the signature " ++ showConSig (Var . Name) consig
checkifyPatConArgs consig _ _ = do
let lps = length ps0
let lsig = conSigLength (Var . Name) consig
throw $ show c ++ " expects " ++ show lsig ++ " case "
++ (if lsig == 1 then "arg" else "args")
++ " but was given " ++ show lps
checkifyPattern (AssertionPat m) t = do
m' <- checkify m t
subs <- substitution
let m'' = instantiateMetas subs m'
pure (AssertionPat m'', m'')
checkifyPattern MakeMeta _ = throw $ show MakeMeta ++ " should not appear in a checkable pattern."
-- oYYo 0 0 8YYYY oYYo 0 oY Y8Y 8YYYY 0 0 oYYo 0 o8o 0 0 oYYYo 8YYYY
-- 0 " 8___8 8___ 0 " 8_oY 0 8___ "o o" 0 " 0 8 8 0 0 %___ 8___
-- 0 , 8"""8 8""" 0 , 8"Yo 0 8""" 0 0 , 0 8YYY8 0 0 `"""p 8"""
-- YooY 0 0 8oooo YooY 0 Yo o8o 0 0 YooY 8ooo 0 0 "ooo" YoooY 8oooo
checkifyClause (NewClause psc sc0) motive = do
ctx <- Traversable.for (names psc) $ \x => do
i <- newName
m <- newMetaVar
pure (i, x, Meta m)
let is = [ i | (i,_,_) <- ctx ]
let xs1 = zipWith Generated (names psc) is
let xs2 = map Var (removeByDummies (names psc) xs1)
extendContext ctx $ do
let ps = instantiate psc xs1
(ps',ret) <- checkPatternsMotive ps motive
subs <- substitution
eret <- evaluate (instantiateMetas subs ret)
m' <- checkify (instantiate sc0 xs2) eret
subs' <- substitution
let ps'' = map (instantiateMetasPat subs') ps'
let psWithMsToBind = [ p | (MakeMeta, AssertionPat p) <- zip ps ps'' ]
let msToBind = nub (psWithMsToBind >>= metas)
newSubs <- Traversable.for msToBind $ \m => do
i <- newName
pure (m, Var (Generated ("_" ++ show i) i))
addSubstitutions newSubs
subs'' <- substitution
let newPs = bindersByNewMetas ps (map (instantiateMetasPat subs'') ps'')
let newVars = newPs >>= patternVars
let (newNames, newIs) = unzip $ the (List $ String >< Int) $ do
Generated x i <- newVars | _ => []
pure (x, i)
let newM = instantiateMetas subs'' m'
pure $ NewClause (NewScope newNames (abstractOver newIs newPs))
$ NewScope (removeByDummies newNames newNames)
$ abstractOver (removeByDummies newNames newIs) newM
where
bindersByNewMetas : List Pattern -> List Pattern -> List Pattern
bindersByNewMetas [] [] = []
bindersByNewMetas (MakeMeta :: guides) (AssertionPat x :: ps)
= termToPattern x :: bindersByNewMetas guides ps
bindersByNewMetas (_ :: guides) (p :: ps) = p :: bindersByNewMetas guides ps
checkPatternsMotive : List Pattern -> CaseMotive -> TypeChecker (List Pattern >< Term)
checkPatternsMotive [] (CaseMotiveNil ret) = pure ([],ret)
checkPatternsMotive (MakeMeta :: ps) (CaseMotiveCons _ sc') = do
m <- newMetaVar
(ps',ret) <- checkPatternsMotive ps (instantiate sc' [Meta m])
pure (AssertionPat (Meta m) :: ps', ret)
checkPatternsMotive (p :: ps) (CaseMotiveCons arg sc') = do
earg <- evaluate arg
(p', x) <- checkifyPattern p earg
(ps', ret) <- checkPatternsMotive ps (instantiate sc' [x])
pure (p'::ps', ret )
checkPatternsMotive _ _ = do
let lps = length (descope Name psc)
let lmot = caseMotiveLength motive
throw $ "Motive " ++ show motive ++ " expects " ++ show lmot ++ " case "
++ (if lmot == 1 then "arg" else "args")
++ " but was given " ++ show lps
-- oYYo 0 0 8YYYY oYYo 0 oY Y8Y 8YYYY 0 0 oYYo 0 o8o 0 0 oYYYo 8YYYY oYYYo
-- 0 " 8___8 8___ 0 " 8_oY 0 8___ "o o" 0 " 0 8 8 0 0 %___ 8___ %___
-- 0 , 8"""8 8""" 0 , 8"Yo 0 8""" 0 0 , 0 8YYY8 0 0 `"""p 8""" `"""p
-- YooY 0 0 8oooo YooY 0 Yo o8o 0 0 YooY 8ooo 0 0 "ooo" YoooY 8oooo YoooY
checkifyClauses [] _ = pure []
checkifyClauses (c :: cs) motive = do
c' <- checkifyClause c motive
cs' <- checkifyClauses cs motive
pure $ c' :: cs'
-- oYYo 0 0 8YYYY oYYo 0 oY Y8Y 8YYYY 0 0 oYYo _YYY_ 8o 0 oYYYo Y8Y oYYo
-- 0 " 8___8 8___ 0 " 8_oY 0 8___ "o o" 0 " 0 0 8Yo 8 %___ 0 0 __
-- 0 , 8"""8 8""" 0 , 8"Yo 0 8""" 0 0 , 0 0 8 Yo8 `"""p 0 0 "8
-- YooY 0 0 8oooo YooY 0 Yo o8o 0 0 YooY "ooo" 0 8 YoooY o8o YooY
export
checkifyConSig : ConSig Term -> TypeChecker (ConSig Term)
checkifyConSig (ConSigNil ret) = do
ret' <- checkify ret Star
pure $ ConSigNil ret'
checkifyConSig (ConSigCons plic arg sc) with (head' $ names sc)
| Just hsc = do
arg' <- checkify arg Star
i <- newName
t <- extendContext [(i, hsc, arg')]
$ checkifyConSig (instantiate sc [Var (Generated hsc i)])
pure $ ConSigCons plic arg' (NewScope (names sc) (abstractOver [i] t))
| Nothing = throw "Should not happen"
-- 8YYYo 0 0 8888. 0 Y8Y oYYo 8YYYY 0 0 8o 0 oYYo YY8YY Y8Y _YYY_ 8o 0 oYYYo
-- 8___P 0 0 8___Y 0 0 0 " 8___ 0 0 8Yo 8 0 " 0 0 0 0 8Yo 8 %___
-- 8""" 0 0 8"""o 0 0 0 , 8""" 0 0 8 Yo8 0 , 0 0 0 0 8 Yo8 `"""p
-- 0 "ooo" 8ooo" 8ooo o8o YooY 0 "ooo" 0 8 YooY 0 o8o "ooo" 0 8 YoooY
export
metasSolved : TypeChecker ()
metasSolved = do
s <- get
unless (tcNextMeta s == cast (length $ tcSubs s))
$ throw "Not all metavariables have been solved."
export
check : Term -> Term -> TypeChecker Term
check m t = do
et <- evaluate t
m' <- checkify m et
metasSolved
subs <- substitution
pure $ instantiateMetas subs m'
export
infer : Term -> TypeChecker Inferred
infer m = do
(m' <:> t) <- inferify m
metasSolved
subs <- substitution
et <- evaluate (instantiateMetas subs t)
pure $ instantiateMetas subs m' <:> et
|
/-
Copyright (c) 2019 Reid Barton. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Reid Barton, Scott Morrison
Facts about epimorphisms and monomorphisms.
The definitions of `epi` and `mono` are in `category_theory.category`,
since they are used by some lemmas for `iso`, which is used everywhere.
-/
import Mathlib.PrePort
import Mathlib.Lean3Lib.init.default
import Mathlib.category_theory.adjunction.basic
import Mathlib.category_theory.opposites
import Mathlib.PostPort
universes v₁ v₂ u₁ u₂ l
namespace Mathlib
namespace category_theory
theorem left_adjoint_preserves_epi {C : Type u₁} [category C] {D : Type u₂} [category D] {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G) {X : C} {Y : C} {f : X ⟶ Y} (hf : epi f) : epi (functor.map F f) := sorry
theorem right_adjoint_preserves_mono {C : Type u₁} [category C] {D : Type u₂} [category D] {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G) {X : D} {Y : D} {f : X ⟶ Y} (hf : mono f) : mono (functor.map G f) := sorry
theorem faithful_reflects_epi {C : Type u₁} [category C] {D : Type u₂} [category D] (F : C ⥤ D) [faithful F] {X : C} {Y : C} {f : X ⟶ Y} (hf : epi (functor.map F f)) : epi f := sorry
theorem faithful_reflects_mono {C : Type u₁} [category C] {D : Type u₂} [category D] (F : C ⥤ D) [faithful F] {X : C} {Y : C} {f : X ⟶ Y} (hf : mono (functor.map F f)) : mono f := sorry
/--
A split monomorphism is a morphism `f : X ⟶ Y` admitting a retraction `retraction f : Y ⟶ X`
such that `f ≫ retraction f = 𝟙 X`.
Every split monomorphism is a monomorphism.
-/
class split_mono {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y)
where
retraction : Y ⟶ X
id' : autoParam (f ≫ retraction = 𝟙)
(Lean.Syntax.ident Lean.SourceInfo.none (String.toSubstring "Mathlib.obviously")
(Lean.Name.mkStr (Lean.Name.mkStr Lean.Name.anonymous "Mathlib") "obviously") [])
/--
A split epimorphism is a morphism `f : X ⟶ Y` admitting a section `section_ f : Y ⟶ X`
such that `section_ f ≫ f = 𝟙 Y`.
(Note that `section` is a reserved keyword, so we append an underscore.)
Every split epimorphism is an epimorphism.
-/
class split_epi {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y)
where
section_ : Y ⟶ X
id' : autoParam (section_ ≫ f = 𝟙)
(Lean.Syntax.ident Lean.SourceInfo.none (String.toSubstring "Mathlib.obviously")
(Lean.Name.mkStr (Lean.Name.mkStr Lean.Name.anonymous "Mathlib") "obviously") [])
/-- The chosen retraction of a split monomorphism. -/
def retraction {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [split_mono f] : Y ⟶ X :=
split_mono.retraction f
@[simp] theorem split_mono.id_assoc {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [split_mono f] {X' : C} (f' : X ⟶ X') : f ≫ retraction f ≫ f' = f' := sorry
/-- The retraction of a split monomorphism is itself a split epimorphism. -/
protected instance retraction_split_epi {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [split_mono f] : split_epi (retraction f) :=
split_epi.mk f
/-- A split mono which is epi is an iso. -/
def is_iso_of_epi_of_split_mono {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [split_mono f] [epi f] : is_iso f :=
is_iso.mk (retraction f)
/--
The chosen section of a split epimorphism.
(Note that `section` is a reserved keyword, so we append an underscore.)
-/
def section_ {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [split_epi f] : Y ⟶ X :=
split_epi.section_ f
@[simp] theorem split_epi.id_assoc {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [split_epi f] {X' : C} (f' : Y ⟶ X') : section_ f ≫ f ≫ f' = f' := sorry
/-- The section of a split epimorphism is itself a split monomorphism. -/
protected instance section_split_mono {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [split_epi f] : split_mono (section_ f) :=
split_mono.mk f
/-- A split epi which is mono is an iso. -/
def is_iso_of_mono_of_split_epi {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [mono f] [split_epi f] : is_iso f :=
is_iso.mk (section_ f)
/-- Every iso is a split mono. -/
protected instance split_mono.of_iso {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [is_iso f] : split_mono f :=
split_mono.mk (inv f)
/-- Every iso is a split epi. -/
protected instance split_epi.of_iso {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [is_iso f] : split_epi f :=
split_epi.mk (inv f)
/-- Every split mono is a mono. -/
protected instance split_mono.mono {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [split_mono f] : mono f := sorry
/-- Every split epi is an epi. -/
protected instance split_epi.epi {C : Type u₁} [category C] {X : C} {Y : C} (f : X ⟶ Y) [split_epi f] : epi f :=
epi.mk
fun (Z : C) (g h : Y ⟶ Z) (w : f ≫ g = f ≫ h) =>
eq.mpr (id (Eq.refl (g = h)))
(eq.mp
((fun (a a_1 : Y ⟶ Z) (e_1 : a = a_1) (ᾰ ᾰ_1 : Y ⟶ Z) (e_2 : ᾰ = ᾰ_1) => congr (congr_arg Eq e_1) e_2)
(section_ f ≫ f ≫ g) g (split_epi.id_assoc f g) (section_ f ≫ f ≫ h) h (split_epi.id_assoc f h))
(section_ f ≫= w))
/-- Every split mono whose retraction is mono is an iso. -/
def is_iso.of_mono_retraction {C : Type u₁} [category C] {X : C} {Y : C} {f : X ⟶ Y} [split_mono f] [mono (retraction f)] : is_iso f :=
is_iso.mk (retraction f)
/-- Every split epi whose section is epi is an iso. -/
def is_iso.of_epi_section {C : Type u₁} [category C] {X : C} {Y : C} {f : X ⟶ Y} [split_epi f] [epi (section_ f)] : is_iso f :=
is_iso.mk (section_ f)
protected instance unop_mono_of_epi {C : Type u₁} [category C] {A : Cᵒᵖ} {B : Cᵒᵖ} (f : A ⟶ B) [epi f] : mono (has_hom.hom.unop f) :=
mono.mk
fun (Z : C) (g h : Z ⟶ opposite.unop B) (eq : g ≫ has_hom.hom.unop f = h ≫ has_hom.hom.unop f) =>
has_hom.hom.op_inj (iff.mp (cancel_epi f) (has_hom.hom.unop_inj eq))
protected instance unop_epi_of_mono {C : Type u₁} [category C] {A : Cᵒᵖ} {B : Cᵒᵖ} (f : A ⟶ B) [mono f] : epi (has_hom.hom.unop f) :=
epi.mk
fun (Z : C) (g h : opposite.unop A ⟶ Z) (eq : has_hom.hom.unop f ≫ g = has_hom.hom.unop f ≫ h) =>
has_hom.hom.op_inj (iff.mp (cancel_mono f) (has_hom.hom.unop_inj eq))
protected instance op_mono_of_epi {C : Type u₁} [category C] {A : C} {B : C} (f : A ⟶ B) [epi f] : mono (has_hom.hom.op f) :=
mono.mk
fun (Z : Cᵒᵖ) (g h : Z ⟶ opposite.op B) (eq : g ≫ has_hom.hom.op f = h ≫ has_hom.hom.op f) =>
has_hom.hom.unop_inj (iff.mp (cancel_epi f) (has_hom.hom.op_inj eq))
protected instance op_epi_of_mono {C : Type u₁} [category C] {A : C} {B : C} (f : A ⟶ B) [mono f] : epi (has_hom.hom.op f) :=
epi.mk
fun (Z : Cᵒᵖ) (g h : opposite.op A ⟶ Z) (eq : has_hom.hom.op f ≫ g = has_hom.hom.op f ≫ h) =>
has_hom.hom.unop_inj (iff.mp (cancel_mono f) (has_hom.hom.op_inj eq))
/-- Split monomorphisms are also absolute monomorphisms. -/
protected instance functor.map.split_mono {C : Type u₁} [category C] {D : Type u₂} [category D] {X : C} {Y : C} (f : X ⟶ Y) [split_mono f] (F : C ⥤ D) : split_mono (functor.map F f) :=
split_mono.mk (functor.map F (retraction f))
/-- Split epimorphisms are also absolute epimorphisms. -/
protected instance functor.map.split_epi {C : Type u₁} [category C] {D : Type u₂} [category D] {X : C} {Y : C} (f : X ⟶ Y) [split_epi f] (F : C ⥤ D) : split_epi (functor.map F f) :=
split_epi.mk (functor.map F (section_ f))
|
-- Jesper, 2017-01-23: when instantiating a variable during unification,
-- we should check that the type of the variable is equal to the type
-- of the equation (and not just a subtype of it). See Issue 2407.
open import Agda.Builtin.Equality
open import Agda.Builtin.Size
data D : Size → Set where
J= : ∀ {ℓ} {s : Size} (x₀ : D s)
→ (P : (x : D s) → _≡_ {A = D s} x₀ x → Set ℓ)
→ P x₀ refl → (x : D s) (e : _≡_ {A = D s} x₀ x) → P x e
J= _ P p _ refl = p
J< : ∀ {ℓ} {s : Size} {s' : Size< s} (x₀ : D s)
→ (P : (x : D s) → _≡_ {A = D s} x₀ x → Set ℓ)
→ P x₀ refl → (x : D s') (e : _≡_ {A = D s} x₀ x) → P x e
J< _ P p _ refl = p
J> : ∀ {ℓ} {s : Size} {s' : Size< s} (x₀ : D s')
→ (P : (x : D s) → _≡_ {A = D s} x₀ x → Set ℓ)
→ P x₀ refl → (x : D s) (e : _≡_ {A = D s} x₀ x) → P x e
J> _ P p _ refl = p
J~ : ∀ {ℓ} {s : Size} {s' s'' : Size< s} (x₀ : D s')
→ (P : (x : D s) → _≡_ {A = D s} x₀ x → Set ℓ)
→ P x₀ refl → (x : D s'') (e : _≡_ {A = D s} x₀ x) → P x e
J~ _ P p _ refl = p
|
{-
Module in which the Grothendieck Group ("Groupification") of a commutative monoid is defined.
-}
{-# OPTIONS --safe #-}
module Cubical.Algebra.CommMonoid.GrothendieckGroup where
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Structure
open import Cubical.Algebra.Monoid
open import Cubical.Algebra.CommMonoid
open import Cubical.Algebra.CommMonoid.CommMonoidProd
open import Cubical.Algebra.Group
open import Cubical.Algebra.Group.Morphisms
open import Cubical.Algebra.AbGroup
open import Cubical.HITs.SetQuotients.Base
open import Cubical.HITs.SetQuotients.Properties
open import Cubical.Relation.Binary.Base
private
variable
ℓ ℓ' : Level
module _ (M : CommMonoid ℓ) where
open BinaryRelation
M² : CommMonoid _
M² = CommMonoidProd M M
open CommMonoidStr ⦃...⦄
private
instance
_ = snd M
_ = snd M²
R : ⟨ M² ⟩ → ⟨ M² ⟩ → Type _
R (a₁ , b₁) (a₂ , b₂) = Σ[ k ∈ ⟨ M ⟩ ] k · (a₁ · b₂) ≡ k · (b₁ · a₂)
M²/R : Type _
M²/R = ⟨ M² ⟩ / R
0/R : M²/R
0/R = [ ε , ε ]
private
_+/_ : M²/R → M²/R → M²/R
x +/ y = setQuotBinOp isReflR isReflR _·_ isCongR x y
where
isReflR : isRefl R
isReflR (a , b) = ε , cong (ε ·_) (·Comm a b)
isCongR : ∀ u u' v v' → R u u' → R v v' → R (u · v) (u' · v')
isCongR (a₁ , b₁) (a₂ , b₂) (a₃ , b₃) (a₄ , b₄) (k , p) (s , q) = k · s , proof
where
proof =
(k · s) · ((a₁ · a₃) · (b₂ · b₄)) ≡⟨ lemma ⟩
(k · (a₁ · b₂)) · (s · (a₃ · b₄)) ≡⟨ cong₂ _·_ p q ⟩
(k · (b₁ · a₂)) · (s · (b₃ · a₄)) ≡⟨ sym lemma ⟩
(k · s) · ((b₁ · b₃) · (a₂ · a₄)) ∎
where
rExp : ∀ {x y z} → x ≡ y → x · z ≡ y · z
rExp r = cong₂ _·_ r refl
lExp : ∀ {x y z} → x ≡ y → z · x ≡ z · y
lExp r = cong₂ _·_ refl r
-- remove proof when MonoidSolver is done
lemma : ∀ {k s a b c d} → (k · s) · ((a · b) · (c · d)) ≡ (k · (a · c)) · (s · (b · d))
lemma = sym (·Assoc _ _ _) ∙ lExp (
(·Assoc _ _ _) ∙ (·Assoc _ _ _) ∙ rExp (
·Comm _ _ ∙ (·Assoc _ _ _) ∙ (·Assoc _ _ _) ∙ rExp (
·Comm _ _ ∙ (·Assoc _ _ _)
) ∙ sym (·Assoc _ _ _)
) ∙ sym (·Assoc _ _ _) ∙ lExp (sym (·Assoc _ _ _))
) ∙ (·Assoc _ _ _)
-/_ : M²/R → M²/R
-/_ = setQuotUnaryOp swap h
where
swap : ⟨ M² ⟩ → ⟨ M² ⟩
swap = λ (a , b) → b , a
h : ∀ u v → R u v → R (swap u) (swap v)
h _ _ (k , p) = k , sym p
assoc/R : (x y z : M²/R) → x +/ ( y +/ z) ≡ (x +/ y) +/ z
assoc/R = elimProp3 (λ x y z → squash/ _ _) (λ u v w → cong [_] (·Assoc _ _ _))
rid/R : (x : M²/R) → x +/ 0/R ≡ x
rid/R = elimProp (λ x → squash/ _ _) (λ u → cong [_] (·IdR u))
rinv/R : (x : M²/R) → x +/ (-/ x) ≡ 0/R
rinv/R = elimProp (λ x → squash/ _ _)
(λ (a , b) → eq/ _ _ (ε , cong (λ x → ε · (x · ε)) (·Comm _ _)))
comm/R : (x y : M²/R) → x +/ y ≡ y +/ x
comm/R = elimProp2 (λ x y → squash/ _ _) (λ u v → cong [_] (·Comm _ _))
asAbGroup : AbGroup ℓ
asAbGroup = makeAbGroup 0/R _+/_ -/_ squash/ assoc/R rid/R rinv/R comm/R
Groupification : CommMonoid ℓ → AbGroup ℓ
Groupification M = asAbGroup M
module UniversalProperty (M : CommMonoid ℓ) where
open IsMonoidHom
open CommMonoidStr ⦃...⦄
private
instance
_ = snd M
{-
The "groupification" of a monoid comes with a universal morphism and a universal property:
M ----- ∀φ -----> A
\ Λ
\ /
universalHom ∃! inducedHom
\ /
V /
Groupification M
-}
universalHom : CommMonoidHom M (AbGroup→CommMonoid (Groupification M))
fst universalHom = λ m → [ m , ε ]
pres· (snd universalHom) =
λ _ _ → eq/ _ _ (ε , cong (ε ·_) (·Comm _ _ ∙ cong₂ _·_ (·IdR ε) refl))
presε (snd universalHom) = refl
private
i = fst universalHom
module _ {A : AbGroup ℓ} (φ : CommMonoidHom M (AbGroup→CommMonoid A)) where
open IsGroupHom
open GroupTheory (AbGroup→Group A)
open AbGroupStr ⦃...⦄ using (-_; _-_; _+_; +InvR; +InvL)
private
instance
AAsGroup = snd A
MAsGroup = snd (Groupification M)
AAsMonoid = snd (AbGroup→CommMonoid A)
private
module φ = IsMonoidHom (snd φ)
f = fst φ
inducedHom : AbGroupHom (Groupification M) A
fst inducedHom = elim (λ x → isSetAbGroup A) g proof
where
g = λ (a , b) → f a - f b
proof : (u v : ⟨ M² M ⟩) (r : R M u v) → g u ≡ g v
proof _ _ (k , p) = lemma (lemma₂ p)
where
lemma₂ : ∀ {k a b c d} → k · (a · d) ≡ k · (b · c) → f a + f d ≡ f b + f c
lemma₂ {k} {a} {b} {c} {d} p =
f a + f d ≡⟨ sym (φ.pres· _ _) ⟩
f (a · d) ≡⟨ ·CancelL _ (sym (φ.pres· _ _) ∙ (cong f p) ∙ φ.pres· _ _) ⟩
f (b · c) ≡⟨ φ.pres· _ _ ⟩
f b + f c ∎
lemma : ∀ {a b c d} → f a + f d ≡ f b + f c → f a - f b ≡ f c - f d
lemma {a} {b} {c} {d} p =
f a - f b
≡⟨ cong (λ x → x - f b) (sym (·IdR _)) ⟩
f a + ε - f b
≡⟨ cong (λ x → f a + x - f b) (sym (+InvR _)) ⟩
f a + (f d - f d) - f b
≡⟨ cong (λ x → x - f b) (·Assoc _ _ _) ⟩
f a + f d - f d - f b
≡⟨ cong (λ x → x - f d - f b) p ⟩
f b + f c - f d - f b
≡⟨ ·Comm _ _ ∙ ·Assoc _ _ _ ⟩
(- f b + (f b + f c)) - f d
≡⟨ cong (λ x → x - f d) (·Assoc _ _ _) ⟩
((- f b + f b) + f c) - f d
≡⟨ cong (λ x → (x + f c) - f d) (+InvL _) ∙ sym (·Assoc _ _ _) ∙ ·IdL _ ⟩
f c - f d
∎
pres· (snd inducedHom) = elimProp2 (λ _ _ → isSetAbGroup A _ _) proof
where
rExp : ∀ {x y z} → x ≡ y → x + z ≡ y + z
rExp r = cong₂ _+_ r refl
lExp : ∀ {x y z} → x ≡ y → z + x ≡ z + y
lExp r = cong₂ _+_ refl r
proof : ((a , b) (c , d) : ⟨ M² M ⟩) → (f (a · c)) - (f (b · d)) ≡ (f a - f b) + (f c - f d)
proof (a , b) (c , d) =
f (a · c) - f (b · d) ≡⟨ cong₂ _-_ (φ.pres· _ _) (φ.pres· _ _) ⟩
(f a + f c) - (f b + f d) ≡⟨ lExp (invDistr _ _ ∙ ·Comm _ _) ∙ ·Assoc _ _ _ ⟩
((f a + f c) - f b) - f d ≡⟨ lemma ⟩
(f a - f b) + (f c - f d) ∎
where
lemma = rExp (sym (·Assoc _ _ _) ∙ lExp (·Comm _ _) ∙ ·Assoc _ _ _) ∙ sym (·Assoc _ _ _)
pres1 (snd inducedHom) = +InvR _
presinv (snd inducedHom) = elimProp (λ _ → isSetAbGroup A _ _)
(λ _ → sym (invDistr _ _ ∙ cong₂ _-_ (invInv _) refl))
solution : (m : ⟨ M ⟩) → (fst inducedHom) (i m) ≡ f m
solution m = cong ((f m)+_) ((cong (-_) φ.presε) ∙ inv1g) ∙ ·IdR _
unique : (ψ : AbGroupHom (Groupification M) A)
→ (ψIsSolution : (m : ⟨ M ⟩) → ψ .fst (i m) ≡ f m)
→ (u : ⟨ M² M ⟩) → ψ .fst [ u ] ≡ inducedHom .fst [ u ]
unique ψ ψIsSolution (a , b) =
ψ .fst [ a , b ] ≡⟨ lemma ⟩
ψ .fst ([ a , ε ] - [ b , ε ]) ≡⟨ (snd ψ).pres· _ _ ∙ cong₂ _+_ refl ((snd ψ).presinv _) ⟩
ψ .fst [ a , ε ] - ψ .fst [ b , ε ] ≡⟨ cong₂ _-_ (ψIsSolution a) (ψIsSolution b) ⟩
f a - f b ∎
where
lemma = cong (ψ .fst) (eq/ _ _ (ε , cong (ε ·_) (·Assoc _ _ _ ∙ ·Comm _ _)))
|
library(gdata) # load gdata package
library(ggplot2)
library(dplyr)
df <- read.csv("./benchmark.csv")
df <- df %>% mutate(time = timeNs / 1e9)
plotSubset <- function (vec, y_axis_scale = 1) {
ggplot(df %>% filter(type %in% vec)) + scale_x_discrete() + geom_point(aes(x = input, y = time, col = type)) +
scale_y_continuous(trans = "log10", labels = scales::comma) +
labs(y = "Time in seconds", x = "Input ID")
# theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1))
}
plotSubset(c("naive", "qbf", "muser"))
plotSubset(c("naive", "muser"))
plotSubset(c("naive", "qbf"))
plotSubset(c("muser", "qbf"))
|
{-
This second-order equational theory was created from the following second-order syntax description:
syntax Monad | M
type
T : 1-ary
term
ret : α -> T α
bind : T α α.(T β) -> T β | _>>=_ r10
theory
(LU) a : α b : α.(T β) |> bind (ret(a), x. b[x]) = b[a]
(RU) t : T α |> bind (t, x. ret(x)) = t
(AS) t : T α b : α.(T β) c : β.(T γ) |> bind (bind (t, x.b[x]), y.c[y]) = bind (t, x. bind (b[x], y.c[y]))
-}
module Monad.Equality where
open import SOAS.Common
open import SOAS.Context
open import SOAS.Variable
open import SOAS.Families.Core
open import SOAS.Families.Build
open import SOAS.ContextMaps.Inductive
open import Monad.Signature
open import Monad.Syntax
open import SOAS.Metatheory.SecondOrder.Metasubstitution M:Syn
open import SOAS.Metatheory.SecondOrder.Equality M:Syn
private
variable
α β γ τ : MT
Γ Δ Π : Ctx
infix 1 _▹_⊢_≋ₐ_
-- Axioms of equality
data _▹_⊢_≋ₐ_ : ∀ 𝔐 Γ {α} → (𝔐 ▷ M) α Γ → (𝔐 ▷ M) α Γ → Set where
LU : ⁅ α ⁆ ⁅ α ⊩ T β ⁆̣ ▹ ∅ ⊢ (ret 𝔞) >>= 𝔟⟨ x₀ ⟩ ≋ₐ 𝔟⟨ 𝔞 ⟩
RU : ⁅ T α ⁆̣ ▹ ∅ ⊢ 𝔞 >>= (ret x₀) ≋ₐ 𝔞
AS : ⁅ T α ⁆ ⁅ α ⊩ T β ⁆ ⁅ β ⊩ T γ ⁆̣ ▹ ∅ ⊢ (𝔞 >>= 𝔟⟨ x₀ ⟩) >>= 𝔠⟨ x₀ ⟩ ≋ₐ 𝔞 >>= (𝔟⟨ x₀ ⟩ >>= 𝔠⟨ x₀ ⟩)
open EqLogic _▹_⊢_≋ₐ_
open ≋-Reasoning
|
Require Import FcEtt.sigs.
Require Import FcEtt.imports.
Require Import FcEtt.ett_ott.
Require Import FcEtt.ett_inf.
Require Import FcEtt.ett_par.
Require Import FcEtt.ett_ind.
Require Import FcEtt.ext_wf.
Require Import FcEtt.ext_red_one.
Require Import FcEtt.tactics.
Module ext_red (invert : ext_invert_sig).
Export invert.
Module red_one := ext_red_one invert.
Export red_one.
Set Bullet Behavior "Strict Subproofs".
Set Implicit Arguments.
Lemma Beta_preservation : forall a b, Beta a b -> forall G A, Typing G a A -> Typing G b A.
Proof.
intros a b B. destruct B; intros G A0 TH.
- have CT: Ctx G by eauto.
have RA: Typing G A0 a_Star by eauto using Typing_regularity.
destruct (invert_a_App_Rel TH) as (A & B & TB & Tb & DE).
destruct (invert_a_UAbs TB) as (A1 & B1 & DE2 & [L TB1] & TA1).
eapply E_Conv with (A := (open_tm_wrt_tm B1 b)); eauto 2.
pick fresh x.
move: (TB1 x ltac:(auto)) => [T1 [T2 RC]].
rewrite (tm_subst_tm_tm_intro x v); eauto.
rewrite (tm_subst_tm_tm_intro x B1); eauto.
eapply Typing_tm_subst with (A:=A1); eauto 2.
eapply E_Conv with (A := A); eauto 2 using E_PiFst.
eapply E_Trans with (a1:= open_tm_wrt_tm B b); eauto using E_PiSnd, E_Refl, E_Sym.
- have CT: Ctx G by eauto.
have RA: Typing G A0 a_Star by eauto using Typing_regularity.
destruct (invert_a_App_Irrel TH) as (A & B & b0 & Tb & Tb2 & DE).
destruct (invert_a_UAbs Tb) as (A1 & B1 & DE2 & [L TB1] & TA1).
eapply E_Conv with (A := (open_tm_wrt_tm B1 b0)); eauto 2.
pick fresh x.
move: (TB1 x ltac:(auto)) => [T1 [T2 RC]].
inversion RC. subst.
rewrite (tm_subst_tm_tm_intro x v); eauto.
rewrite (tm_subst_tm_tm_intro x B1); eauto.
rewrite (tm_subst_tm_tm_fresh_eq _ _ _ H0).
rewrite - (tm_subst_tm_tm_fresh_eq _ b0 x H0).
eapply Typing_tm_subst with (A:=A1); eauto 2.
eapply E_Conv with (A:=A); eauto using E_PiFst.
eapply E_Sym.
eapply E_Trans with (a1 := open_tm_wrt_tm B b0). auto.
eapply E_PiSnd; eauto using E_Refl.
- have CT: Ctx G by eauto.
have RA: Typing G A0 a_Star by eauto using Typing_regularity.
destruct (invert_a_CApp TH) as (eq & a1 & b1 & A1 & B1 & h0 & h1 & h2).
destruct (invert_a_UCAbs h0) as (a2 & b2 & A2 & B2 & h3 & h4 & [L h5]).
pick fresh c.
move: (h5 c ltac:(auto)) => [T1 T2].
have? : DefEq G (dom G) a2 b2 A2. eauto using E_CPiFst, E_Cast.
eapply E_Conv with (A:= (open_tm_wrt_co B2 g_Triv)); eauto 2.
rewrite (co_subst_co_tm_intro c a'); eauto.
rewrite (co_subst_co_tm_intro c B2); eauto.
eapply Typing_co_subst; eauto.
eapply E_Sym.
eapply E_Trans with (a1 := open_tm_wrt_co B1 g_Triv). auto.
eapply E_CPiSnd; eauto 2.
- destruct (invert_a_Fam TH) as (b & B & h0 & h1 & h2).
assert (Ax a A = Ax b B). eapply binds_unique; eauto using uniq_toplevel.
inversion H0. subst.
eapply E_Conv with (A := B).
eapply toplevel_closed in h1.
eapply Typing_weakening with (F:=nil)(G:=nil)(E:=G) in h1.
simpl_env in h1.
auto. auto. simpl_env.
eauto.
eapply E_Sym. eauto.
move: (DefEq_regularity h0) => h3.
inversion h3.
auto.
Qed.
Lemma E_Beta2 : ∀ (G : context) (D : available_props) (a1 a2 B : tm),
Typing G a1 B → Beta a1 a2 → DefEq G D a1 a2 B.
Proof.
intros; eapply E_Beta; eauto.
eapply Beta_preservation; eauto.
Qed.
(*
Lemma Par_fv_preservation: forall G D x a b, Par G D a b ->
x `notin` fv_tm_tm_tm a ->
x `notin` fv_tm_tm_tm b.
Proof.
intros.
induction H; eauto 2; simpl.
all: simpl in H0.
all: try solve [move => h0; apply AtomSetFacts.union_iff in h0; case: h0 => h0; eauto; apply IHreduction_in_one; auto].
all: try auto.
- simpl in *.
have: x `notin` fv_tm_tm_tm (open_tm_wrt_tm a' b') => h0.
apply fv_tm_tm_tm_open_tm_wrt_tm_upper in h0.
apply AtomSetFacts.union_iff in h0.
case:h0; eauto => h0.
fsetdec_fast.
fsetdec_fast.
auto.
- rewrite fv_tm_tm_tm_open_tm_wrt_tm_upper.
fsetdec.
- have: x `notin` fv_tm_tm_tm (open_tm_wrt_co a' g_Triv) => h0.
apply fv_tm_tm_tm_open_tm_wrt_co_upper in h0.
apply AtomSetFacts.union_iff in h0.
case:h0; eauto => h0.
fsetdec.
auto.
- pick fresh x0.
assert (Fl : x0 `notin` L). auto.
assert (Fa : x `notin` fv_tm_tm_tm (open_tm_wrt_tm a (a_Var_f x0))).
rewrite fv_tm_tm_tm_open_tm_wrt_tm_upper. auto.
move: (H1 x0 Fl Fa) => h0.
rewrite fv_tm_tm_tm_open_tm_wrt_tm_lower. eauto.
- pick fresh x0.
have na': x `notin` fv_tm_tm_tm A'. eauto.
have nb: x `notin` fv_tm_tm_tm (open_tm_wrt_tm B (a_Var_f x0)).
rewrite fv_tm_tm_tm_open_tm_wrt_tm_upper. eauto.
have nob': x `notin` fv_tm_tm_tm (open_tm_wrt_tm B' (a_Var_f x0)). eauto.
have nb': x `notin` fv_tm_tm_tm B'.
rewrite fv_tm_tm_tm_open_tm_wrt_tm_lower. eauto.
eauto.
- pick_fresh c0.
have: x `notin` fv_tm_tm_tm (open_tm_wrt_co a (g_Var_f c0)) => h0.
apply fv_tm_tm_tm_open_tm_wrt_co_upper in h0.
apply AtomSetFacts.union_iff in h0.
case:h0; eauto => h0.
simpl in h0.
fsetdec.
have K:= H1 c0 ltac:(auto) h0.
move => h1.
apply K. auto.
apply fv_tm_tm_tm_open_tm_wrt_co_lower; auto.
- pick fresh c0 for L.
have: x `notin` fv_tm_tm_tm (open_tm_wrt_co a (g_Var_f c0)) => h0.
apply fv_tm_tm_tm_open_tm_wrt_co_upper in h0.
apply AtomSetFacts.union_iff in h0.
case:h0; eauto => h0.
simpl in h0.
fsetdec.
have h2: x `notin` fv_tm_tm_tm (open_tm_wrt_co a' (g_Var_f c0)). eauto.
move: (fv_tm_tm_tm_open_tm_wrt_co_lower a' (g_Var_f c0)) => h3.
have h4: x `notin` fv_tm_tm_tm a'. fsetdec.
move => h1.
apply AtomSetFacts.union_iff in h1.
case: h1 => h1; eauto.
apply AtomSetFacts.union_iff in h1.
case: h1 => h1; eauto.
fsetdec.
fsetdec.
- apply toplevel_closed in H.
move: (Typing_context_fv H) => ?. split_hyp.
simpl in *.
fsetdec.
-
apply IHPar.
pick fresh y.
move: (H1 y ltac:(auto)) => h0.
apply (fun_cong fv_tm_tm_tm) in h0.
simpl in h0.
move: (@fv_tm_tm_tm_open_tm_wrt_tm_lower a (a_Var_f y) x) => h1.
move: (@fv_tm_tm_tm_open_tm_wrt_tm_upper a (a_Var_f y) x) => h2.
unfold not. intro IN.
assert (h3: x `in` (union (fv_tm_tm_tm b) (singleton y))). auto.
rewrite -h0 in h3.
apply h2 in h3.
simpl in h3.
destruct (AtomSetImpl.union_1 h3).
assert (x `notin` singleton y). auto. done.
done.
- apply IHPar.
pick fresh y.
move: (H1 y ltac:(auto)) => h0.
apply (fun_cong fv_tm_tm_tm) in h0.
simpl in h0.
move: (@fv_tm_tm_tm_open_tm_wrt_tm_lower a (a_Var_f y) x) => h1.
move: (@fv_tm_tm_tm_open_tm_wrt_tm_upper a (a_Var_f y) x) => h2.
unfold not. intro IN.
assert (h3: x `in` (union (fv_tm_tm_tm b) empty)). auto.
rewrite -h0 in h3.
apply h2 in h3.
simpl in h3.
destruct (AtomSetImpl.union_1 h3).
assert (x `notin` singleton y). auto. done.
done.
- apply IHPar.
pick fresh y.
move: (H1 y ltac:(auto)) => h0.
apply (fun_cong fv_tm_tm_tm) in h0.
simpl in h0.
move: (@fv_tm_tm_tm_open_tm_wrt_co_lower a (g_Var_f y) x) => h1.
move: (@fv_tm_tm_tm_open_tm_wrt_co_upper a (g_Var_f y) x) => h2.
unfold not. intro IN.
assert (h3: x `in` (union (fv_tm_tm_tm b) empty)). auto.
rewrite -h0 in h3.
apply h2 in h3.
simpl in h3.
destruct H0.
apply AtomSetProperties.empty_union_1 in h3.
auto. done.
Qed.
*)
Lemma reduction_in_Par : forall a a', reduction_in_one a a' -> forall G D, Par G D a a'.
Proof.
induction 1; intros; try eauto using Value_lc.
Qed.
(*
See: reduction_in_one_lc in ext_red_one.
Lemma reduction_lc : forall a a', reduction_in_one a a' -> lc_tm a -> lc_tm a'.
*)
Lemma reduction_in_one_fv_preservation: forall x a b, reduction_in_one a b ->
x `notin` fv_tm_tm_tm a ->
x `notin` fv_tm_tm_tm b.
Proof.
intros.
eapply Par_fv_preservation; eauto.
eapply reduction_in_Par; eauto.
Unshelve. exact nil. exact {}.
Qed.
Lemma reduction_rhocheck : forall a a' rho x, reduction_in_one a a' -> RhoCheck rho x a -> RhoCheck rho x a'.
Proof.
move=> a a' [] x Red RC.
- inversion RC. eauto using reduction_in_one_lc.
- inversion RC. eauto using reduction_in_one_fv_preservation.
Qed.
Lemma reduction_preservation : forall a a', reduction_in_one a a' -> forall G A, Typing G a A -> Typing G a' A.
Proof.
(* TODO: clean and make more robust *)
move=> a a' r.
induction r.
all: move=> G A_ tpga.
- depind tpga; try eauto.
+ eapply E_Abs with (L := L `union` L0); try eassumption.
all: move=> x xLL0.
all: autofresh_fixed x.
all: eauto using reduction_rhocheck.
- depind tpga; subst; eauto.
- depind tpga; subst; eauto.
- depind tpga; subst; eauto.
- apply invert_a_App_Rel in tpga.
pcess_hyps.
apply invert_a_UAbs in H1. pcess_hyps.
autofresh. pcess_hyps.
move: (E_PiFst _ _ _ _ _ _ _ H1) => xx1.
eapply E_Conv; try eapply (E_Sym _ _ _ _ _ H3).
rewrite (tm_subst_tm_tm_intro x4); try fsetdec_fast.
rewrite (tm_subst_tm_tm_intro x4 x0); try fsetdec_fast.
eapply Typing_tm_subst.
have x4_refl : DefEq ([(x4, Tm x1)] ++ G) (dom G) (a_Var_f x4) (a_Var_f x4) x.
{
eapply E_Refl; eapply E_Conv.
- eauto.
- eapply E_Sym in xx1.
eapply DefEq_weaken_available.
rewrite <- (app_nil_l [(x4, Tm x1)]).
rewrite app_assoc.
eapply DefEq_weakening; try reflexivity.
+ rewrite app_nil_l. eassumption.
+ simpl. eauto.
- apply DefEq_regularity in xx1.
apply PropWff_regularity in xx1.
destruct xx1.
rewrite <- (app_nil_l [(x4, Tm x1)]).
rewrite app_assoc.
eapply Typing_weakening; eauto.
}
have x4G: (Ctx (nil ++ [(x4, Tm x1)] ++ G)) by eauto.
move: (DefEq_weakening H1 [(x4, Tm x1)] nil G eq_refl x4G) => H1w.
rewrite app_nil_l in H1w.
move: (E_PiSnd _ _ _ _ _ _ _ _ _ H1w x4_refl) => x0x2.
eapply E_Conv.
* eapply H4.
* eapply DefEq_weaken_available.
eapply (E_Sym _ _ _ _ _ x0x2).
* apply DefEq_regularity in x0x2. by inversion x0x2.
* eauto.
* (* TODO: autoreg. *)
apply DefEq_regularity in H3.
by inversion H3.
- apply invert_a_App_Irrel in tpga.
pcess_hyps.
apply invert_a_UAbs in H0; pcess_hyps.
autofresh. pcess_hyps.
move: (E_PiFst _ _ _ _ _ _ _ H0) => xx2.
eapply E_Conv; try eapply (E_Sym _ _ _ _ _ H3).
rewrite (tm_subst_tm_tm_intro x5); try fsetdec_fast.
rewrite tm_subst_tm_tm_fresh_eq; try done.
rewrite -(tm_subst_tm_tm_fresh_eq (open_tm_wrt_tm v (a_Var_f x5)) x1 x5); try done.
(*rewrite (tm_subst_tm_tm_intro x5); try fsetdec_fast.*)
eapply Typing_tm_subst.
have x5_refl : DefEq ([(x5, Tm x2)] ++ G) (dom G) (a_Var_f x5) (a_Var_f x5) x.
{
eapply E_Refl; eapply E_Conv.
- eauto.
- eapply E_Sym in xx2.
eapply DefEq_weaken_available.
rewrite <- (app_nil_l [(x5, Tm x2)]).
rewrite app_assoc.
eapply DefEq_weakening; try reflexivity.
+ rewrite app_nil_l. eassumption.
+ simpl. eauto.
- apply DefEq_regularity in xx2.
apply PropWff_regularity in xx2.
destruct xx2.
rewrite <- (app_nil_l [(x5, Tm x2)]).
rewrite app_assoc.
eapply Typing_weakening; eauto.
}
have x5G: (Ctx (nil ++ [(x5, Tm x2)] ++ G)) by eauto.
move: (DefEq_weakening H0 [(x5, Tm x2)] nil G eq_refl x5G) => H1w.
rewrite app_nil_l in H1w.
move: (E_PiSnd _ _ _ _ _ _ _ _ _ H1w x5_refl) => x0x3.
eapply E_Conv.
* eassumption.
* eapply DefEq_weaken_available.
eapply (E_Sym _ _ _ _ _ x0x3).
* apply DefEq_regularity in x0x3. by inversion x0x3.
* eauto.
* (* TODO: autoreg. *) inversion H6. assumption.
* inversion H6. assumption.
* erewrite <- tm_subst_tm_tm_intro. eauto. fsetdec.
* apply DefEq_regularity in H2. by inversion H2.
- apply invert_a_CApp in tpga; pcess_hyps.
apply invert_a_UCAbs in H1; pcess_hyps.
eapply E_Conv; try eapply (E_Sym _ _ _ _ _ H2). (* TODO: declare E_Sym's (and others') arguments implicit *)
autofresh; pcess_hyps.
move: (E_CPiFst _ _ _ _ _ _ H1) => iso.
move: (E_Cast _ _ _ _ _ _ _ _ H2 iso) => x34.
move: (E_CPiSnd _ _ _ _ _ _ _ _ _ _ H1 H2 x34) => x26.
eapply E_Conv; try eapply (E_Sym _ _ _ _ _ x26).
all: try (apply DefEq_regularity in H3; inversion H3; done).
rewrite (co_subst_co_tm_intro x8); try fsetdec_fast.
rewrite (co_subst_co_tm_intro x8 x6); try fsetdec_fast.
eapply Typing_co_subst.
all: eauto.
- apply invert_a_Fam in tpga; pcess_hyps.
move: (binds_unique _ _ _ _ _ H H1 uniq_toplevel). inversion 1. subst x0 x.
apply toplevel_closed in H.
eapply E_Sym in H0.
move: (DefEq_regularity H0) => reg; inversion reg.
eapply Typing_Ctx in H7.
eapply E_Conv; eauto.
move: (Typing_weakening H G nil nil eq_refl).
rewrite app_nil_l app_nil_r.
by apply.
Qed.
(* ---- helper tactics for lemma below. -------------- *)
(* Convert a goal of the form Par (XX ++ G) dom(XX ++ G) a b ==> Par G D a b *)
Ltac par_with_context_tail :=
match goal with
| _ : _ |- Par ([?s] ++ ?G ) (dom ([?s] ++ ?G)) ?a ?b =>
eapply context_Par_irrelevance with (G1 := G) (D1 := dom G); eauto
end.
Ltac ind_hyp a k1 k2 :=
match goal with
[ H : ∀ a' : tm, Ctx ?G → Par ?G ?D a a' → Typing ?G a' ?A ∧ DefEq ?G empty a a' ?A,
H1 : Par ?G ?D a ?a',
H2 : Ctx ?G |- _ ] =>
move: (@H a' H2 H1) => [k1 k2]
end.
Ltac ind_hyp_open x B k1 k2 :=
match goal with
[ H : forall x, x `notin` ?L -> forall a', Ctx ([(x, ?s)] ++ ?G) -> Par ([(x, ?s)] ++ ?G) ?D (open_tm_wrt_tm B (a_Var_f x)) a' -> ?P,
H1 : Ctx ?G,
H10 : forall x : atom, x `notin` ?L0 → Par ?G ?D0 (open_tm_wrt_tm B (a_Var_f x)) (open_tm_wrt_tm ?B' (a_Var_f x))
|- _ ] =>
move: (H x ltac:(auto) (open_tm_wrt_tm B' (a_Var_f x)) ltac:(auto)
(context_Par_irrelevance ([(x, s)] ++ G) (dom ([(x,s)] ++ G)) (H10 x ltac:(auto)))) => [k0 k1]
end.
(*
This lemma is not true in the presence of Eta-reduction in Par.
Instead, we should prove preservation for the head_reduction relation that
does not include eta.
(* Extend to D insteadn of just dom G??? *)
Lemma type_reduction_mutual:
(forall G a A, Typing G a A ->
forall a', Ctx G -> Par G (dom G) a a'-> Typing G a' A /\ DefEq G empty a a' A) /\
(forall G phi, PropWff G phi -> forall A B T, Ctx G -> phi = Eq A B T ->
(forall A' B' T', Par G (dom G) A A' -> Par G (dom G) B B' -> Par G (dom G) T T' ->
PropWff G (Eq A' B' T') /\ Iso G empty phi (Eq A' B' T'))) /\
(forall G D p1 p2, Iso G D p1 p2 -> True) /\
(forall G D A B T, DefEq G D A B T -> True) /\
(forall G1, Ctx G1 -> True).
*)
End ext_red.
|
Trust Pharmacy – Can You Really Trust An Online Pharmacy?
Medications have become one of many artificially created substances that human beings use every day. However, unlike things like plastic products and other materials that we use commercially, medications must be taken into the body, which means that scientists, researchers, and ultimately the companies producing them must ensure the populace that the medications are safe to consume. Thankfully, medications must go through a rigorous process to be accepted as a treatment for conditions. But, what about pharmacies, especially the ones online? Is there a way to assure that we can trust them?
The pharmacy has plenty of features that are geared towards making the experience more enjoyable for their customers. For example, they offer plenty of special offers right on their homepage, offering some of the lowest prices for meds, especially bestsellers like Viagra and Cialis. They offer to present the site in a number of languages and different currencies that suit the user’s needs. They have even provided US and UK numbers that you can use to contact the customer service with if you are experiencing any trouble. Finally, they have guaranteed customers that delivery will be prompt and on time.
However, despite all of these amazing claims on the site, there is still reason to shed suspicion on sites like these. One of the main problems that online pharmacies face is establishing a sense of reliability and trustworthiness with their clients and the public in general. This is due to the fact that thousands of prior customers have been able to share their experiences of getting scammed out of their money by a seemingly legitimate online pharmacy. Canadian pharmacies, for example, have made quite a name for themselves online due to the lowered prices compared to other Western countries and the exceptional service that Canadian healthcare is known for. However, it seems that many websites claiming to be based in Canada are not, which spreads the doubt about which sites to trust.
For Canadian pharmacies, there is an association called CIPA that is composed of approved and licensed pharmaceutical vendors. They have dedicated their time and efforts to find out which Canadian sites are the real deal and which are not. They have also conveniently set up a list of sites that are approved or otherwise. CIPA members are known not to send spam to customers of their services, nor do they sell any substances without someone presenting their prescription. Unfortunately, it seems that trust Pharmacy has been included in the rogue pharmacy list, which means that it cannot be trusted despite its name.
Trust Pharmacy has definitely set itself up in the online world with a widespread name and reputation. This can be seen in the fact that there are several hundreds of people ordering their drugs from the site every day. The same can be said of others of the same vein, it seems, as there is another pharmacy that is located in the UK at Nottingham, which shares the same name as the Trust Pharmacy predecessor from Canada.
Many of the customers that have used this service have given an excellent rating to the website and declared that the pharmacists on site were professional, and that service was efficient and friendly. Aside from being helpful, the professionals helping customers also displayed compassion and dedication to their field. One person gave an account of leaving behind their medication, to which the pharmacy helped them recover it. Also, some had said that they had been able to receive their drugs promptly upon arrival.
In the same vein as Trust Pharmacy, it can be easy to be misled by the little markers you can find on a website, such as the security guarantees and the free shipping fees, but it is ultimately up to the client to look into the validity of a site or face the possibility of getting scammed.
When it comes to any business, trust is an important aspect that lets customers put their faith in you and has them coming back for more service. Online pharmacies need to overcome the hurdle that comes with internet business stigma. Unfortunately, many websites are not helping their case at all. Trust Pharmacy, while having the look and feel of a genuine online pharmacy that will help you get the meds you need, the site has actually been flagged as a site that is not reliable and that should not be engaged with by the CIPA.
Other pharmacies of similar names such as the Trust Pharmacy operating in the UK and World Trust Pharmacy need more digging for you to really determine if they are good websites to be using. One of the many ways to do this is to consult review websites and organizations that accredit online pharmacies. Finally, you can take a look at the approved online pharmacies we’ve got recommended for readers here.
|
(** * Hoare: Hoare Logic, Part I *)
Require Import Coq.Bool.Bool.
Require Import Coq.Arith.Arith.
Require Import Coq.Arith.EqNat.
Require Import Coq.omega.Omega.
Require Import SfLib.
Require Import Imp.
Require Import Maps.
(** In the past couple of chapters, we've begun applying the
mathematical tools developed in the first part of the course to
studying the theory of a small programming language, Imp.
- We defined a type of _abstract syntax trees_ for Imp, together
with an _evaluation relation_ (a partial function on states)
that specifies the _operational semantics_ of programs.
The language we defined, though small, captures some of the key
features of full-blown languages like C, C++, and Java,
including the fundamental notion of mutable state and some
common control structures.
- We proved a number of _metatheoretic properties_ -- "meta" in
the sense that they are properties of the language as a whole,
rather than of particular programs in the language. These
included:
- determinism of evaluation
- equivalence of some different ways of writing down the
definitions (e.g., functional and relational definitions of
arithmetic expression evaluation)
- guaranteed termination of certain classes of programs
- correctness (in the sense of preserving meaning) of a number
of useful program transformations
- behavioral equivalence of programs (in the [Equiv] chapter). *)
(** If we stopped here, we would already have something useful: a set
of tools for defining and discussing programming languages and
language features that are mathematically precise, flexible, and
easy to work with, applied to a set of key properties. All of
these properties are things that language designers, compiler
writers, and users might care about knowing. Indeed, many of them
are so fundamental to our understanding of the programming
languages we deal with that we might not consciously recognize
them as "theorems." But properties that seem intuitively obvious
can sometimes be quite subtle (sometimes also subtly wrong!).
We'll return to the theme of metatheoretic properties of whole
languages later in the book when we discuss _types_ and _type
soundness_. In this chapter, though, we turn to a different set
of issues.
Our goal is to carry out some simple examples of _program
verification_ -- i.e., to use the precise definition of Imp to
prove formally that particular programs satisfy particular
specifications of their behavior. We'll develop a reasoning
system called _Floyd-Hoare Logic_ -- often shortened to just
_Hoare Logic_ -- in which each of the syntactic constructs of Imp
is equipped with a generic "proof rule" that can be used to reason
compositionally about the correctness of programs involving this
construct.
Hoare Logic originated in the 1960s, and it continues to be the
subject of intensive research right up to the present day. It
lies at the core of a multitude of tools that are being used in
academia and industry to specify and verify real software
systems. *)
(** Hoare Logic combines two beautiful ideas: a natural way of
writing down _specifications_ of programs, and a _compositional
proof technique_ for proving that programs are correct with
respect to such specifications -- where by "compositional" we mean
that the structure of proofs directly mirrors the structure of the
programs that they are about. *)
(* ####################################################### *)
(** * Assertions *)
(** To talk about specifications of programs, the first thing we
need is a way of making _assertions_ about properties that hold at
particular points during a program's execution -- i.e., claims
about the current state of the memory when execution reaches that
point. Formally, an assertion is just a family of propositions
indexed by a [state]. *)
Definition Assertion := state -> Prop.
(** **** Exercise: 1 star, optional (assertions) *)
Module ExAssertions.
(** Paraphrase the following assertions in English (or your favorite
natural language). *)
Definition as1 : Assertion := fun st => st X = 3.
Definition as2 : Assertion := fun st => st X <= st Y.
Definition as3 : Assertion :=
fun st => st X = 3 \/ st X <= st Y.
Definition as4 : Assertion :=
fun st => st Z * st Z <= st X /\
~ (((S (st Z)) * (S (st Z))) <= st X).
Definition as5 : Assertion := fun st => True.
Definition as6 : Assertion := fun st => False.
(*
as1 : in the current state, there is a variable X in memory
and its value is 3
as2 : in the current state, there are variables X and Y
in memory and value of X <= value of Y
as3 : in current state, we have X and Y in memory,
the value of X is 3, and X <= Y
as4 : in current state, the value of Z^2 <= X and
not ((Z+1)^2 <= X), or in other words:
(Z+1)^2 > X
as5 : the current state of program is True
as6 : the current state of program is false
*)
(* FILL IN HERE *)
End ExAssertions.
(** [] *)
(** This way of writing assertions can be a little bit heavy,
for two reasons: (1) every single assertion that we ever write is
going to begin with [fun st => ]; and (2) this state [st] is the
only one that we ever use to look up variables in assertions (we
will never need to talk about two different memory states at the
same time). For discussing examples informally, we'll adopt some
simplifying conventions: we'll drop the initial [fun st =>], and
we'll write just [X] to mean [st X]. Thus, instead of writing *)
(**
fun st => (st Z) * (st Z) <= m /\
~ ((S (st Z)) * (S (st Z)) <= m)
we'll write just
Z * Z <= m /\ ~((S Z) * (S Z) <= m).
*)
(** Given two assertions [P] and [Q], we say that [P] _implies_ [Q],
written [P ->> Q] (in ASCII, [P -][>][> Q]), if, whenever [P]
holds in some state [st], [Q] also holds. *)
Definition assert_implies (P Q : Assertion) : Prop :=
forall st, P st -> Q st.
Notation "P ->> Q" := (assert_implies P Q)
(at level 80) : hoare_spec_scope.
Open Scope hoare_spec_scope.
(** (The [hoare_spec_scope] annotation here tells Coq that this
notation is not global but is intended to be used in particular
contexts. The [Open Scope] tells Coq that this file is one such
context.) *)
(** We'll also want the "iff" variant of implication between
assertions: *)
Notation "P <<->> Q" :=
(P ->> Q /\ Q ->> P) (at level 80) : hoare_spec_scope.
(* ####################################################### *)
(** * Hoare Triples *)
(** Next, we need a way of making formal claims about the
behavior of commands. *)
(** In general, the behavior of a command is to transform one state to
another, so it is natural to express claims about commands in
terms of assertions that are true before and after the command
executes:
- "If command [c] is started in a state satisfying assertion
[P], and if [c] eventually terminates in some final state,
then this final state will satisfy the assertion [Q]."
Such a claim is called a _Hoare Triple_. The property [P] is
called the _precondition_ of [c], while [Q] is the
_postcondition_. Formally: *)
Definition hoare_triple
(P:Assertion) (c:com) (Q:Assertion) : Prop :=
forall st st',
c / st \\ st' ->
P st ->
Q st'.
(** Since we'll be working a lot with Hoare triples, it's useful to
have a compact notation:
{{P}} c {{Q}}.
*)
(** (The traditional notation is [{P} c {Q}], but single braces
are already used for other things in Coq.) *)
Notation "{{ P }} c {{ Q }}" :=
(hoare_triple P c Q) (at level 90, c at next level)
: hoare_spec_scope.
(** **** Exercise: 1 star, optional (triples) *)
(** Paraphrase the following Hoare triples in English.
1) {{True}} c {{X = 5}}
2) {{X = m}} c {{X = m + 5)}}
3) {{X <= Y}} c {{Y <= X}}
4) {{True}} c {{False}}
5) {{X = m}}
c
{{Y = real_fact m}}.
6) {{True}}
c
{{(Z * Z) <= m /\ ~ (((S Z) * (S Z)) <= m)}}
]]
1) given a True precondition, executing c assigns value 5 to variable X
2) given X = m, exeuting c incrs X by 5
3) given X <= Y, executing c reverses the inequality
4) given a True precondition, executing c results in a False post condition
5) skipped
6) given a true precondition, executing c results in a final state where
Z^2 <= m and (Z+1)^2 > m
*)
(** [] *)
(** **** Exercise: 1 star, optional (valid_triples) *)
(** Which of the following Hoare triples are _valid_ -- i.e., the
claimed relation between [P], [c], and [Q] is true?
1) {{True}} X ::= 5 {{X = 5}}
2) {{X = 2}} X ::= X + 1 {{X = 3}}
3) {{True}} X ::= 5; Y ::= 0 {{X = 5}}
4) {{X = 2 /\ X = 3}} X ::= 5 {{X = 0}}
5) {{True}} SKIP {{False}}
6) {{False}} SKIP {{True}}
7) {{True}} WHILE True DO SKIP END {{False}}
8) {{X = 0}}
WHILE X == 0 DO X ::= X + 1 END
{{X = 1}}
9) {{X = 1}}
WHILE X <> 0 DO X ::= X + 1 END
{{X = 100}}
valid: 1, 2, 3, 6, 8
toask: what happens when [c] diverges?
*)
(** [] *)
(** (Note that we're using informal mathematical notations for
expressions inside of commands, for readability, rather than their
formal [aexp] and [bexp] encodings. We'll continue doing so
throughout the chapter.) *)
(** To get us warmed up for what's coming, here are two simple
facts about Hoare triples. *)
Theorem hoare_post_true : forall (P Q : Assertion) (c : com),
(forall st, Q st) ->
{{P}} c {{Q}}.
Proof.
intros P Q c H. unfold hoare_triple.
intros st st' Heval HP.
apply H. Qed.
(* ta ask: what is this saying? *)
Theorem hoare_pre_false : forall (P Q : Assertion) c,
(forall st, ~(P st)) ->
{{P}} c {{Q}}.
Proof.
intros P Q c H. unfold hoare_triple.
intros st st' Heval HP.
unfold not in H. apply H in HP.
inversion HP. Qed.
(* ####################################################### *)
(** * Proof Rules *)
(** The goal of Hoare logic is to provide a _compositional_
method for proving the validity of specific Hoare triples. That
is, we want the structure of a program's correctness proof to
mirror the structure of the program itself. To this end, in the
sections below, we'll introduce a rule for reasoning about each of
the different syntactic forms of commands in Imp -- one for
assignment, one for sequencing, one for conditionals, etc. -- plus
a couple of "structural" rules for gluing things together. We
will then be able to prove programs correct using these proof
rules, without ever unfolding the definition of [hoare_triple]. *)
(* ####################################################### *)
(** ** Assignment *)
(** The rule for assignment is the most fundamental of the Hoare logic
proof rules. Here's how it works.
Consider this valid Hoare triple:
{{ Y = 1 }} X ::= Y {{ X = 1 }}
In English: if we start out in a state where the value of [Y]
is [1] and we assign [Y] to [X], then we'll finish in a
state where [X] is [1]. That is, the property of being equal
to [1] gets transferred from [Y] to [X].
Similarly, in
{{ Y + Z = 1 }} X ::= Y + Z {{ X = 1 }}
the same property (being equal to one) gets transferred to
[X] from the expression [Y + Z] on the right-hand side of
the assignment.
More generally, if [a] is _any_ arithmetic expression, then
{{ a = 1 }} X ::= a {{ X = 1 }}
is a valid Hoare triple.
This can be made even more general. To conclude that an
arbitrary property [Q] holds after [X ::= a], we need to assume
that [Q] holds before [X ::= a], but _with all occurrences of_ [X]
replaced by [a] in [Q]. This leads to the Hoare rule for
assignment
{{ Q [X |-> a] }} X ::= a {{ Q }}
where "[Q [X |-> a]]" is pronounced "[Q] where [a] is substituted
for [X]".
For example, these are valid applications of the assignment
rule:
{{ (X <= 5) [X |-> X + 1]
i.e., X + 1 <= 5 }}
X ::= X + 1
{{ X <= 5 }}
{{ (X = 3) [X |-> 3]
i.e., 3 = 3}}
X ::= 3
{{ X = 3 }}
{{ (0 <= X /\ X <= 5) [X |-> 3]
i.e., (0 <= 3 /\ 3 <= 5)}}
X ::= 3
{{ 0 <= X /\ X <= 5 }}
*)
(** To formalize the rule, we must first formalize the idea of
"substituting an expression for an Imp variable in an assertion."
That is, given a proposition [P], a variable [X], and an
arithmetic expression [a], we want to derive another proposition
[P'] that is just the same as [P] except that, wherever [P]
mentions [X], [P'] should instead mention [a].
Since [P] is an arbitrary Coq proposition, we can't directly
"edit" its text. Instead, we can achieve the effect we want by
evaluating [P] in an updated state: *)
Definition assn_sub (X : id) (a : aexp) (P : Assertion) : Assertion :=
fun (st : state) =>
P (t_update st X (aeval st a)).
Notation "P [ X |-> a ]" := (assn_sub X a P) (at level 10).
(** That is, [P [X |-> a]] is an assertion -- let's call it [P'] --
that is just like [P] except that, wherever [P] looks up the
variable [X] in the current state, [P'] instead uses the value
of the expression [a].
To see how this works, let's calculate what happens with a couple
of examples. First, suppose [P'] is [(X <= 5) [X |-> 3]] -- that
is, more formally, [P'] is the Coq expression
fun st =>
(fun st' => st' X <= 5)
(t_update st X (aeval st (ANum 3))),
which simplifies to
fun st =>
(fun st' => st' X <= 5)
(t_update st X 3)
and further simplifies to
fun st =>
((t_update st X 3) X) <= 5)
and by further simplification to
fun st =>
(3 <= 5).
That is, [P'] is the assertion that [3] is less than or equal to
[5] (as expected).
For a more interesting example, suppose [P'] is [(X <= 5) [X |->
X+1]]. Formally, [P'] is the Coq expression
fun st =>
(fun st' => st' X <= 5)
(t_update st X (aeval st (APlus (AId X) (ANum 1)))),
which simplifies to
fun st =>
(((t_update st X (aeval st (APlus (AId X) (ANum 1))))) X) <= 5
and further simplifies to
fun st =>
(aeval st (APlus (AId X) (ANum 1))) <= 5.
That is, [P'] is the assertion that [X+1] is at most [5].
*)
(** Now we can give the precise proof rule for assignment:
------------------------------ (hoare_asgn)
{{Q [X |-> a]}} X ::= a {{Q}}
*)
(** We can prove formally that this rule is indeed valid. *)
Theorem hoare_asgn : forall Q X a,
{{Q [X |-> a]}} (X ::= a) {{Q}}.
Proof.
unfold hoare_triple.
intros Q X a st st' HE HQ.
inversion HE. subst.
unfold assn_sub in HQ. assumption.
Qed.
(** Here's a first formal proof using this rule. *)
Example assn_sub_example :
{{(fun st => st X = 3) [X |-> ANum 3]}}
(X ::= (ANum 3))
{{fun st => st X = 3}}.
Proof.
apply hoare_asgn.
Qed.
(** **** Exercise: 2 stars (hoare_asgn_examples) *)
(** Translate these informal Hoare triples...
1) {{ (X <= 5) [X |-> X + 1] }}
X ::= X + 1
{{ X <= 5 }}
2) {{ (0 <= X /\ X <= 5) [X |-> 3] }}
X ::= 3
{{ 0 <= X /\ X <= 5 }}
...into formal statements (use the names [assn_sub_ex1]
and [assn_sub_ex2]) and use [hoare_asgn] to prove them. *)
Example assn_sub_ex1 :
{{ (fun st => st X <= 5) [ X |-> APlus (AId X) (ANum 1)] }}
(X ::= APlus (AId X) (ANum 1)) {{ fun st => st X <= 5 }}.
Proof.
apply hoare_asgn.
Qed.
Example assn_sub_ex2 :
{{ (fun st => 0 <= st X /\ st X <= 5) [X |-> ANum 3 ] }} (X ::= ANum 3)
{{ fun st => 0 <= st X /\ st X <= 5 }}.
Proof.
apply hoare_asgn.
Qed.
(** [] *)
(** **** Exercise: 2 stars (hoare_asgn_wrong) *)
(** The assignment rule looks backward to almost everyone the first
time they see it. If it still seems puzzling, it may help
to think a little about alternative "forward" rules. Here is a
seemingly natural one:
------------------------------ (hoare_asgn_wrong)
{{ True }} X ::= a {{ X = a }}
Give a counterexample showing that this rule is incorrect and
argue informally that it is really a counterexample. (Hint:
The rule universally quantifies over the arithmetic expression
[a], and your counterexample needs to exhibit an [a] for which
the rule doesn't work.) *)
Example hoare_asgn_wrong : forall a,
{{ fun st => True }}
(X ::= APlus (AId X) (ANum 1))
{{ fun st => st X = a }}.
Proof. Abort. (* cannot be proven *)
Example hoare_asgn_wrong_1 : forall a,
{{ (fun st => st X = a) [ X |-> APlus (AId X) (ANum 1)] }}
(X ::= APlus (AId X) (ANum 1))
{{ fun st => st X = a }}.
Proof. Abort. (* cannot be proven *)
(*
hoare_asgn_wrong is an example, informally, we pick [a = X + 1] so we have:
{{ True }} X ::= X + 1 {{ X = a }}
Note this expression cannot be proven,
since clearly the post condition is false since X cannot equal X + 1.
to ask: why is this wrong though???
{{ Q [ X |-> a] }} X ::= a {{ Q }}
{{ (X = a) [ X |-> X + 1 ] }} X ::= a {{ X = a }}
*)
(** [] *)
(** **** Exercise: 3 stars, advanced (hoare_asgn_fwd) *)
(** However, by using an auxiliary variable [m] to remember the
original value of [X] we can define a Hoare rule for assignment
that does, intuitively, "work forwards" rather than backwards.
------------------------------------------ (hoare_asgn_fwd)
{{fun st => P st /\ st X = m}}
X ::= a
{{fun st => P st' /\ st X = aeval st' a }}
(where st' = t_update st X m)
Note that we use the original value of [X] to reconstruct the
state [st'] before the assignment took place. Prove that this rule
is correct (the first hypothesis is the functional extensionality
axiom, which you will need at some point). Also note that this
rule is more complicated than [hoare_asgn].
*)
Theorem hoare_asgn_fwd :
(forall {X Y: Type} {f g : X -> Y},
(forall (x: X), f x = g x) -> f = g) ->
forall m a P,
{{fun st => P st /\ st X = m}}
X ::= a
{{fun st => P (t_update st X m)
/\ st X = aeval (t_update st X m) a }}.
Proof.
intros functional_extensionality m a P.
(* FILL IN HERE *) Admitted.
(** [] *)
(** **** Exercise: 2 stars, advanced (hoare_asgn_fwd_exists) *)
(** Another way to define a forward rule for assignment is to
existentially quantify over the previous value of the assigned
variable.
------------------------------------------ (hoare_asgn_fwd_exists)
{{fun st => P st}}
X ::= a
{{fun st => exists m, P (t_update st X m) /\
st X = aeval (t_update st X m) a }}
*)
Theorem hoare_asgn_fwd_exists :
(forall {X Y: Type} {f g : X -> Y},
(forall (x: X), f x = g x) -> f = g) ->
forall a P,
{{fun st => P st}}
X ::= a
{{fun st => exists m, P (t_update st X m) /\
st X = aeval (t_update st X m) a }}.
Proof.
intros functional_extensionality a P.
(* FILL IN HERE *) Admitted.
(** [] *)
(* ####################################################### *)
(** ** Consequence *)
(** Sometimes the preconditions and postconditions we get from the
Hoare rules won't quite be the ones we want in the particular
situation at hand -- they may be logically equivalent but have a
different syntactic form that fails to unify with the goal we are
trying to prove, or they actually may be logically weaker (for
preconditions) or stronger (for postconditions) than what we need.
For instance, while
{{(X = 3) [X |-> 3]}} X ::= 3 {{X = 3}},
follows directly from the assignment rule,
{{True}} X ::= 3 {{X = 3}}
does not. This triple is valid, but it is not an instance of
[hoare_asgn] because [True] and [(X = 3) [X |-> 3]] are not
syntactically equal assertions. However, they are logically
equivalent, so if one triple is valid, then the other must
certainly be as well. We can capture this observation with the
following rule:
{{P'}} c {{Q}}
P <<->> P'
----------------------------- (hoare_consequence_pre_equiv)
{{P}} c {{Q}}
Taking this line of thought a bit further, we can see that
strengthening the precondition or weakening the postcondition of a
valid triple always produces another valid triple. This
observation is captured by two _Rules of Consequence_.
{{P'}} c {{Q}}
P ->> P'
----------------------------- (hoare_consequence_pre)
{{P}} c {{Q}}
{{P}} c {{Q'}}
Q' ->> Q
----------------------------- (hoare_consequence_post)
{{P}} c {{Q}}
*)
(** Here are the formal versions: *)
Theorem hoare_consequence_pre : forall (P P' Q : Assertion) c,
{{P'}} c {{Q}} ->
P ->> P' ->
{{P}} c {{Q}}.
Proof.
intros P P' Q c Hhoare Himp.
intros st st' Hc HP. apply (Hhoare st st').
assumption. apply Himp. assumption.
Qed.
Theorem hoare_consequence_post : forall (P Q Q' : Assertion) c,
{{P}} c {{Q'}} ->
Q' ->> Q ->
{{P}} c {{Q}}.
Proof.
intros P Q Q' c Hhoare Himp.
intros st st' Hc HP.
apply Himp.
apply (Hhoare st st').
assumption. assumption. Qed.
(** For example, we can use the first consequence rule like this:
{{ True }} ->>
{{ 1 = 1 }}
X ::= 1
{{ X = 1 }}
Or, formally...
*)
Example hoare_asgn_example1 :
{{fun st => True}} (X ::= (ANum 1)) {{fun st => st X = 1}}.
Proof.
apply hoare_consequence_pre
with (P' := (fun st => st X = 1) [X |-> ANum 1]).
apply hoare_asgn.
intros st H. unfold assn_sub, t_update. simpl. reflexivity.
Qed.
(** Finally, for convenience in some proofs, we can state a combined
rule of consequence that allows us to vary both the precondition
and the postcondition at the same time.
{{P'}} c {{Q'}}
P ->> P'
Q' ->> Q
----------------------------- (hoare_consequence)
{{P}} c {{Q}}
*)
Theorem hoare_consequence : forall (P P' Q Q' : Assertion) c,
{{P'}} c {{Q'}} ->
P ->> P' ->
Q' ->> Q ->
{{P}} c {{Q}}.
Proof.
intros P P' Q Q' c Hht HPP' HQ'Q.
apply hoare_consequence_pre with (P' := P').
apply hoare_consequence_post with (Q' := Q').
assumption. assumption. assumption. Qed.
(* ####################################################### *)
(** ** Digression: The [eapply] Tactic *)
(** This is a good moment to introduce another convenient feature of
Coq. We had to write "[with (P' := ...)]" explicitly in the proof
of [hoare_asgn_example1] and [hoare_consequence] above, to make
sure that all of the metavariables in the premises to the
[hoare_consequence_pre] rule would be set to specific
values. (Since [P'] doesn't appear in the conclusion of
[hoare_consequence_pre], the process of unifying the conclusion
with the current goal doesn't constrain [P'] to a specific
assertion.)
This is annoying, both because the assertion is a bit long and
also because, in [hoare_asgn_example1], the very next thing we are
going to do -- applying the [hoare_asgn] rule -- will tell us
exactly what it should be! We can use [eapply] instead of [apply]
to tell Coq, essentially, "Be patient: The missing part is going
to be filled in later in the proof." *)
Example hoare_asgn_example1' :
{{fun st => True}}
(X ::= (ANum 1))
{{fun st => st X = 1}}.
Proof.
eapply hoare_consequence_pre.
apply hoare_asgn.
intros st H. reflexivity.
Qed.
(** In general, [eapply H] tactic works just like [apply H] except
that, instead of failing if unifying the goal with the conclusion
of [H] does not determine how to instantiate all of the variables
appearing in the premises of [H], [eapply H] will replace these
variables with _existential variables_ (written [?nnn]), which
function as placeholders for expressions that will be
determined (by further unification) later in the proof. *)
(** In order for [Qed] to succeed, all existential variables need to
be determined by the end of the proof. Otherwise Coq
will (rightly) refuse to accept the proof. Remember that the Coq
tactics build proof objects, and proof objects containing
existential variables are not complete. *)
Lemma silly1 : forall (P : nat -> nat -> Prop) (Q : nat -> Prop),
(forall x y : nat, P x y) ->
(forall x y : nat, P x y -> Q x) ->
Q 42.
Proof.
intros P Q HP HQ. eapply HQ. apply HP.
(** Coq gives a warning after [apply HP]. (The warnings look
different between Coq 8.4 and Coq 8.5. In 8.4, the warning says
"No more subgoals but non-instantiated existential variables." In
8.5, it says "All the remaining goals are on the shelf," meaning
that we've finished all our top-level proof obligations but along
the way we've put some aside to be done later, and we have not
finished those.) Trying to close the proof with [Qed] gives an
error. *)
Abort.
(** An additional constraint is that existential variables cannot be
instantiated with terms containing ordinary variables that did not
exist at the time the existential variable was created. (The
reason for this technical restriction is that allowing such
instantiation would lead to inconsistency of Coq's logic.) *)
Lemma silly2 :
forall (P : nat -> nat -> Prop) (Q : nat -> Prop),
(exists y, P 42 y) ->
(forall x y : nat, P x y -> Q x) ->
Q 42.
Proof.
intros P Q HP HQ. eapply HQ. destruct HP as [y HP'].
(** Doing [apply HP'] above fails with the following error:
Error: Impossible to unify "?175" with "y".
In this case there is an easy fix: doing [destruct HP] _before_
doing [eapply HQ].
*)
Abort.
Lemma silly2_fixed :
forall (P : nat -> nat -> Prop) (Q : nat -> Prop),
(exists y, P 42 y) ->
(forall x y : nat, P x y -> Q x) ->
Q 42.
Proof.
intros P Q HP HQ. destruct HP as [y HP'].
eapply HQ. apply HP'.
Qed.
(** The [apply HP'] in the last step unifies the existential variable
in the goal with the variable [y].
Note that the [assumption] tactic doesn't work in this case, since
it cannot handle existential variables. However, Coq also
provides an [eassumption] tactic that solves the goal if one of
the premises matches the goal up to instantiations of existential
variables. We can use it instead of [apply HP'] if we like. *)
Lemma silly2_eassumption : forall (P : nat -> nat -> Prop) (Q : nat -> Prop),
(exists y, P 42 y) ->
(forall x y : nat, P x y -> Q x) ->
Q 42.
Proof.
intros P Q HP HQ. destruct HP as [y HP']. eapply HQ. eassumption.
Qed.
(** **** Exercise: 2 stars (hoare_asgn_examples_2) *)
(** Translate these informal Hoare triples...
{{ X + 1 <= 5 }} X ::= X + 1 {{ X <= 5 }}
{{ 0 <= 3 /\ 3 <= 5 }} X ::= 3 {{ 0 <= X /\ X <= 5 }}
...into formal statements (name them [assn_sub_ex1'] and
[assn_sub_ex2']) and use [hoare_asgn] and [hoare_consequence_pre]
to prove them. *)
Check (X ::= ANum 1). (* com *)
Check (X). (* id *)
(* Assertion := state -> Prop *)
Example assn_sub_ex1' :
{{ fun st => st X + 1 <= 5 }}
(X ::= APlus (AId X) (ANum 1))
{{ fun st => st X <= 5 }}.
Proof.
eapply hoare_consequence_pre.
apply hoare_asgn.
intros st H. apply H.
Qed.
Example assn_sub_ex2' :
{{ fun st => 0 <= 3 /\ 3 <= 5 }}
(X ::= (ANum 3))
{{ fun st => 0 <= st X /\ st X <= 5 }}.
Proof.
eapply hoare_consequence_pre.
apply hoare_asgn.
intros st H.
apply H.
Qed.
(** [] *)
(* ####################################################### *)
(** ** Skip *)
(** Since [SKIP] doesn't change the state, it preserves any
property [P]:
-------------------- (hoare_skip)
{{ P }} SKIP {{ P }}
*)
Theorem hoare_skip : forall P,
{{P}} SKIP {{P}}.
Proof.
intros P st st' H HP. inversion H. subst.
assumption. Qed.
(* ####################################################### *)
(** ** Sequencing *)
(** More interestingly, if the command [c1] takes any state where
[P] holds to a state where [Q] holds, and if [c2] takes any
state where [Q] holds to one where [R] holds, then doing [c1]
followed by [c2] will take any state where [P] holds to one
where [R] holds:
{{ P }} c1 {{ Q }}
{{ Q }} c2 {{ R }}
--------------------- (hoare_seq)
{{ P }} c1;;c2 {{ R }}
*)
Theorem hoare_seq : forall P Q R c1 c2,
{{Q}} c2 {{R}} ->
{{P}} c1 {{Q}} ->
{{P}} c1;;c2 {{R}}.
Proof.
intros P Q R c1 c2 H1 H2 st st' H12 Pre.
inversion H12; subst.
apply (H1 st'0 st'); try assumption.
apply (H2 st st'0); assumption. Qed.
(** Note that, in the formal rule [hoare_seq], the premises are
given in backwards order ([c2] before [c1]). This matches the
natural flow of information in many of the situations where we'll
use the rule, since the natural way to construct a Hoare-logic
proof is to begin at the end of the program (with the final
postcondition) and push postconditions backwards through commands
until we reach the beginning. *)
(** Informally, a nice way of displaying a proof using the sequencing
rule is as a "decorated program" where the intermediate assertion
[Q] is written between [c1] and [c2]:
{{ a = n }}
X ::= a;;
{{ X = n }} <---- decoration for Q
SKIP
{{ X = n }}
*)
(** Here's an example of a program involving both assignment and
sequencing. *)
Example hoare_asgn_example3 : forall a n,
{{fun st => aeval st a = n}}
(X ::= a;; SKIP)
{{fun st => st X = n}}.
Proof.
intros a n. eapply hoare_seq.
- (* right part of seq *)
apply hoare_skip.
- (* left part of seq *)
eapply hoare_consequence_pre. apply hoare_asgn.
intros st H. subst. reflexivity.
Qed.
(** We typically use [hoare_seq] in conjunction with
[hoare_consequence_pre] and the [eapply] tactic, as in this
example. *)
(** **** Exercise: 2 stars (hoare_asgn_example4) *)
(** Translate this "decorated program" into a formal proof:
{{ True }} ->>
{{ 1 = 1 }}
X ::= 1;;
{{ X = 1 }} ->>
{{ X = 1 /\ 2 = 2 }}
Y ::= 2
{{ X = 1 /\ Y = 2 }}
in class exercise:
{ X = m }
Z := 0
*)
(* Note: P [ X |-> a ] := (assn_sub X a P) (at level 10). *)
Example hoare_asgn_example4 :
{{fun st => True}} (X ::= (ANum 1);; Y ::= (ANum 2))
{{fun st => st X = 1 /\ st Y = 2}}.
Proof.
eapply hoare_seq.
(* Y ::= 2 *)
- apply hoare_asgn.
(* X ::= 3 *)
- eapply hoare_consequence_pre. apply hoare_asgn.
intros st H. unfold assn_sub; simpl. split.
* reflexivity.
* reflexivity.
Qed.
(** **** Exercise: 3 stars (swap_exercise) *)
(** Write an Imp program [c] that swaps the values of [X] and [Y] and
show that it satisfies the following specification:
{{X <= Y}} c {{Y <= X}}
*)
Definition swap_program : com :=
Z ::= (AId X) ;; X ::= (AId Y) ;; Y ::= (AId Z).
Theorem swap_exercise :
{{fun st => st X <= st Y}}
swap_program
{{fun st => st Y <= st X}}.
Proof.
eapply hoare_seq.
(* consider ( X ::= Y ; Y ::= Z) *)
+ eapply hoare_seq.
(* consider (Y ::= Z) *)
- apply hoare_asgn.
(* consider (X ::= Y) *)
- apply hoare_asgn.
+ eapply hoare_consequence_pre.
- apply hoare_asgn.
- intros st H. unfold assn_sub; simpl.
unfold t_update; simpl. apply H.
Qed.
(** **** Exercise: 3 stars (hoarestate1) *)
(** Explain why the following proposition can't be proven:
forall (a : aexp) (n : nat),
{{fun st => aeval st a = n}}
(X ::= (ANum 3);; Y ::= a)
{{fun st => st Y = n}}.
*)
(*
executing the program leads to this state:
(t_update (t_update st X 3) Y (aeval (t_update st X 3) a)) Y = n
Suppose a was the expression [AId X], then
[ aeval (update st X 3) a ] evaluates down to [ANum 3].
the running the code [update (...) Y (ANum 3))] updates Y to 3,
which may not equal n for all n.
*)
Check (@t_update).
Theorem hoarestat1 : forall (a : aexp) (n : nat),
{{fun st => aeval st a = n}}
(X ::= (ANum 3);; Y ::= a)
{{fun st => st Y = n}}.
Proof.
intros. eapply hoare_seq.
+ apply hoare_asgn.
+ eapply hoare_consequence_pre.
- apply hoare_asgn.
- intros st H. unfold assn_sub; simpl.
Abort. (* not provable by construction *)
(** [] *)
(* ####################################################### *)
(** ** Conditionals *)
(** What sort of rule do we want for reasoning about conditional
commands?
Certainly, if the same assertion [Q] holds after executing
either of the branches, then it holds after the whole conditional.
So we might be tempted to write:
{{P}} c1 {{Q}}
{{P}} c2 {{Q}}
--------------------------------
{{P}} IFB b THEN c1 ELSE c2 {{Q}}
However, this is rather weak. For example, using this rule,
we cannot show
{{ True }}
IFB X == 0
THEN Y ::= 2
ELSE Y ::= X + 1
FI
{{ X <= Y }}
since the rule tells us nothing about the state in which the
assignments take place in the "then" and "else" branches. *)
(** Fortunately, we can say something more precise. In the
"then" branch, we know that the boolean expression [b] evaluates to
[true], and in the "else" branch, we know it evaluates to [false].
Making this information available in the premises of the rule gives
us more information to work with when reasoning about the behavior
of [c1] and [c2] (i.e., the reasons why they establish the
postcondition [Q]). *)
(**
{{P /\ b}} c1 {{Q}}
{{P /\ ~b}} c2 {{Q}}
------------------------------------ (hoare_if)
{{P}} IFB b THEN c1 ELSE c2 FI {{Q}}
*)
(** To interpret this rule formally, we need to do a little work.
Strictly speaking, the assertion we've written, [P /\ b], is the
conjunction of an assertion and a boolean expression -- i.e., it
doesn't typecheck. To fix this, we need a way of formally
"lifting" any bexp [b] to an assertion. We'll write [bassn b] for
the assertion "the boolean expression [b] evaluates to [true] (in
the given state)." *)
Definition bassn b : Assertion :=
fun st => (beval st b = true).
(** A couple of useful facts about [bassn]: *)
Lemma bexp_eval_true : forall b st,
beval st b = true -> (bassn b) st.
Proof.
intros b st Hbe.
unfold bassn. assumption. Qed.
Lemma bexp_eval_false : forall b st,
beval st b = false -> ~ ((bassn b) st).
Proof.
intros b st Hbe contra.
unfold bassn in contra.
rewrite -> contra in Hbe. inversion Hbe. Qed.
(** Now we can formalize the Hoare proof rule for conditionals
and prove it correct. *)
Theorem hoare_if : forall P Q b c1 c2,
{{fun st => P st /\ bassn b st}} c1 {{Q}} ->
{{fun st => P st /\ ~(bassn b st)}} c2 {{Q}} ->
{{P}} (IFB b THEN c1 ELSE c2 FI) {{Q}}.
Proof.
intros P Q b c1 c2 HTrue HFalse st st' Hexp HP.
inversion Hexp; subst.
- (* b is true *)
apply (HTrue st st').
assumption.
split. assumption.
apply bexp_eval_true. assumption.
- (* b is false *)
apply (HFalse st st').
assumption.
split. assumption.
apply bexp_eval_false. assumption. Qed.
(** *** Example *)
(** Here is a formal proof that the program we used to motivate the
rule satisfies the specification we gave. *)
Example if_example :
{{fun st => True}}
IFB (BEq (AId X) (ANum 0))
THEN (Y ::= (ANum 2))
ELSE (Y ::= APlus (AId X) (ANum 1))
FI
{{fun st => st X <= st Y}}.
Proof.
(* WORKED IN CLASS *)
apply hoare_if.
- (* Then *)
eapply hoare_consequence_pre. apply hoare_asgn.
unfold bassn, assn_sub, t_update, assert_implies.
simpl. intros st [_ H].
apply beq_nat_true in H.
rewrite H. omega.
- (* Else *)
eapply hoare_consequence_pre. apply hoare_asgn.
unfold assn_sub, t_update, assert_implies.
simpl; intros st _. omega.
Qed.
(** **** Exercise: 2 stars (if_minus_plus) *)
(** Prove the following hoare triple using [hoare_if]: *)
Theorem if_minus_plus :
{{fun st => True}}
IFB (BLe (AId X) (AId Y))
THEN (Z ::= AMinus (AId Y) (AId X))
ELSE (Y ::= APlus (AId X) (AId Z))
FI
{{fun st => st Y = st X + st Z}}.
Proof.
apply hoare_if.
(* then *)
+ eapply hoare_consequence_pre.
- apply hoare_asgn.
- unfold bassn, assn_sub, t_update, assert_implies; simpl.
(* Lemma le_plus_minus_r n m : n <= m -> n + (m - n) = m. *)
intros st [H1 H2]. apply le_plus_minus. apply leb_iff in H2.
apply H2.
(* else *)
+ eapply hoare_consequence_pre.
- apply hoare_asgn.
- unfold bassn, assn_sub, t_update, assert_implies; simpl.
intros. reflexivity.
Qed.
(* ####################################################### *)
(** *** Exercise: One-sided conditionals *)
(** **** Exercise: 4 stars (if1_hoare) *)
(** In this exercise we consider extending Imp with "one-sided
conditionals" of the form [IF1 b THEN c FI]. Here [b] is a
boolean expression, and [c] is a command. If [b] evaluates to
[true], then command [c] is evaluated. If [b] evaluates to
[false], then [IF1 b THEN c FI] does nothing.
We recommend that you do this exercise before the ones that
follow, as it should help solidify your understanding of the
material. *)
(** The first step is to extend the syntax of commands and introduce
the usual notations. (We've done this for you. We use a separate
module to prevent polluting the global name space.) *)
Module If1.
Inductive com : Type :=
| CSkip : com
| CAss : id -> aexp -> com
| CSeq : com -> com -> com
| CIf : bexp -> com -> com -> com
| CWhile : bexp -> com -> com
| CIf1 : bexp -> com -> com.
Notation "'SKIP'" :=
CSkip.
Notation "c1 ;; c2" :=
(CSeq c1 c2) (at level 80, right associativity).
Notation "X '::=' a" :=
(CAss X a) (at level 60).
Notation "'WHILE' b 'DO' c 'END'" :=
(CWhile b c) (at level 80, right associativity).
Notation "'IFB' e1 'THEN' e2 'ELSE' e3 'FI'" :=
(CIf e1 e2 e3) (at level 80, right associativity).
Notation "'IF1' b 'THEN' c 'FI'" :=
(CIf1 b c) (at level 80, right associativity).
(** Next we need to extend the evaluation relation to accommodate
[IF1] branches. This is for you to do... What rule(s) need to be
added to [ceval] to evaluate one-sided conditionals? *)
Reserved Notation "c1 '/' st '\\' st'" (at level 40, st at level 39).
Inductive ceval : com -> state -> state -> Prop :=
| E_Skip : forall st : state, SKIP / st \\ st
| E_Ass : forall (st : state) (a1 : aexp) (n : nat) (X : id),
aeval st a1 = n -> (X ::= a1) / st \\ t_update st X n
| E_Seq : forall (c1 c2 : com) (st st' st'' : state),
c1 / st \\ st' -> c2 / st' \\ st'' -> (c1 ;; c2) / st \\ st''
| E_IfTrue : forall (st st' : state) (b1 : bexp) (c1 c2 : com),
beval st b1 = true ->
c1 / st \\ st' -> (IFB b1 THEN c1 ELSE c2 FI) / st \\ st'
| E_IfFalse : forall (st st' : state) (b1 : bexp) (c1 c2 : com),
beval st b1 = false ->
c2 / st \\ st' -> (IFB b1 THEN c1 ELSE c2 FI) / st \\ st'
| E_WhileEnd : forall (b1 : bexp) (st : state) (c1 : com),
beval st b1 = false -> (WHILE b1 DO c1 END) / st \\ st
| E_WhileLoop : forall (st st' st'' : state) (b1 : bexp) (c1 : com),
beval st b1 = true ->
c1 / st \\ st' ->
(WHILE b1 DO c1 END) / st' \\ st'' ->
(WHILE b1 DO c1 END) / st \\ st''
| E_IfTrue1 : forall (st st' : state) (b : bexp) (c : com),
beval st b = true ->
c / st \\ st' -> (IF1 b THEN c FI) / st \\ st'
| E_IfFalse1 : forall (st : state) (b : bexp) (c : com),
beval st b = false ->
c / st \\ st -> (IF1 b THEN c FI) / st \\ st
(* FILL IN HERE *)
where "c1 '/' st '\\' st'" := (ceval c1 st st').
(** Now we repeat (verbatim) the definition and notation of Hoare triples. *)
Definition hoare_triple (P:Assertion) (c:com) (Q:Assertion) : Prop :=
forall st st',
c / st \\ st' ->
P st ->
Q st'.
Notation "{{ P }} c {{ Q }}" := (hoare_triple P c Q)
(at level 90, c at next level)
: hoare_spec_scope.
(** Finally, we (i.e., you) need to state and prove a theorem,
[hoare_if1], that expresses an appropriate Hoare logic proof rule
for one-sided conditionals. Try to come up with a rule that is
both sound and as precise as possible. *)
Theorem hoare_if1 : forall P Q b c,
{{ fun st => P st /\ bassn b st }} c {{ Q }} ->
{{ fun st => P st /\ ~ bassn b st }} SKIP {{ Q }} ->
{{ P }} IF1 b THEN c FI {{ Q }}.
Proof.
intros P Q b c Ht Hf st st' Hexp Hp.
inversion Hexp; subst.
(* b is true *)
+ apply (Ht st st').
- assumption.
- split. assumption. assumption.
(* b is false *)
+ apply (Hf st' st').
- apply E_Skip.
- split. assumption. apply bexp_eval_false. assumption.
Qed.
(** *** Example *)
(** For full credit, prove formally [hoare_if1_good] that your rule is
precise enough to show the following valid Hoare triple:
{{ X + Y = Z }}
IF1 Y <> 0 THEN
X ::= X + Y
FI
{{ X = Z }}
*)
(* pasted from other modules *)
Theorem hoare_asgn : forall Q X a,
{{Q [X |-> a]}} (X ::= a) {{Q}}.
Proof.
unfold hoare_triple.
intros Q X a st st' HE HQ.
inversion HE. subst.
unfold assn_sub in HQ. assumption. Qed.
Theorem hoare_consequence_pre : forall (P P' Q : Assertion) c,
{{P'}} c {{Q}} ->
P ->> P' ->
{{P}} c {{Q}}.
Proof.
intros P P' Q c Hhoare Himp.
intros st st' Hc HP. apply (Hhoare st st').
assumption. apply Himp. assumption.
Qed.
Theorem hoare_skip : forall P,
{{P}} SKIP {{P}}.
Proof.
intros P st st' H HP. inversion H. subst.
assumption. Qed.
(** Hint: Your proof of this triple may need to use the other proof
rules also. Because we're working in a separate module, you'll
need to copy here the rules you find necessary. *)
Lemma hoare_if1_good :
{{ fun st => st X + st Y = st Z }}
IF1 BNot (BEq (AId Y) (ANum 0)) THEN
X ::= APlus (AId X) (AId Y)
FI
{{ fun st => st X = st Z }}.
Proof.
apply hoare_if1.
+ eapply hoare_consequence_pre.
- apply hoare_asgn.
- unfold bassn, assn_sub, assert_implies, t_update; simpl.
intros st [H1 H2]. apply H1.
+ eapply hoare_consequence_pre.
- apply hoare_skip.
- unfold bassn, assn_sub, assert_implies, t_update; simpl.
intros st [H1 H2]. unfold negb in H2.
destruct (st Y).
* rewrite <- H1. omega.
* simpl in H2. destruct H2. reflexivity.
Qed.
End If1.
(** [] *)
(* ####################################################### *)
(** ** Recap *)
(**
Idea: create a _domain specific logic_ for reasoning about properties of Imp programs.
- This hides the low-level details of the semantics of the program
- Leads to a compositional reasoning process
The basic structure is given by _Hoare triples_ of the form:
{{P}} c {{Q}}
- [P] and [Q] are properties about the state of the Imp program
- "If command [c] is started in a state satisfying assertion
[P], and if [c] eventually terminates in some final state,
then this final state will satisfy the assertion [Q]."
*)
(** The rules of Hoare Logic (so far): *)
(**
------------------------------ (hoare_asgn)
{{Q [X |-> a]}} X::=a {{Q}}
-------------------- (hoare_skip)
{{ P }} SKIP {{ P }}
{{ P }} c1 {{ Q }}
{{ Q }} c2 {{ R }}
--------------------- (hoare_seq)
{{ P }} c1;;c2 {{ R }}
{{P /\ b}} c1 {{Q}}
{{P /\ ~b}} c2 {{Q}}
------------------------------------ (hoare_if)
{{P}} IFB b THEN c1 ELSE c2 FI {{Q}}
{{P'}} c {{Q'}}
P ->> P'
Q' ->> Q
----------------------------- (hoare_consequence)
{{P}} c {{Q}}
*)
(* ####################################################### *)
(** ** Loops *)
(** Finally, we need a rule for reasoning about while loops. *)
(** Suppose we have a loop
WHILE b DO c END
and we want to find a pre-condition [P] and a post-condition
[Q] such that
{{P}} WHILE b DO c END {{Q}}
is a valid triple. *)
(** First of all, let's think about the case where [b] is false at the
beginning -- i.e., let's assume that the loop body never executes
at all. In this case, the loop behaves like [SKIP], so we might
be tempted to write: *)
(**
{{P}} WHILE b DO c END {{P}}.
*)
(**
But, as we remarked above for the conditional, we know a
little more at the end -- not just [P], but also the fact
that [b] is false in the current state. So we can enrich the
postcondition a little:
*)
(**
{{P}} WHILE b DO c END {{P /\ ~b}}
*)
(**
What about the case where the loop body _does_ get executed?
In order to ensure that [P] holds when the loop finally
exits, we certainly need to make sure that the command [c]
guarantees that [P] holds whenever [c] is finished.
Moreover, since [P] holds at the beginning of the first
execution of [c], and since each execution of [c]
re-establishes [P] when it finishes, we can always assume
that [P] holds at the beginning of [c]. This leads us to the
following rule:
*)
(**
{{P}} c {{P}}
-----------------------------------
{{P}} WHILE b DO c END {{P /\ ~b}}
*)
(**
This is almost the rule we want, but again it can be improved a
little: at the beginning of the loop body, we know not only that
[P] holds, but also that the guard [b] is true in the current
state. This gives us a little more information to use in
reasoning about [c] (showing that it establishes the invariant by
the time it finishes). This gives us the final version of the rule:
*)
(**
{{P /\ b}} c {{P}}
----------------------------------- (hoare_while)
{{P}} WHILE b DO c END {{P /\ ~b}}
The proposition [P] is called an _invariant_ of the loop.
*)
Lemma hoare_while : forall P b c,
{{fun st => P st /\ bassn b st}} c {{P}} ->
{{P}} WHILE b DO c END {{fun st => P st /\ ~ (bassn b st)}}.
Proof.
intros P b c Hhoare st st' He HP.
(* Like we've seen before, we need to reason by induction
on [He], because, in the "keep looping" case, its hypotheses
talk about the whole loop instead of just [c]. *)
remember (WHILE b DO c END) as wcom eqn:Heqwcom.
induction He;
try (inversion Heqwcom); subst; clear Heqwcom.
- (* E_WhileEnd *)
split. assumption. apply bexp_eval_false. assumption.
- (* E_WhileLoop *)
apply IHHe2. reflexivity.
apply (Hhoare st st'). assumption.
split. assumption. apply bexp_eval_true. assumption.
Qed.
(**
One subtlety in the terminology is that calling some assertion [P]
a "loop invariant" doesn't just mean that it is preserved by the
body of the loop in question (i.e., [{{P}} c {{P}}], where [c] is
the loop body), but rather that [P] _together with the fact that
the loop's guard is true_ is a sufficient precondition for [c] to
ensure [P] as a postcondition.
This is a slightly (but significantly) weaker requirement. For
example, if [P] is the assertion [X = 0], then [P] _is_ an
invariant of the loop
WHILE X = 2 DO X := 1 END
although it is clearly _not_ preserved by the body of the
loop.
*)
Example while_example :
{{fun st => st X <= 3}}
WHILE (BLe (AId X) (ANum 2))
DO X ::= APlus (AId X) (ANum 1) END
{{fun st => st X = 3}}.
Proof.
eapply hoare_consequence_post.
apply hoare_while.
eapply hoare_consequence_pre.
apply hoare_asgn.
unfold bassn, assn_sub, assert_implies, t_update. simpl.
intros st [H1 H2]. apply leb_complete in H2. omega.
unfold bassn, assert_implies. intros st [Hle Hb].
simpl in Hb. destruct (leb (st X) 2) eqn : Heqle.
exfalso. apply Hb; reflexivity.
apply leb_iff_conv in Heqle. omega.
Qed.
(** We can use the while rule to prove the following Hoare triple,
which may seem surprising at first... *)
Theorem always_loop_hoare : forall P Q,
{{P}} WHILE BTrue DO SKIP END {{Q}}.
Proof.
(* WORKED IN CLASS *)
intros P Q.
apply hoare_consequence_pre with (P' := fun st : state => True).
eapply hoare_consequence_post.
apply hoare_while.
- (* Loop body preserves invariant *)
apply hoare_post_true. intros st. apply I.
- (* Loop invariant and negated guard imply postcondition *)
simpl. intros st [Hinv Hguard].
exfalso. apply Hguard. reflexivity.
- (* Precondition implies invariant *)
intros st H. constructor. Qed.
(** Of course, this result is not surprising if we remember that
the definition of [hoare_triple] asserts that the postcondition
must hold _only_ when the command terminates. If the command
doesn't terminate, we can prove anything we like about the
post-condition. *)
(** Hoare rules that only talk about terminating commands are
often said to describe a logic of "partial" correctness. It is
also possible to give Hoare rules for "total" correctness, which
build in the fact that the commands terminate. However, in this
course we will only talk about partial correctness. *)
(* ####################################################### *)
(** *** Exercise: [REPEAT] *)
Module RepeatExercise.
(** **** Exercise: 4 stars, advanced (hoare_repeat) *)
(** In this exercise, we'll add a new command to our language of
commands: [REPEAT] c [UNTIL] a [END]. You will write the
evaluation rule for [repeat] and add a new Hoare rule to
the language for programs involving it. *)
Inductive com : Type :=
| CSkip : com
| CAsgn : id -> aexp -> com
| CSeq : com -> com -> com
| CIf : bexp -> com -> com -> com
| CWhile : bexp -> com -> com
| CRepeat : com -> bexp -> com.
(** [REPEAT] behaves like [WHILE], except that the loop guard is
checked _after_ each execution of the body, with the loop
repeating as long as the guard stays _false_. Because of this,
the body will always execute at least once. *)
Notation "'SKIP'" :=
CSkip.
Notation "c1 ;; c2" :=
(CSeq c1 c2) (at level 80, right associativity).
Notation "X '::=' a" :=
(CAsgn X a) (at level 60).
Notation "'WHILE' b 'DO' c 'END'" :=
(CWhile b c) (at level 80, right associativity).
Notation "'IFB' e1 'THEN' e2 'ELSE' e3 'FI'" :=
(CIf e1 e2 e3) (at level 80, right associativity).
Notation "'REPEAT' e1 'UNTIL' b2 'END'" :=
(CRepeat e1 b2) (at level 80, right associativity).
(** Add new rules for [REPEAT] to [ceval] below. You can use the rules
for [WHILE] as a guide, but remember that the body of a [REPEAT]
should always execute at least once, and that the loop ends when
the guard becomes true. Then update the [ceval_cases] tactic to
handle these added cases. *)
Inductive ceval : state -> com -> state -> Prop :=
| E_Skip : forall st,
ceval st SKIP st
| E_Ass : forall st a1 n X,
aeval st a1 = n ->
ceval st (X ::= a1) (t_update st X n)
| E_Seq : forall c1 c2 st st' st'',
ceval st c1 st' ->
ceval st' c2 st'' ->
ceval st (c1 ;; c2) st''
| E_IfTrue : forall st st' b1 c1 c2,
beval st b1 = true ->
ceval st c1 st' ->
ceval st (IFB b1 THEN c1 ELSE c2 FI) st'
| E_IfFalse : forall st st' b1 c1 c2,
beval st b1 = false ->
ceval st c2 st' ->
ceval st (IFB b1 THEN c1 ELSE c2 FI) st'
| E_WhileEnd : forall b1 st c1,
beval st b1 = false ->
ceval st (WHILE b1 DO c1 END) st
| E_WhileLoop : forall st st' st'' b1 c1,
beval st b1 = true ->
ceval st c1 st' ->
ceval st' (WHILE b1 DO c1 END) st'' ->
ceval st (WHILE b1 DO c1 END) st''
(* FILL IN HERE *)
.
(** A couple of definitions from above, copied here so they use the
new [ceval]. *)
Notation "c1 '/' st '\\' st'" := (ceval st c1 st')
(at level 40, st at level 39).
Definition hoare_triple (P:Assertion) (c:com) (Q:Assertion)
: Prop :=
forall st st', (c / st \\ st') -> P st -> Q st'.
Notation "{{ P }} c {{ Q }}" :=
(hoare_triple P c Q) (at level 90, c at next level).
(** To make sure you've got the evaluation rules for [REPEAT] right,
prove that [ex1_repeat evaluates correctly. *)
Definition ex1_repeat :=
REPEAT
X ::= ANum 1;;
Y ::= APlus (AId Y) (ANum 1)
UNTIL (BEq (AId X) (ANum 1)) END.
Theorem ex1_repeat_works :
ex1_repeat / empty_state \\
t_update (t_update empty_state X 1) Y 1.
Proof.
(* FILL IN HERE *) Admitted.
(** Now state and prove a theorem, [hoare_repeat], that expresses an
appropriate proof rule for [repeat] commands. Use [hoare_while]
as a model, and try to make your rule as precise as possible. *)
(* FILL IN HERE *)
(** For full credit, make sure (informally) that your rule can be used
to prove the following valid Hoare triple:
{{ X > 0 }}
REPEAT
Y ::= X;;
X ::= X - 1
UNTIL X = 0 END
{{ X = 0 /\ Y > 0 }}
*)
End RepeatExercise.
(** [] *)
(* ####################################################### *)
(** * Summary *)
(** Above, we've introduced Hoare Logic as a tool to reasoning
about Imp programs. In the reminder of this chapter we will
explore a systematic way to use Hoare Logic to prove properties
about programs. The rules of Hoare Logic are the following: *)
(**
------------------------------ (hoare_asgn)
{{Q [X |-> a]}} X::=a {{Q}}
-------------------- (hoare_skip)
{{ P }} SKIP {{ P }}
{{ P }} c1 {{ Q }}
{{ Q }} c2 {{ R }}
--------------------- (hoare_seq)
{{ P }} c1;;c2 {{ R }}
{{P /\ b}} c1 {{Q}}
{{P /\ ~b}} c2 {{Q}}
------------------------------------ (hoare_if)
{{P}} IFB b THEN c1 ELSE c2 FI {{Q}}
{{P /\ b}} c {{P}}
----------------------------------- (hoare_while)
{{P}} WHILE b DO c END {{P /\ ~b}}
{{P'}} c {{Q'}}
P ->> P'
Q' ->> Q
----------------------------- (hoare_consequence)
{{P}} c {{Q}}
In the next chapter, we'll see how these rules are used to prove
that programs satisfy specifications of their behavior.
*)
(* ####################################################### *)
(** * Additional Exercises *)
(** **** Exercise: 3 stars (himp_hoare) *)
(** In this exercise, we will derive proof rules for the [HAVOC]
command, which we studied in the last chapter.
First, we enclose this work in a separate module, and recall the
syntax and big-step semantics of Himp commands. *)
Module Himp.
Inductive com : Type :=
| CSkip : com
| CAsgn : id -> aexp -> com
| CSeq : com -> com -> com
| CIf : bexp -> com -> com -> com
| CWhile : bexp -> com -> com
| CHavoc : id -> com.
Notation "'SKIP'" :=
CSkip.
Notation "X '::=' a" :=
(CAsgn X a) (at level 60).
Notation "c1 ;; c2" :=
(CSeq c1 c2) (at level 80, right associativity).
Notation "'WHILE' b 'DO' c 'END'" :=
(CWhile b c) (at level 80, right associativity).
Notation "'IFB' e1 'THEN' e2 'ELSE' e3 'FI'" :=
(CIf e1 e2 e3) (at level 80, right associativity).
Notation "'HAVOC' X" := (CHavoc X) (at level 60).
Reserved Notation "c1 '/' st '\\' st'" (at level 40, st at level 39).
Inductive ceval : com -> state -> state -> Prop :=
| E_Skip : forall st : state, SKIP / st \\ st
| E_Ass : forall (st : state) (a1 : aexp) (n : nat) (X : id),
aeval st a1 = n -> (X ::= a1) / st \\ t_update st X n
| E_Seq : forall (c1 c2 : com) (st st' st'' : state),
c1 / st \\ st' -> c2 / st' \\ st'' -> (c1 ;; c2) / st \\ st''
| E_IfTrue : forall (st st' : state) (b1 : bexp) (c1 c2 : com),
beval st b1 = true ->
c1 / st \\ st' -> (IFB b1 THEN c1 ELSE c2 FI) / st \\ st'
| E_IfFalse : forall (st st' : state) (b1 : bexp) (c1 c2 : com),
beval st b1 = false ->
c2 / st \\ st' -> (IFB b1 THEN c1 ELSE c2 FI) / st \\ st'
| E_WhileEnd : forall (b1 : bexp) (st : state) (c1 : com),
beval st b1 = false -> (WHILE b1 DO c1 END) / st \\ st
| E_WhileLoop : forall (st st' st'' : state) (b1 : bexp) (c1 : com),
beval st b1 = true ->
c1 / st \\ st' ->
(WHILE b1 DO c1 END) / st' \\ st'' ->
(WHILE b1 DO c1 END) / st \\ st''
| E_Havoc : forall (st : state) (X : id) (n : nat),
(HAVOC X) / st \\ t_update st X n
where "c1 '/' st '\\' st'" := (ceval c1 st st').
(** The definition of Hoare triples is exactly as before. Unlike our
notion of program equivalence, which had subtle consequences with
occassionally nonterminating commands (exercise [havoc_diverge]),
this definition is still fully satisfactory. Convince yourself of
this before proceeding. *)
Definition hoare_triple (P:Assertion) (c:com) (Q:Assertion) : Prop :=
forall st st', c / st \\ st' -> P st -> Q st'.
Notation "{{ P }} c {{ Q }}" := (hoare_triple P c Q)
(at level 90, c at next level)
: hoare_spec_scope.
(** Complete the Hoare rule for [HAVOC] commands below by defining
[havoc_pre] and prove that the resulting rule is correct. *)
(* Assertion := state -> Prop *)
Definition havoc_pre (X : id) (Q : Assertion) : Assertion :=
fun st => forall n, Q (t_update st X n).
Theorem hoare_havoc : forall (Q : Assertion) (X : id),
{{ havoc_pre X Q }} HAVOC X {{ Q }}.
Proof.
intros Q X st st' H1 H2.
inversion H1; subst.
unfold havoc_pre in H2. apply H2.
Qed.
End Himp.
(** [] *)
(** $Date: 2016-03-04 09:33:20 -0500 (Fri, 04 Mar 2016) $ *)
|
[STATEMENT]
lemma set_bind_iff:
"set (List.bind xs f) = Set.bind (set xs) (set \<circ> f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. set (xs \<bind> f) = set xs \<bind> set \<circ> f
[PROOF STEP]
by(induct xs)(simp_all add: insert_bind_set)
|
'''
Module that makes timeline graphs from csv data.
'''
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def plot_timeline(file_name):
'''
Makes timeline graphs from csv data.
'''
# data frame from rounded data file
df = pd.read_csv(file_name)
# find all par for graphs
time = df['computer_time']
# plotting
fig, (x_acc_1, y_acc_1, x_gyro_1, y_gyro_1, x_acc_2,
y_acc_2, x_gyro_2, y_gyro_2) = plt.subplots(8, 1)
x_acc_1.plot(time, df['x_acc_1'].tolist())
x_acc_1.set_title('x_acc_1')
y_acc_1.plot(time, df['y_acc_1'].tolist())
y_acc_1.set_title('y_acc_1')
x_gyro_1.plot(time, df['x_gyro_1'].tolist())
x_gyro_1.set_title('x_gyro_1')
y_gyro_1.plot(time, df['y_gyro_1'].tolist())
y_gyro_1.set_title('y_gyro_1')
x_acc_2.plot(time, df['x_acc_2'].tolist())
x_acc_2.set_title('x_acc_2')
y_acc_2.plot(time, df['y_acc_2'].tolist())
y_acc_2.set_title('y_acc_2')
x_gyro_2.plot(time, df['x_gyro_2'].tolist())
x_gyro_2.set_title('x_gyro_2')
y_gyro_2.plot(time, df['y_gyro_2'].tolist())
y_gyro_2.set_title('y_gyro_2')
fig.subplots_adjust(hspace=0.5)
plt.show()
# plt.savefig(new)
# if __name__ == "__main__":
# plot_timeline('walking.csv')
|
C *********************************************************
C * *
C * TEST NUMBER: 04.01.03/01 *
C * TEST TITLE : Text element *
C * *
C * PHIGS Validation Tests, produced by NIST *
C * *
C *********************************************************
COMMON /GLOBNU/ CTLHND, ERRSIG, ERRFIL, IERRCT, UNERR,
1 TESTCT, IFLERR, PASSSW, ERRSW, MAXLIN,
2 CONID, MEMUN, WKID, WTYPE, GLBLUN, INDLUN,
3 DUMINT, DUMRL
INTEGER CTLHND, ERRSIG, ERRFIL, IERRCT, UNERR,
1 TESTCT, IFLERR, PASSSW, ERRSW, MAXLIN,
2 CONID, MEMUN, WKID, WTYPE, GLBLUN, INDLUN,
3 DUMINT(20), ERRIND
REAL DUMRL(20)
COMMON /GLOBCH/ PIDENT, GLBERR, TSTMSG, FUNCID,
1 DUMCH
CHARACTER PIDENT*40, GLBERR*60, TSTMSG*900, FUNCID*80,
1 DUMCH(20)*20
C Declare program-specific variables
INTEGER CELTYP, INTLEN, INTG, RLLEN, RL, STRLEN, STR, INLEN,
1 STLEN, RELEN, STRID
PARAMETER (INLEN = 50, STLEN = 10, RELEN = 50, STRID = 1)
INTEGER INTAR(INLEN), STRARL(STLEN)
REAL XCORD, YCORD, ZCORD, XDV(2), YDV(2), ZDV(2), RLAR(RELEN)
CHARACTER STRAR(STLEN)*50, CHASTR*17, ACSTR*200
INTEGER ACS, NACS, IXACS, IDUM1,IDUM2,IDUM3,IDUM4,IDUM5,IDUM6
CALL INITGL ('04.01.03/01')
C open PHIGS
CALL XPOPPH (ERRFIL, MEMUN)
C *** *** *** *** *** Text 3 *** *** *** *** ***
XCORD = 2.33
YCORD = -4.4
ZCORD = 3.2E22
CHASTR = '*#Testing#* ..123'
XDV(1) = -99.99
YDV(1) = 0.0
ZDV(1) = 3.2E-13
XDV(2) = 7.30
YDV(2) = -9876.5
ZDV(2) = -99E-9
C <text 3> with xcord, ycord, zcord, xdv, ydv, zdv, chastr
CALL POPST (STRID)
CALL PTX3 (XCORD, YCORD, ZCORD, XDV, YDV, ZDV, CHASTR)
C <inquire current element type and size> to set celtyp, celsiz
CALL SETMSG ('1 2', '<Inquire current element type and size> ' //
1 'should return text 3 as the type of the ' //
2 'created element and the appropriate element ' //
3 'size.')
C (celtyp = text 3 and
C celsiz = values specified by the standard and language binding;
C fortran binding values are intlen, rllen, and strlen)
CALL PQCETS (ERRIND, CELTYP, INTLEN, RLLEN, STRLEN)
CALL IFPF (ERRIND .EQ. 0 .AND.
1 CELTYP .EQ. 6 .AND.
2 INTLEN .EQ. 0 .AND.
3 RLLEN .EQ. 9 .AND.
4 STRLEN .EQ. 1)
CALL SETMSG ('1 3', '<Inquire current element content> should ' //
1 'return the standard representation for text 3.')
C ensure garbage in strar prior to inquire
STRAR(1) = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
CALL PQCECO (INLEN, RELEN, STLEN, ERRIND, INTG, INTAR,
1 RL, RLAR, STR, STRARL, STRAR)
CALL IFPF (ERRIND .EQ. 0 .AND.
1 INTG .EQ. 0 .AND.
2 RL .EQ. 9 .AND.
3 RLAR(1) .EQ. XCORD .AND.
4 RLAR(2) .EQ. YCORD .AND.
5 RLAR(3) .EQ. ZCORD .AND.
6 RLAR(4) .EQ. XDV(1) .AND.
7 RLAR(5) .EQ. YDV(1) .AND.
8 RLAR(6) .EQ. ZDV(1) .AND.
9 RLAR(7) .EQ. XDV(2) .AND.
O RLAR(8) .EQ. YDV(2) .AND.
1 RLAR(9) .EQ. ZDV(2) .AND.
2 STR .EQ. 1 .AND.
3 STRARL(1) .EQ. 17 .AND.
4 STRAR(1) .EQ. CHASTR)
C *** *** *** *** *** Text *** *** *** *** ***
C <text> with xcord, ycord, chastr
CALL PTX (XCORD, YCORD, CHASTR)
C <inquire current element type and size> to set celtyp, celsiz
CALL SETMSG ('4 5', '<Inquire current element type and size> ' //
1 'should return text as the type of the ' //
2 'created element and the appropriate element ' //
3 'size.')
C (celtyp = text and
C celsiz = values specified by the standard and language binding;
C fortran binding values are intlen, rllen, and strlen)
CALL PQCETS (ERRIND, CELTYP, INTLEN, RLLEN, STRLEN)
CALL IFPF (ERRIND .EQ. 0 .AND.
1 CELTYP .EQ. 7 .AND.
2 INTLEN .EQ. 0 .AND.
3 RLLEN .EQ. 2 .AND.
4 STRLEN .EQ. 1)
CALL SETMSG ('4 6', '<Inquire current element content> should ' //
1 'return the standard representation for ' //
2 'text.')
C ensure garbage in strar prior to inquire
STRAR(1) = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
CALL PQCECO (INLEN, RELEN, STLEN, ERRIND, INTG, INTAR,
1 RL, RLAR, STR, STRARL, STRAR)
CALL IFPF (ERRIND .EQ. 0 .AND.
1 INTG .EQ. 0 .AND.
3 RL .EQ. 2 .AND.
4 RLAR(1) .EQ. XCORD .AND.
5 RLAR(2) .EQ. YCORD .AND.
6 STR .EQ. 1 .AND.
7 STRARL(1) .EQ. 17 .AND.
8 STRAR(1) .EQ. CHASTR)
C *** *** *** *** *** Character sets *** *** *** *** ***
CALL SETMSG ('7', '<Inquire phigs facilities> should be able ' //
1 'to report the list of available character sets.')
NACS = -6
CALL PQPHF (0, ERRIND, IDUM1, IDUM2, IDUM3, NACS,
1 IDUM4, IDUM5, IDUM6)
IF (ERRIND .NE. 0 .OR. NACS .LT. 0) THEN
CALL FAIL
GOTO 777
ENDIF
ACSTR = ' '
DO 710 IXACS = 1,NACS
CALL PQPHF (IXACS, ERRIND, IDUM1, IDUM2, IDUM3, IDUM4,
1 ACS, IDUM5, IDUM6)
IF (ERRIND .NE. 0) THEN
CALL FAIL
GOTO 777
ENDIF
C collect character sets
WRITE (ACSTR(IXACS*5-4:IXACS*5), '(I5)') ACS
710 CONTINUE
CALL PASS
CALL INMSG ('Character sets in list:' // ACSTR)
CALL SETMSG ('7 8', 'The first entry in the list of ' //
1 'available character sets should be zero.')
IF (NACS .GE. 1) THEN
CALL PQPHF (1, ERRIND, IDUM1, IDUM2, IDUM3, IDUM4,
1 ACS, IDUM5, IDUM6)
CALL CHKINQ ('pqphf', ERRIND)
CALL IFPF (ACS .EQ. 0)
ELSE
CALL FAIL
ENDIF
777 CONTINUE
C wrap it up
CALL ENDIT
END
|
lemma continuous_on_compact_surface_projection_aux: fixes S :: "'a::t2_space set" assumes "compact S" "S \<subseteq> T" "image q T \<subseteq> S" and contp: "continuous_on T p" and "\<And>x. x \<in> S \<Longrightarrow> q x = x" and [simp]: "\<And>x. x \<in> T \<Longrightarrow> q(p x) = q x" and "\<And>x. x \<in> T \<Longrightarrow> p(q x) = p x" shows "continuous_on T q"
|
# This file is a part of JuliaFEM.
# License is MIT: see https://github.com/JuliaFEM/Materials.jl/blob/master/LICENSE
using FEMMaterials, Tensors, Test
analysis, problem, element, bc_elements, ip = get_one_element_material_analysis(:Chaboche)
update!(element, "E", 200.0e3)
update!(element, "nu", 0.3)
update!(element, "R0", 100.0)
update!(element, "Kn", 10.0)
update!(element, "nn", 20.0)
update!(element, "C1", 0.0)
update!(element, "D1", 100.0)
update!(element, "C2", 0.0)
update!(element, "D2", 1000.0)
update!(element, "Q", 0.0)
update!(element, "b", 0.1)
times = [0.0]
loads = [0.0]
dt = 0.5
E = 200.0e3
nu = 0.3
G = 0.5*E/(1+nu)
syield = 100.0
# vm = sqrt(3)*G*ga | ea = ga
ea = 2*syield/(sqrt(3)*G)
# Go to elastic border
push!(times, times[end]+dt)
push!(loads, loads[end] + ea*dt)
# Proceed to plastic flow
push!(times, times[end]+dt)
push!(loads, loads[end] + ea*dt)
# Reverse direction
push!(times, times[end]+dt)
push!(loads, loads[end] - ea*dt)
# Continue and pass yield criterion
push!(times, times[end]+dt)
push!(loads, loads[end] - 2*ea*dt)
loading = ShearStrainLoading(times, loads)
update_bc_elements!(bc_elements, loading)
analysis.properties.t1 = maximum(times)
run!(analysis)
stresses = zeros(length(times), 6)
for (i,t) in zip(1:length(times), times)
stresses[i,:] = tovoigt(ip("stress", t))
@test isapprox(stresses[i,[1,2,3,4,6]], zeros(5); atol=1e-6)
end
s31 = stresses[:,5]
eeqs = [ip("cumeq", t) for t in times]
@test isapprox(s31[2], syield/sqrt(3.0))
@test isapprox(s31[3]*sqrt(3.0), syield + 10.0*((eeqs[3]-eeqs[2])/dt)^(1.0/20.0); rtol=1e-2)
@test isapprox(s31[4], s31[3]-G*ea*dt)
@test isapprox(s31[5]*sqrt(3.0), -(syield + 10.0*((eeqs[5]-eeqs[4])/dt)^(1.0/20.0)); rtol=1e-2)
|
#include <boost/qvm/mat_traits.hpp>
|
import dolfin as df
import numpy as np
import belement_magpar
import finmag.util.solid_angle_magpar as solid_angle_solver
compute_belement = belement_magpar.return_bele_magpar()
compute_solid_angle = solid_angle_solver.return_csa_magpar()
def GetDet3(x, y, z):
"""
helper function
"""
d = x[0] * y[1] * z[2] + x[1] * y[2] * z[0] \
+ x[2] * y[0] * z[1] - x[0] * y[2] * z[1] \
- x[1] * y[0] * z[2] - x[2] * y[1] * z[0]
return d
def GetTetVol(x1, x2, x3, x4):
"""
helper fuctioen
"""
v = GetDet3(x2, x3, x4) - GetDet3(x1, x3, x4) + \
GetDet3(x1, x2, x4) - GetDet3(x1, x2, x3)
return 1.0 / 6.0 * v
def compute_bnd_mapping(mesh, debug=False):
mesh.init()
number_nodes = mesh.num_vertices()
number_cells = mesh.num_cells()
number_nodes_bnd = 0
number_faces_bnd = 0
bnd_face_verts = []
gnodes_to_bnodes = np.zeros(number_nodes, int)
node_at_boundary = np.zeros(number_nodes, int)
nodes_xyz = mesh.coordinates()
for face in df.faces(mesh):
cells = face.entities(3)
if len(cells) == 1:
face_nodes = face.entities(0)
cell = df.Cell(mesh, cells[0])
cell_nodes = cell.entities(0)
# print set(cell_nodes)-set(face_nodes),face_nodes
tmp_set = set(cell_nodes) - set(face_nodes)
x1 = nodes_xyz[tmp_set.pop()]
x2 = nodes_xyz[face_nodes[0]]
x3 = nodes_xyz[face_nodes[1]]
x4 = nodes_xyz[face_nodes[2]]
tmp_vol = GetTetVol(x1, x2, x3, x4)
local_nodes = [face_nodes[0]]
if tmp_vol < 0:
local_nodes.append(face_nodes[2])
local_nodes.append(face_nodes[1])
else:
local_nodes.append(face_nodes[1])
local_nodes.append(face_nodes[2])
bnd_face_verts.append(local_nodes)
for i in face_nodes:
node_at_boundary[i] = 1
number_faces_bnd += 1
bnd_face_verts = np.array(bnd_face_verts)
number_nodes_bnd = 0
for i in range(number_nodes):
if node_at_boundary[i] > 0:
gnodes_to_bnodes[i] = number_nodes_bnd
number_nodes_bnd += 1
else:
gnodes_to_bnodes[i] = -1
if debug:
print 'cells number:', mesh.num_cells()
print 'nodes number:', mesh.num_vertices()
# print mesh.coordinates()
print 'faces:', mesh.num_faces()
print 'faces number at the boundary:', number_faces_bnd
print 'nodes number at the boundary:', number_nodes_bnd
for i in range(number_nodes):
tmp = gnodes_to_bnodes[i]
print 'global id=', i, nodes_xyz[i][0], nodes_xyz[i][1], nodes_xyz[i][2], tmp
for i in range(number_faces_bnd):
print ' ', bnd_face_verts[i][0], bnd_face_verts[i][1], bnd_face_verts[i][2]
return (bnd_face_verts, gnodes_to_bnodes, number_faces_bnd, number_nodes_bnd)
def BEM_matrix(mesh):
bnd_face_verts,\
gnodes_to_bnodes,\
number_faces_bnd,\
number_nodes_bnd = compute_bnd_mapping(mesh, debug=False)
B = np.zeros((number_nodes_bnd, number_nodes_bnd))
nodes_xyz = mesh.coordinates()
tmp_bele = np.array([0., 0., 0.])
number_nodes = mesh.num_vertices()
for i in range(number_nodes):
# skip the node at the boundary
if gnodes_to_bnodes[i] < 0:
continue
for j in range(number_faces_bnd):
# skip the node in the face
if i in set(bnd_face_verts[j]):
continue
compute_belement(nodes_xyz[i],
nodes_xyz[bnd_face_verts[j][0]],
nodes_xyz[bnd_face_verts[j][1]],
nodes_xyz[bnd_face_verts[j][2]], tmp_bele)
"""print 'tmp_bele',tmp_bele"""
for k in range(3):
tmp_i = gnodes_to_bnodes[i]
tmp_j = gnodes_to_bnodes[bnd_face_verts[j][k]]
B[tmp_i][tmp_j] += tmp_bele[k]
# the solid angle term ...
vert_bsa = np.zeros(number_nodes)
mapping_cell_nodes = mesh.cells()
for i in range(mesh.num_cells()):
for j in range(4):
tmp_omega = compute_solid_angle(
nodes_xyz[mapping_cell_nodes[i][j]],
nodes_xyz[mapping_cell_nodes[i][(j + 1) % 4]],
nodes_xyz[mapping_cell_nodes[i][(j + 2) % 4]],
nodes_xyz[mapping_cell_nodes[i][(j + 3) % 4]])
vert_bsa[mapping_cell_nodes[i][j]] += tmp_omega
for i in range(number_nodes):
tmp_i = gnodes_to_bnodes[i]
if tmp_i < 0:
continue
B[tmp_i][tmp_i] += vert_bsa[i] / (4 * np.pi) - 1
return B, gnodes_to_bnodes
def test_order():
mesh = df.Mesh('tet.xml')
xs = mesh.coordinates()
print xs
print mesh.cells()
print 'volume:', GetTetVol(xs[0], xs[1], xs[2], xs[3])
print 'volume:', GetTetVol(xs[1], xs[0], xs[2], xs[3])
print 'solid angle 1', compute_solid_angle(xs[0], xs[1], xs[2], xs[3])
print 'solid angle 2', compute_solid_angle(xs[0], xs[2], xs[1], xs[3])
bele = np.array([0, 0.0, 0])
compute_belement(xs[0], xs[1], xs[2], xs[3], bele)
print 'belement 1', bele
compute_belement(xs[0], xs[2], xs[1], xs[3], bele)
print 'belement 2', bele
if __name__ == "__main__":
# test_order()
mesh = df.Mesh('cube.xml')
print BEM_matrix(mesh)
|
[GOAL]
R : Type u_1
M : Type u_2
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
S : Submodule R M
h : Fintype (M ⧸ S)
⊢ cardQuot S = Fintype.card (M ⧸ S)
[PROOFSTEP]
suffices Fintype (M ⧸ S.toAddSubgroup) by convert AddSubgroup.index_eq_card S.toAddSubgroup
[GOAL]
R : Type u_1
M : Type u_2
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
S : Submodule R M
h : Fintype (M ⧸ S)
this : Fintype (M ⧸ toAddSubgroup S)
⊢ cardQuot S = Fintype.card (M ⧸ S)
[PROOFSTEP]
convert AddSubgroup.index_eq_card S.toAddSubgroup
[GOAL]
R : Type u_1
M : Type u_2
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
S : Submodule R M
h : Fintype (M ⧸ S)
⊢ Fintype (M ⧸ toAddSubgroup S)
[PROOFSTEP]
convert h
[GOAL]
R : Type u_1
M : Type u_2
inst✝² : Ring R
inst✝¹ : AddCommGroup M
inst✝ : Module R M
P : Submodule R M
⊢ toAddSubgroup P = ⊤ ↔ P = ⊤
[PROOFSTEP]
simp [SetLike.ext_iff]
[GOAL]
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
let b := Module.Free.chooseBasis ℤ S
[GOAL]
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
cases isEmpty_or_nonempty (Module.Free.ChooseBasisIndex ℤ S)
[GOAL]
case inl
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty (Module.Free.ChooseBasisIndex ℤ S)
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
haveI : Subsingleton S := Function.Surjective.subsingleton b.repr.toEquiv.symm.surjective
[GOAL]
case inl
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty (Module.Free.ChooseBasisIndex ℤ S)
this : Subsingleton S
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
nontriviality S
[GOAL]
case inl
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty (Module.Free.ChooseBasisIndex ℤ S)
this : Subsingleton S
inst✝ : Nontrivial S
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
exfalso
[GOAL]
case inl.h
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty (Module.Free.ChooseBasisIndex ℤ S)
this : Subsingleton S
inst✝ : Nontrivial S
⊢ False
[PROOFSTEP]
exact not_nontrivial_iff_subsingleton.mpr ‹Subsingleton S› ‹Nontrivial S›
[GOAL]
case inr
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
haveI : Infinite S := Infinite.of_surjective _ b.repr.toEquiv.surjective
[GOAL]
case inr
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this : Infinite S
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
by_cases hI : I = ⊥
[GOAL]
case pos
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this : Infinite S
hI : I = ⊥
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
rw [hI, Submodule.bot_mul, cardQuot_bot, zero_mul]
[GOAL]
case neg
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this : Infinite S
hI : ¬I = ⊥
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
by_cases hJ : J = ⊥
[GOAL]
case pos
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this : Infinite S
hI : ¬I = ⊥
hJ : J = ⊥
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
rw [hJ, Submodule.mul_bot, cardQuot_bot, mul_zero]
[GOAL]
case neg
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this : Infinite S
hI : ¬I = ⊥
hJ : ¬J = ⊥
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
have hIJ : I * J ≠ ⊥ := mt Ideal.mul_eq_bot.mp (not_or_of_not hI hJ)
[GOAL]
case neg
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this : Infinite S
hI : ¬I = ⊥
hJ : ¬J = ⊥
hIJ : I * J ≠ ⊥
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
letI := Classical.decEq (Module.Free.ChooseBasisIndex ℤ S)
[GOAL]
case neg
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this✝ : Infinite S
hI : ¬I = ⊥
hJ : ¬J = ⊥
hIJ : I * J ≠ ⊥
this : DecidableEq (Module.Free.ChooseBasisIndex ℤ S) := Classical.decEq (Module.Free.ChooseBasisIndex ℤ S)
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
letI := I.fintypeQuotientOfFreeOfNeBot hI
[GOAL]
case neg
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this✝¹ : Infinite S
hI : ¬I = ⊥
hJ : ¬J = ⊥
hIJ : I * J ≠ ⊥
this✝ : DecidableEq (Module.Free.ChooseBasisIndex ℤ S) := Classical.decEq (Module.Free.ChooseBasisIndex ℤ S)
this : Fintype (S ⧸ I) := Ideal.fintypeQuotientOfFreeOfNeBot I hI
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
letI := J.fintypeQuotientOfFreeOfNeBot hJ
[GOAL]
case neg
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this✝² : Infinite S
hI : ¬I = ⊥
hJ : ¬J = ⊥
hIJ : I * J ≠ ⊥
this✝¹ : DecidableEq (Module.Free.ChooseBasisIndex ℤ S) := Classical.decEq (Module.Free.ChooseBasisIndex ℤ S)
this✝ : Fintype (S ⧸ I) := Ideal.fintypeQuotientOfFreeOfNeBot I hI
this : Fintype (S ⧸ J) := Ideal.fintypeQuotientOfFreeOfNeBot J hJ
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
letI := (I * J).fintypeQuotientOfFreeOfNeBot hIJ
[GOAL]
case neg
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
coprime : I ⊔ J = ⊤
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this✝³ : Infinite S
hI : ¬I = ⊥
hJ : ¬J = ⊥
hIJ : I * J ≠ ⊥
this✝² : DecidableEq (Module.Free.ChooseBasisIndex ℤ S) := Classical.decEq (Module.Free.ChooseBasisIndex ℤ S)
this✝¹ : Fintype (S ⧸ I) := Ideal.fintypeQuotientOfFreeOfNeBot I hI
this✝ : Fintype (S ⧸ J) := Ideal.fintypeQuotientOfFreeOfNeBot J hJ
this : Fintype (S ⧸ I * J) := Ideal.fintypeQuotientOfFreeOfNeBot (I * J) hIJ
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
rw [cardQuot_apply, cardQuot_apply, cardQuot_apply,
Fintype.card_eq.mpr ⟨(Ideal.quotientMulEquivQuotientProd I J coprime).toEquiv⟩, Fintype.card_prod]
[GOAL]
S : Type u_1
inst✝¹ : CommRing S
inst✝ : IsDomain S
P : Ideal S
i : ℕ
a d d' e e' : S
a_mem : a ∈ P ^ i
e_mem : e ∈ P ^ (i + 1)
e'_mem : e' ∈ P ^ (i + 1)
h : d - d' ∈ P
⊢ a * d + e - (a * d' + e') ∈ P ^ (i + 1)
[PROOFSTEP]
have : a * d - a * d' ∈ P ^ (i + 1) := by
convert Ideal.mul_mem_mul a_mem h using 1 <;> simp [mul_sub, pow_succ, mul_comm]
[GOAL]
S : Type u_1
inst✝¹ : CommRing S
inst✝ : IsDomain S
P : Ideal S
i : ℕ
a d d' e e' : S
a_mem : a ∈ P ^ i
e_mem : e ∈ P ^ (i + 1)
e'_mem : e' ∈ P ^ (i + 1)
h : d - d' ∈ P
⊢ a * d - a * d' ∈ P ^ (i + 1)
[PROOFSTEP]
convert Ideal.mul_mem_mul a_mem h using 1
[GOAL]
case h.e'_4
S : Type u_1
inst✝¹ : CommRing S
inst✝ : IsDomain S
P : Ideal S
i : ℕ
a d d' e e' : S
a_mem : a ∈ P ^ i
e_mem : e ∈ P ^ (i + 1)
e'_mem : e' ∈ P ^ (i + 1)
h : d - d' ∈ P
⊢ a * d - a * d' = a * (d - d')
[PROOFSTEP]
simp [mul_sub, pow_succ, mul_comm]
[GOAL]
case h.e'_5
S : Type u_1
inst✝¹ : CommRing S
inst✝ : IsDomain S
P : Ideal S
i : ℕ
a d d' e e' : S
a_mem : a ∈ P ^ i
e_mem : e ∈ P ^ (i + 1)
e'_mem : e' ∈ P ^ (i + 1)
h : d - d' ∈ P
⊢ P ^ (i + 1) = P ^ i * P
[PROOFSTEP]
simp [mul_sub, pow_succ, mul_comm]
[GOAL]
S : Type u_1
inst✝¹ : CommRing S
inst✝ : IsDomain S
P : Ideal S
i : ℕ
a d d' e e' : S
a_mem : a ∈ P ^ i
e_mem : e ∈ P ^ (i + 1)
e'_mem : e' ∈ P ^ (i + 1)
h : d - d' ∈ P
this : a * d - a * d' ∈ P ^ (i + 1)
⊢ a * d + e - (a * d' + e') ∈ P ^ (i + 1)
[PROOFSTEP]
convert Ideal.add_mem _ this (Ideal.sub_mem _ e_mem e'_mem) using 1
[GOAL]
case h.e'_4
S : Type u_1
inst✝¹ : CommRing S
inst✝ : IsDomain S
P : Ideal S
i : ℕ
a d d' e e' : S
a_mem : a ∈ P ^ i
e_mem : e ∈ P ^ (i + 1)
e'_mem : e' ∈ P ^ (i + 1)
h : d - d' ∈ P
this : a * d - a * d' ∈ P ^ (i + 1)
⊢ a * d + e - (a * d' + e') = a * d - a * d' + (e - e')
[PROOFSTEP]
ring
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a c : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
c_mem : c ∈ P ^ i
⊢ ∃ d e, e ∈ P ^ (i + 1) ∧ a * d + e = c
[PROOFSTEP]
suffices eq_b : P ^ i = Ideal.span { a } ⊔ P ^ (i + 1)
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a c : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
c_mem : c ∈ P ^ i
eq_b : P ^ i = span {a} ⊔ P ^ (i + 1)
⊢ ∃ d e, e ∈ P ^ (i + 1) ∧ a * d + e = c
[PROOFSTEP]
rw [eq_b] at c_mem
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a c : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
c_mem : c ∈ span {a} ⊔ P ^ (i + 1)
eq_b : P ^ i = span {a} ⊔ P ^ (i + 1)
⊢ ∃ d e, e ∈ P ^ (i + 1) ∧ a * d + e = c
[PROOFSTEP]
simp only [mul_comm a]
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a c : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
c_mem : c ∈ span {a} ⊔ P ^ (i + 1)
eq_b : P ^ i = span {a} ⊔ P ^ (i + 1)
⊢ ∃ d e, e ∈ P ^ (i + 1) ∧ d * a + e = c
[PROOFSTEP]
exact Ideal.mem_span_singleton_sup.mp c_mem
[GOAL]
case eq_b
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a c : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
c_mem : c ∈ P ^ i
⊢ P ^ i = span {a} ⊔ P ^ (i + 1)
[PROOFSTEP]
refine
(Ideal.eq_prime_pow_of_succ_lt_of_le hP (lt_of_le_of_ne le_sup_right ?_)
(sup_le (Ideal.span_le.mpr (Set.singleton_subset_iff.mpr a_mem)) (Ideal.pow_succ_lt_pow hP i).le)).symm
[GOAL]
case eq_b
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a c : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
c_mem : c ∈ P ^ i
⊢ P ^ (i + 1) ≠ span {a} ⊔ P ^ (i + 1)
[PROOFSTEP]
contrapose! a_not_mem with this
[GOAL]
case eq_b
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a c : S
a_mem : a ∈ P ^ i
c_mem : c ∈ P ^ i
this : P ^ (i + 1) = span {a} ⊔ P ^ (i + 1)
⊢ a ∈ P ^ (i + 1)
[PROOFSTEP]
rw [this]
[GOAL]
case eq_b
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a c : S
a_mem : a ∈ P ^ i
c_mem : c ∈ P ^ i
this : P ^ (i + 1) = span {a} ⊔ P ^ (i + 1)
⊢ a ∈ span {a} ⊔ P ^ (i + 1)
[PROOFSTEP]
exact mem_sup.mpr ⟨a, mem_span_singleton_self a, 0, by simp, by simp⟩
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a c : S
a_mem : a ∈ P ^ i
c_mem : c ∈ P ^ i
this : P ^ (i + 1) = span {a} ⊔ P ^ (i + 1)
⊢ 0 ∈ P ^ (i + 1)
[PROOFSTEP]
simp
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a c : S
a_mem : a ∈ P ^ i
c_mem : c ∈ P ^ i
this : P ^ (i + 1) = span {a} ⊔ P ^ (i + 1)
⊢ a + 0 = a
[PROOFSTEP]
simp
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P✝ : Ideal S
P_prime✝ : IsPrime P✝
hP✝ : P✝ ≠ ⊥
inst✝ : IsDedekindDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
i : ℕ
a b : S
a_not_mem : ¬a ∈ P ^ (i + 1)
ab_mem : a * b ∈ P ^ (i + 1)
⊢ b ∈ P
[PROOFSTEP]
simp only [← Ideal.span_singleton_le_iff_mem, ← Ideal.dvd_iff_le, pow_succ, ←
Ideal.span_singleton_mul_span_singleton] at a_not_mem ab_mem ⊢
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P✝ : Ideal S
P_prime✝ : IsPrime P✝
hP✝ : P✝ ≠ ⊥
inst✝ : IsDedekindDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
i : ℕ
a b : S
a_not_mem : ¬P * P ^ i ∣ span {a}
ab_mem : P * P ^ i ∣ span {a} * span {b}
⊢ P ∣ span {b}
[PROOFSTEP]
exact (prime_pow_succ_dvd_mul (Ideal.prime_of_isPrime hP P_prime) ab_mem).resolve_left a_not_mem
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a d d' e e' : S
a_not_mem : ¬a ∈ P ^ (i + 1)
e_mem : e ∈ P ^ (i + 1)
e'_mem : e' ∈ P ^ (i + 1)
h : a * d + e - (a * d' + e') ∈ P ^ (i + 1)
⊢ d - d' ∈ P
[PROOFSTEP]
have h' : a * (d - d') ∈ P ^ (i + 1) :=
by
convert Ideal.add_mem _ h (Ideal.sub_mem _ e'_mem e_mem) using 1
ring
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a d d' e e' : S
a_not_mem : ¬a ∈ P ^ (i + 1)
e_mem : e ∈ P ^ (i + 1)
e'_mem : e' ∈ P ^ (i + 1)
h : a * d + e - (a * d' + e') ∈ P ^ (i + 1)
⊢ a * (d - d') ∈ P ^ (i + 1)
[PROOFSTEP]
convert Ideal.add_mem _ h (Ideal.sub_mem _ e'_mem e_mem) using 1
[GOAL]
case h.e'_4
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a d d' e e' : S
a_not_mem : ¬a ∈ P ^ (i + 1)
e_mem : e ∈ P ^ (i + 1)
e'_mem : e' ∈ P ^ (i + 1)
h : a * d + e - (a * d' + e') ∈ P ^ (i + 1)
⊢ a * (d - d') = a * d + e - (a * d' + e') + (e' - e)
[PROOFSTEP]
ring
[GOAL]
S : Type u_1
inst✝² : CommRing S
inst✝¹ : IsDomain S
P : Ideal S
P_prime : IsPrime P
hP : P ≠ ⊥
inst✝ : IsDedekindDomain S
i : ℕ
a d d' e e' : S
a_not_mem : ¬a ∈ P ^ (i + 1)
e_mem : e ∈ P ^ (i + 1)
e'_mem : e' ∈ P ^ (i + 1)
h : a * d + e - (a * d' + e') ∈ P ^ (i + 1)
h' : a * (d - d') ∈ P ^ (i + 1)
⊢ d - d' ∈ P
[PROOFSTEP]
exact Ideal.mem_prime_of_mul_mem_pow hP a_not_mem h'
[GOAL]
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
i : ℕ
⊢ cardQuot (P ^ i) = cardQuot P ^ i
[PROOFSTEP]
let _ := Module.Free.chooseBasis ℤ S
[GOAL]
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
i : ℕ
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
⊢ cardQuot (P ^ i) = cardQuot P ^ i
[PROOFSTEP]
classical
induction' i with i ih
· simp
letI := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i.succ) (pow_ne_zero _ hP)
letI := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (pow_ne_zero _ hP)
letI := Ideal.fintypeQuotientOfFreeOfNeBot P hP
have : P ^ (i + 1) < P ^ i := Ideal.pow_succ_lt_pow hP i
suffices hquot : map (P ^ i.succ).mkQ (P ^ i) ≃ S ⧸ P
· rw [pow_succ (cardQuot P), ← ih, cardQuot_apply (P ^ i.succ), ←
card_quotient_mul_card_quotient (P ^ i) (P ^ i.succ) this.le, cardQuot_apply (P ^ i), cardQuot_apply P]
congr 1
rw [Fintype.card_eq]
exact ⟨hquot⟩
choose a a_mem a_not_mem using SetLike.exists_of_lt this
choose f g hg hf using fun c (hc : c ∈ P ^ i) => Ideal.exists_mul_add_mem_pow_succ hP a c a_mem a_not_mem hc
choose k hk_mem hk_eq using fun c' (hc' : c' ∈ map (mkQ (P ^ i.succ)) (P ^ i)) => Submodule.mem_map.mp hc'
refine Equiv.ofBijective (fun c' => Quotient.mk'' (f (k c' c'.prop) (hk_mem c' c'.prop))) ⟨?_, ?_⟩
· rintro ⟨c₁', hc₁'⟩ ⟨c₂', hc₂'⟩ h
rw [Subtype.mk_eq_mk, ← hk_eq _ hc₁', ← hk_eq _ hc₂', mkQ_apply, mkQ_apply, Submodule.Quotient.eq, ←
hf _ (hk_mem _ hc₁'), ← hf _ (hk_mem _ hc₂')]
refine Ideal.mul_add_mem_pow_succ_inj _ _ _ _ _ _ a_mem (hg _ _) (hg _ _) ?_
simpa only [Submodule.Quotient.mk''_eq_mk, Submodule.Quotient.mk''_eq_mk, Submodule.Quotient.eq] using h
· intro d'
refine Quotient.inductionOn' d' fun d => ?_
have hd' := (mem_map (f := mkQ (P ^ i.succ))).mpr ⟨a * d, Ideal.mul_mem_right d _ a_mem, rfl⟩
refine ⟨⟨_, hd'⟩, ?_⟩
simp only [Submodule.Quotient.mk''_eq_mk, Ideal.Quotient.mk_eq_mk, Ideal.Quotient.eq, Subtype.coe_mk]
refine Ideal.mul_add_mem_pow_succ_unique hP a _ _ _ _ a_not_mem (hg _ (hk_mem _ hd')) (zero_mem _) ?_
rw [hf, add_zero]
exact (Submodule.Quotient.eq _).mp (hk_eq _ hd')
[GOAL]
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
i : ℕ
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
⊢ cardQuot (P ^ i) = cardQuot P ^ i
[PROOFSTEP]
induction' i with i ih
[GOAL]
case zero
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
⊢ cardQuot (P ^ Nat.zero) = cardQuot P ^ Nat.zero
[PROOFSTEP]
simp
[GOAL]
case succ
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
⊢ cardQuot (P ^ Nat.succ i) = cardQuot P ^ Nat.succ i
[PROOFSTEP]
letI := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i.succ) (pow_ne_zero _ hP)
[GOAL]
case succ
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
⊢ cardQuot (P ^ Nat.succ i) = cardQuot P ^ Nat.succ i
[PROOFSTEP]
letI := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (pow_ne_zero _ hP)
[GOAL]
case succ
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝ : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
⊢ cardQuot (P ^ Nat.succ i) = cardQuot P ^ Nat.succ i
[PROOFSTEP]
letI := Ideal.fintypeQuotientOfFreeOfNeBot P hP
[GOAL]
case succ
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝¹ : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
⊢ cardQuot (P ^ Nat.succ i) = cardQuot P ^ Nat.succ i
[PROOFSTEP]
have : P ^ (i + 1) < P ^ i := Ideal.pow_succ_lt_pow hP i
[GOAL]
case succ
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
⊢ cardQuot (P ^ Nat.succ i) = cardQuot P ^ Nat.succ i
[PROOFSTEP]
suffices hquot : map (P ^ i.succ).mkQ (P ^ i) ≃ S ⧸ P
[GOAL]
case succ
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
hquot : { x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } ≃ S ⧸ P
⊢ cardQuot (P ^ Nat.succ i) = cardQuot P ^ Nat.succ i
[PROOFSTEP]
rw [pow_succ (cardQuot P), ← ih, cardQuot_apply (P ^ i.succ), ←
card_quotient_mul_card_quotient (P ^ i) (P ^ i.succ) this.le, cardQuot_apply (P ^ i), cardQuot_apply P]
[GOAL]
case succ
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
hquot : { x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } ≃ S ⧸ P
⊢ Fintype.card { x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } * Fintype.card (S ⧸ P ^ i) =
Fintype.card (S ⧸ P) * Fintype.card (S ⧸ P ^ i)
[PROOFSTEP]
congr 1
[GOAL]
case succ.e_a
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
hquot : { x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } ≃ S ⧸ P
⊢ Fintype.card { x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } = Fintype.card (S ⧸ P)
[PROOFSTEP]
rw [Fintype.card_eq]
[GOAL]
case succ.e_a
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
hquot : { x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } ≃ S ⧸ P
⊢ Nonempty ({ x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } ≃ S ⧸ P)
[PROOFSTEP]
exact ⟨hquot⟩
[GOAL]
case hquot
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
⊢ { x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } ≃ S ⧸ P
[PROOFSTEP]
choose a a_mem a_not_mem using SetLike.exists_of_lt this
[GOAL]
case hquot
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
⊢ { x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } ≃ S ⧸ P
[PROOFSTEP]
choose f g hg hf using fun c (hc : c ∈ P ^ i) => Ideal.exists_mul_add_mem_pow_succ hP a c a_mem a_not_mem hc
[GOAL]
case hquot
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
⊢ { x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } ≃ S ⧸ P
[PROOFSTEP]
choose k hk_mem hk_eq using fun c' (hc' : c' ∈ map (mkQ (P ^ i.succ)) (P ^ i)) => Submodule.mem_map.mp hc'
[GOAL]
case hquot
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
⊢ { x // x ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) } ≃ S ⧸ P
[PROOFSTEP]
refine Equiv.ofBijective (fun c' => Quotient.mk'' (f (k c' c'.prop) (hk_mem c' c'.prop))) ⟨?_, ?_⟩
[GOAL]
case hquot.refine_1
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
⊢ Function.Injective fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i))
[PROOFSTEP]
rintro ⟨c₁', hc₁'⟩ ⟨c₂', hc₂'⟩ h
[GOAL]
case hquot.refine_1.mk.mk
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
c₁' : S ⧸ P ^ Nat.succ i
hc₁' : c₁' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
c₂' : S ⧸ P ^ Nat.succ i
hc₂' : c₂' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
h :
(fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
{ val := c₁', property := hc₁' } =
(fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
{ val := c₂', property := hc₂' }
⊢ { val := c₁', property := hc₁' } = { val := c₂', property := hc₂' }
[PROOFSTEP]
rw [Subtype.mk_eq_mk, ← hk_eq _ hc₁', ← hk_eq _ hc₂', mkQ_apply, mkQ_apply, Submodule.Quotient.eq, ←
hf _ (hk_mem _ hc₁'), ← hf _ (hk_mem _ hc₂')]
[GOAL]
case hquot.refine_1.mk.mk
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
c₁' : S ⧸ P ^ Nat.succ i
hc₁' : c₁' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
c₂' : S ⧸ P ^ Nat.succ i
hc₂' : c₂' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
h :
(fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
{ val := c₁', property := hc₁' } =
(fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
{ val := c₂', property := hc₂' }
⊢ a * f (k c₁' hc₁') (_ : k c₁' hc₁' ∈ P ^ i) + g (k c₁' hc₁') (_ : k c₁' hc₁' ∈ P ^ i) -
(a * f (k c₂' hc₂') (_ : k c₂' hc₂' ∈ P ^ i) + g (k c₂' hc₂') (_ : k c₂' hc₂' ∈ P ^ i)) ∈
P ^ Nat.succ i
[PROOFSTEP]
refine Ideal.mul_add_mem_pow_succ_inj _ _ _ _ _ _ a_mem (hg _ _) (hg _ _) ?_
[GOAL]
case hquot.refine_1.mk.mk
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
c₁' : S ⧸ P ^ Nat.succ i
hc₁' : c₁' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
c₂' : S ⧸ P ^ Nat.succ i
hc₂' : c₂' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
h :
(fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
{ val := c₁', property := hc₁' } =
(fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
{ val := c₂', property := hc₂' }
⊢ f (k c₁' hc₁') (_ : k c₁' hc₁' ∈ P ^ i) - f (k c₂' hc₂') (_ : k c₂' hc₂' ∈ P ^ i) ∈ P
[PROOFSTEP]
simpa only [Submodule.Quotient.mk''_eq_mk, Submodule.Quotient.mk''_eq_mk, Submodule.Quotient.eq] using h
[GOAL]
case hquot.refine_2
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
⊢ Function.Surjective fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i))
[PROOFSTEP]
intro d'
[GOAL]
case hquot.refine_2
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
d' : S ⧸ P
⊢ ∃ a,
(fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
a =
d'
[PROOFSTEP]
refine Quotient.inductionOn' d' fun d => ?_
[GOAL]
case hquot.refine_2
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
d' : S ⧸ P
d : S
⊢ ∃ a,
(fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
a =
Quotient.mk'' d
[PROOFSTEP]
have hd' := (mem_map (f := mkQ (P ^ i.succ))).mpr ⟨a * d, Ideal.mul_mem_right d _ a_mem, rfl⟩
[GOAL]
case hquot.refine_2
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
d' : S ⧸ P
d : S
hd' : ↑(mkQ (P ^ Nat.succ i)) (a * d) ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
⊢ ∃ a,
(fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
a =
Quotient.mk'' d
[PROOFSTEP]
refine ⟨⟨_, hd'⟩, ?_⟩
[GOAL]
case hquot.refine_2
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
d' : S ⧸ P
d : S
hd' : ↑(mkQ (P ^ Nat.succ i)) (a * d) ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
⊢ (fun c' =>
Quotient.mk''
(f (k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ : k ↑c' (_ : ↑c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈ P ^ i)))
{ val := ↑(mkQ (P ^ Nat.succ i)) (a * d), property := hd' } =
Quotient.mk'' d
[PROOFSTEP]
simp only [Submodule.Quotient.mk''_eq_mk, Ideal.Quotient.mk_eq_mk, Ideal.Quotient.eq, Subtype.coe_mk]
[GOAL]
case hquot.refine_2
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
d' : S ⧸ P
d : S
hd' : ↑(mkQ (P ^ Nat.succ i)) (a * d) ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
⊢ f
(k (↑(mkQ (P ^ Nat.succ i)) (a * d))
(_ : ↑{ val := ↑(mkQ (P ^ Nat.succ i)) (a * d), property := hd' } ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ :
k ↑{ val := ↑(mkQ (P ^ Nat.succ i)) (a * d), property := hd' }
(_ : ↑{ val := ↑(mkQ (P ^ Nat.succ i)) (a * d), property := hd' } ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈
P ^ i) -
d ∈
P
[PROOFSTEP]
refine Ideal.mul_add_mem_pow_succ_unique hP a _ _ _ _ a_not_mem (hg _ (hk_mem _ hd')) (zero_mem _) ?_
[GOAL]
case hquot.refine_2
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
d' : S ⧸ P
d : S
hd' : ↑(mkQ (P ^ Nat.succ i)) (a * d) ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
⊢ a *
f
(k (↑(mkQ (P ^ Nat.succ i)) (a * d))
(_ : ↑{ val := ↑(mkQ (P ^ Nat.succ i)) (a * d), property := hd' } ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)))
(_ :
k ↑{ val := ↑(mkQ (P ^ Nat.succ i)) (a * d), property := hd' }
(_ :
↑{ val := ↑(mkQ (P ^ Nat.succ i)) (a * d), property := hd' } ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) ∈
P ^ i) +
g (k (↑(mkQ (P ^ Nat.succ i)) (a * d)) hd') (_ : k (↑(mkQ (P ^ Nat.succ i)) (a * d)) hd' ∈ P ^ i) -
(a * d + 0) ∈
P ^ (i + 1)
[PROOFSTEP]
rw [hf, add_zero]
[GOAL]
case hquot.refine_2
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
P : Ideal S
P_prime : Ideal.IsPrime P
hP : P ≠ ⊥
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite ℤ S
inst✝ : Module.Free ℤ S
x✝ : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : ℕ
ih : cardQuot (P ^ i) = cardQuot P ^ i
this✝² : Fintype (S ⧸ P ^ Nat.succ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ Nat.succ i) (_ : P ^ Nat.succ i ≠ 0)
this✝¹ : Fintype (S ⧸ P ^ i) := Ideal.fintypeQuotientOfFreeOfNeBot (P ^ i) (_ : P ^ i ≠ 0)
this✝ : Fintype (S ⧸ P) := Ideal.fintypeQuotientOfFreeOfNeBot P hP
this : P ^ (i + 1) < P ^ i
a : S
a_mem : a ∈ P ^ i
a_not_mem : ¬a ∈ P ^ (i + 1)
f g : (c : S) → c ∈ P ^ i → S
hg : ∀ (c : S) (hc : c ∈ P ^ i), g c hc ∈ P ^ (i + 1)
hf : ∀ (c : S) (hc : c ∈ P ^ i), a * f c hc + g c hc = c
k : (c' : S ⧸ P ^ Nat.succ i) → c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i) → S
hk_mem : ∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), k c' hc' ∈ P ^ i
hk_eq :
∀ (c' : S ⧸ P ^ Nat.succ i) (hc' : c' ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)), ↑(mkQ (P ^ Nat.succ i)) (k c' hc') = c'
d' : S ⧸ P
d : S
hd' : ↑(mkQ (P ^ Nat.succ i)) (a * d) ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)
⊢ k (↑(mkQ (P ^ Nat.succ i)) (a * d))
(_ : ↑{ val := ↑(mkQ (P ^ Nat.succ i)) (a * d), property := hd' } ∈ map (mkQ (P ^ Nat.succ i)) (P ^ i)) -
a * d ∈
P ^ (i + 1)
[PROOFSTEP]
exact (Submodule.Quotient.eq _).mp (hk_eq _ hd')
[GOAL]
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
let b := Module.Free.chooseBasis ℤ S
[GOAL]
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
cases isEmpty_or_nonempty (Module.Free.ChooseBasisIndex ℤ S)
[GOAL]
case inl
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty (Module.Free.ChooseBasisIndex ℤ S)
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
haveI : Subsingleton S := Function.Surjective.subsingleton b.repr.toEquiv.symm.surjective
[GOAL]
case inl
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty (Module.Free.ChooseBasisIndex ℤ S)
this : Subsingleton S
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
nontriviality S
[GOAL]
case inl
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I J : Ideal S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty (Module.Free.ChooseBasisIndex ℤ S)
this : Subsingleton S
inst✝ : Nontrivial S
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
exfalso
[GOAL]
case inl.h
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I J : Ideal S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty (Module.Free.ChooseBasisIndex ℤ S)
this : Subsingleton S
inst✝ : Nontrivial S
⊢ False
[PROOFSTEP]
exact not_nontrivial_iff_subsingleton.mpr ‹Subsingleton S› ‹Nontrivial S›
[GOAL]
case inr
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
haveI : Infinite S := Infinite.of_surjective _ b.repr.toEquiv.surjective
[GOAL]
case inr
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this : Infinite S
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
exact
UniqueFactorizationMonoid.multiplicative_of_coprime cardQuot I J (cardQuot_bot _ _)
(fun {I J} hI => by simp [Ideal.isUnit_iff.mp hI, Ideal.mul_top])
(fun {I} i hI =>
have : Ideal.IsPrime I := Ideal.isPrime_of_prime hI
cardQuot_pow_of_prime hI.ne_zero)
fun {I J} hIJ =>
cardQuot_mul_of_coprime
(Ideal.isUnit_iff.mp (hIJ _ (Ideal.dvd_iff_le.mpr le_sup_left) (Ideal.dvd_iff_le.mpr le_sup_right)))
[GOAL]
S : Type u_1
inst✝⁴ : CommRing S
inst✝³ : IsDomain S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I✝ J✝ : Ideal S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty (Module.Free.ChooseBasisIndex ℤ S)
this : Infinite S
I J : Submodule S S
hI : IsUnit J
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
simp [Ideal.isUnit_iff.mp hI, Ideal.mul_top]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
⊢ cardQuot 0 = 0
[PROOFSTEP]
rw [Ideal.zero_eq_bot, cardQuot_bot]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
⊢ ZeroHom.toFun { toFun := cardQuot, map_zero' := (_ : cardQuot 0 = 0) } 1 = 1
[PROOFSTEP]
dsimp only
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
⊢ cardQuot 1 = 1
[PROOFSTEP]
rw [Ideal.one_eq_top, cardQuot_top]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
⊢ ZeroHom.toFun { toFun := cardQuot, map_zero' := (_ : cardQuot 0 = 0) } (I * J) =
ZeroHom.toFun { toFun := cardQuot, map_zero' := (_ : cardQuot 0 = 0) } I *
ZeroHom.toFun { toFun := cardQuot, map_zero' := (_ : cardQuot 0 = 0) } J
[PROOFSTEP]
dsimp only
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I J : Ideal S
⊢ cardQuot (I * J) = cardQuot I * cardQuot J
[PROOFSTEP]
rw [cardQuot_mul]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
⊢ ↑absNorm ⊥ = 0
[PROOFSTEP]
rw [← Ideal.zero_eq_bot, _root_.map_zero]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
⊢ ↑absNorm ⊤ = 1
[PROOFSTEP]
rw [← Ideal.one_eq_top, _root_.map_one]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I : Ideal S
⊢ ↑absNorm I = 1 ↔ I = ⊤
[PROOFSTEP]
rw [absNorm_apply, cardQuot_eq_one_iff]
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
by_cases hI : I = ⊥
[GOAL]
case pos
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : I = ⊥
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
subst hI
[GOAL]
case pos
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
E : Type u_2
e : E
inst✝ : AddEquivClass E S { x // x ∈ ⊥ }
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype ⊥)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm ⊥
[PROOFSTEP]
have : (1 : S) ≠ 0 := one_ne_zero
[GOAL]
case pos
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
E : Type u_2
e : E
inst✝ : AddEquivClass E S { x // x ∈ ⊥ }
this : 1 ≠ 0
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype ⊥)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm ⊥
[PROOFSTEP]
have : (1 : S) = 0 := EquivLike.injective e (Subsingleton.elim _ _)
[GOAL]
case pos
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
E : Type u_2
e : E
inst✝ : AddEquivClass E S { x // x ∈ ⊥ }
this✝ : 1 ≠ 0
this : 1 = 0
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype ⊥)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm ⊥
[PROOFSTEP]
contradiction
[GOAL]
case neg
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
let ι := Module.Free.ChooseBasisIndex ℤ S
[GOAL]
case neg
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
let b := Module.Free.chooseBasis ℤ S
[GOAL]
case neg
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
cases isEmpty_or_nonempty ι
[GOAL]
case neg.inl
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty ι
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
nontriviality S
[GOAL]
case neg.inl
S : Type u_1
inst✝⁷ : CommRing S
inst✝⁶ : IsDomain S
inst✝⁵ : Infinite S
inst✝⁴ : IsDedekindDomain S
inst✝³ : Module.Free ℤ S
inst✝² : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝¹ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty ι
inst✝ : Nontrivial S
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
exact
(not_nontrivial_iff_subsingleton.mpr (Function.Surjective.subsingleton b.repr.toEquiv.symm.surjective)
(by infer_instance)).elim
[GOAL]
S : Type u_1
inst✝⁷ : CommRing S
inst✝⁶ : IsDomain S
inst✝⁵ : Infinite S
inst✝⁴ : IsDedekindDomain S
inst✝³ : Module.Free ℤ S
inst✝² : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝¹ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : IsEmpty ι
inst✝ : Nontrivial S
⊢ Nontrivial S
[PROOFSTEP]
infer_instance
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
letI := Ideal.fintypeQuotientOfFreeOfNeBot I hI
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
letI := Classical.decEq ι
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
let a := I.smithCoeffs b hI
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
let b' := I.ringBasis b hI
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
let ab := I.selfBasis b hI
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
have ab_eq := I.selfBasis_def b hI
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
let e' : S ≃ₗ[ℤ] I := b'.equiv ab (Equiv.refl _)
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
let f : S →ₗ[ℤ] S := (I.subtype.restrictScalars ℤ).comp (e' : S →ₗ[ℤ] I)
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
let f_apply : ∀ x, f x = b'.equiv ab (Equiv.refl _) x := fun x => rfl
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
suffices (LinearMap.det f).natAbs = Ideal.absNorm I by
calc
_ = (LinearMap.det ((Submodule.subtype I).restrictScalars ℤ ∘ₗ (AddEquiv.toIntLinearEquiv e : S ≃ₗ[ℤ] I))).natAbs :=
rfl
_ = (LinearMap.det ((Submodule.subtype I).restrictScalars ℤ ∘ₗ _)).natAbs :=
(Int.natAbs_eq_iff_associated.mpr (LinearMap.associated_det_comp_equiv _ _ _))
_ = absNorm I := this
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
this : Int.natAbs (↑LinearMap.det f) = ↑absNorm I
⊢ Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) (AddMonoidHom.toIntLinearMap ↑e))) = ↑absNorm I
[PROOFSTEP]
calc
_ = (LinearMap.det ((Submodule.subtype I).restrictScalars ℤ ∘ₗ (AddEquiv.toIntLinearEquiv e : S ≃ₗ[ℤ] I))).natAbs :=
rfl
_ = (LinearMap.det ((Submodule.subtype I).restrictScalars ℤ ∘ₗ _)).natAbs :=
(Int.natAbs_eq_iff_associated.mpr (LinearMap.associated_det_comp_equiv _ _ _))
_ = absNorm I := this
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
⊢ Int.natAbs (↑LinearMap.det f) = ↑absNorm I
[PROOFSTEP]
have ha : ∀ i, f (b' i) = a i • b' i := by intro i;
rw [f_apply, b'.equiv_apply, Equiv.refl_apply, ab_eq]
-- `det f` is equal to `∏ i, a i`,
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
⊢ ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
[PROOFSTEP]
intro i
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
i : Module.Free.ChooseBasisIndex ℤ S
⊢ ↑f (↑b' i) = a i • ↑b' i
[PROOFSTEP]
rw [f_apply, b'.equiv_apply, Equiv.refl_apply, ab_eq]
-- `det f` is equal to `∏ i, a i`,
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
⊢ Int.natAbs (↑LinearMap.det f) = ↑absNorm I
[PROOFSTEP]
letI := Classical.decEq ι
[GOAL]
case neg.inr
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this : DecidableEq ι := Classical.decEq ι
⊢ Int.natAbs (↑LinearMap.det f) = ↑absNorm I
[PROOFSTEP]
calc
Int.natAbs (LinearMap.det f) = Int.natAbs (LinearMap.toMatrix b' b' f).det := by rw [LinearMap.det_toMatrix]
_ = Int.natAbs (Matrix.diagonal a).det := ?_
_ = Int.natAbs (∏ i, a i) := by rw [Matrix.det_diagonal]
_ = ∏ i, Int.natAbs (a i) := (map_prod Int.natAbsHom a Finset.univ)
_ = Fintype.card (S ⧸ I) := ?_
_ = absNorm I := (Submodule.cardQuot_apply _).symm
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this : DecidableEq ι := Classical.decEq ι
⊢ Int.natAbs (↑LinearMap.det f) = Int.natAbs (Matrix.det (↑(LinearMap.toMatrix b' b') f))
[PROOFSTEP]
rw [LinearMap.det_toMatrix]
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this : DecidableEq ι := Classical.decEq ι
⊢ Int.natAbs (Matrix.det (Matrix.diagonal a)) = Int.natAbs (∏ i : Module.Free.ChooseBasisIndex ℤ S, a i)
[PROOFSTEP]
rw [Matrix.det_diagonal]
[GOAL]
case neg.inr.calc_1
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this : DecidableEq ι := Classical.decEq ι
⊢ Int.natAbs (Matrix.det (↑(LinearMap.toMatrix b' b') f)) = Int.natAbs (Matrix.det (Matrix.diagonal a))
[PROOFSTEP]
congr 2
[GOAL]
case neg.inr.calc_1.e_m.e_M
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this : DecidableEq ι := Classical.decEq ι
⊢ ↑(LinearMap.toMatrix b' b') f = Matrix.diagonal a
[PROOFSTEP]
ext i j
[GOAL]
case neg.inr.calc_1.e_m.e_M.a.h
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this : DecidableEq ι := Classical.decEq ι
i j : Module.Free.ChooseBasisIndex ℤ S
⊢ ↑(LinearMap.toMatrix b' b') f i j = Matrix.diagonal a i j
[PROOFSTEP]
rw [LinearMap.toMatrix_apply, ha, LinearEquiv.map_smul, Basis.repr_self, Finsupp.smul_single, smul_eq_mul, mul_one]
[GOAL]
case neg.inr.calc_1.e_m.e_M.a.h
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this : DecidableEq ι := Classical.decEq ι
i j : Module.Free.ChooseBasisIndex ℤ S
⊢ ↑(Finsupp.single j (a j)) i = Matrix.diagonal a i j
[PROOFSTEP]
by_cases h : i = j
[GOAL]
case pos
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this : DecidableEq ι := Classical.decEq ι
i j : Module.Free.ChooseBasisIndex ℤ S
h : i = j
⊢ ↑(Finsupp.single j (a j)) i = Matrix.diagonal a i j
[PROOFSTEP]
rw [h, Matrix.diagonal_apply_eq, Finsupp.single_eq_same]
[GOAL]
case neg
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this : DecidableEq ι := Classical.decEq ι
i j : Module.Free.ChooseBasisIndex ℤ S
h : ¬i = j
⊢ ↑(Finsupp.single j (a j)) i = Matrix.diagonal a i j
[PROOFSTEP]
rw [Matrix.diagonal_apply_ne _ h, Finsupp.single_eq_of_ne (Ne.symm h)]
-- Now we map everything through the linear equiv `S ≃ₗ (ι → ℤ)`,
-- which maps `(S ⧸ I)` to `Π i, ZMod (a i).nat_abs`.
[GOAL]
case neg.inr.calc_2
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝¹ : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this : DecidableEq ι := Classical.decEq ι
⊢ ∏ i : Module.Free.ChooseBasisIndex ℤ S, Int.natAbs (a i) = Fintype.card (S ⧸ I)
[PROOFSTEP]
haveI : ∀ i, NeZero (a i).natAbs := fun i => ⟨Int.natAbs_ne_zero.mpr (Ideal.smithCoeffs_ne_zero b I hI i)⟩
[GOAL]
case neg.inr.calc_2
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
I : Ideal S
E : Type u_2
inst✝ : AddEquivClass E S { x // x ∈ I }
e : E
hI : ¬I = ⊥
ι : Type u_1 := Module.Free.ChooseBasisIndex ℤ S
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
h✝ : Nonempty ι
this✝² : Fintype (S ⧸ I) := fintypeQuotientOfFreeOfNeBot I hI
this✝¹ : DecidableEq ι := Classical.decEq ι
a : Module.Free.ChooseBasisIndex ℤ S → ℤ := smithCoeffs b I hI
b' : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := ringBasis b I hI
ab : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ { x // x ∈ I } := selfBasis b I hI
ab_eq :
∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑(↑(selfBasis b I hI) i) = smithCoeffs b I hI i • ↑(ringBasis b I hI) i
e' : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))
f : S →ₗ[ℤ] S := LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e'
f_apply : ∀ (x : S), ↑f x = ↑(↑(Basis.equiv b' ab (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S))) x) := fun x => rfl
ha : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), ↑f (↑b' i) = a i • ↑b' i
this✝ : DecidableEq ι := Classical.decEq ι
this : ∀ (i : Module.Free.ChooseBasisIndex ℤ S), NeZero (Int.natAbs (a i))
⊢ ∏ i : Module.Free.ChooseBasisIndex ℤ S, Int.natAbs (a i) = Fintype.card (S ⧸ I)
[PROOFSTEP]
simp_rw [Fintype.card_eq.mpr ⟨(Ideal.quotientEquivPiZMod I b hI).toEquiv⟩, Fintype.card_pi, ZMod.card]
[GOAL]
S : Type u_1
inst✝⁷ : CommRing S
inst✝⁶ : IsDomain S
inst✝⁵ : Infinite S
inst✝⁴ : IsDedekindDomain S
inst✝³ : Module.Free ℤ S
inst✝² : Module.Finite ℤ S
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
b : Basis ι ℤ S
I : Ideal S
bI : Basis ι ℤ { x // x ∈ I }
⊢ Int.natAbs (↑(Basis.det b) (Subtype.val ∘ ↑bI)) = ↑absNorm I
[PROOFSTEP]
let e := b.equiv bI (Equiv.refl _)
[GOAL]
S : Type u_1
inst✝⁷ : CommRing S
inst✝⁶ : IsDomain S
inst✝⁵ : Infinite S
inst✝⁴ : IsDedekindDomain S
inst✝³ : Module.Free ℤ S
inst✝² : Module.Finite ℤ S
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
b : Basis ι ℤ S
I : Ideal S
bI : Basis ι ℤ { x // x ∈ I }
e : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b bI (Equiv.refl ι)
⊢ Int.natAbs (↑(Basis.det b) (Subtype.val ∘ ↑bI)) = ↑absNorm I
[PROOFSTEP]
calc
(b.det ((Submodule.subtype I).restrictScalars ℤ ∘ bI)).natAbs =
(LinearMap.det ((Submodule.subtype I).restrictScalars ℤ ∘ₗ (e : S →ₗ[ℤ] I))).natAbs :=
by rw [Basis.det_comp_basis]
_ = _ := natAbs_det_equiv I e
[GOAL]
S : Type u_1
inst✝⁷ : CommRing S
inst✝⁶ : IsDomain S
inst✝⁵ : Infinite S
inst✝⁴ : IsDedekindDomain S
inst✝³ : Module.Free ℤ S
inst✝² : Module.Finite ℤ S
ι : Type u_2
inst✝¹ : Fintype ι
inst✝ : DecidableEq ι
b : Basis ι ℤ S
I : Ideal S
bI : Basis ι ℤ { x // x ∈ I }
e : S ≃ₗ[ℤ] { x // x ∈ I } := Basis.equiv b bI (Equiv.refl ι)
⊢ Int.natAbs (↑(Basis.det b) (↑(↑ℤ (Submodule.subtype I)) ∘ ↑bI)) =
Int.natAbs (↑LinearMap.det (LinearMap.comp (↑ℤ (Submodule.subtype I)) ↑e))
[PROOFSTEP]
rw [Basis.det_comp_basis]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
r : S
⊢ ↑absNorm (span {r}) = Int.natAbs (↑(Algebra.norm ℤ) r)
[PROOFSTEP]
rw [Algebra.norm_apply]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
r : S
⊢ ↑absNorm (span {r}) = Int.natAbs (↑LinearMap.det (↑(Algebra.lmul ℤ S) r))
[PROOFSTEP]
by_cases hr : r = 0
[GOAL]
case pos
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
r : S
hr : r = 0
⊢ ↑absNorm (span {r}) = Int.natAbs (↑LinearMap.det (↑(Algebra.lmul ℤ S) r))
[PROOFSTEP]
simp only [hr, Ideal.span_zero, Algebra.coe_lmul_eq_mul, eq_self_iff_true, Ideal.absNorm_bot, LinearMap.det_zero'',
Set.singleton_zero, _root_.map_zero, Int.natAbs_zero]
[GOAL]
case neg
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
r : S
hr : ¬r = 0
⊢ ↑absNorm (span {r}) = Int.natAbs (↑LinearMap.det (↑(Algebra.lmul ℤ S) r))
[PROOFSTEP]
letI := Ideal.fintypeQuotientOfFreeOfNeBot (span { r }) (mt span_singleton_eq_bot.mp hr)
[GOAL]
case neg
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
r : S
hr : ¬r = 0
this : Fintype (S ⧸ span {r}) := fintypeQuotientOfFreeOfNeBot (span {r}) (_ : ¬span {r} = ⊥)
⊢ ↑absNorm (span {r}) = Int.natAbs (↑LinearMap.det (↑(Algebra.lmul ℤ S) r))
[PROOFSTEP]
let b := Module.Free.chooseBasis ℤ S
[GOAL]
case neg
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
r : S
hr : ¬r = 0
this : Fintype (S ⧸ span {r}) := fintypeQuotientOfFreeOfNeBot (span {r}) (_ : ¬span {r} = ⊥)
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
⊢ ↑absNorm (span {r}) = Int.natAbs (↑LinearMap.det (↑(Algebra.lmul ℤ S) r))
[PROOFSTEP]
rw [← natAbs_det_equiv _ (b.equiv (basisSpanSingleton b hr) (Equiv.refl _))]
[GOAL]
case neg
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
r : S
hr : ¬r = 0
this : Fintype (S ⧸ span {r}) := fintypeQuotientOfFreeOfNeBot (span {r}) (_ : ¬span {r} = ⊥)
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
⊢ Int.natAbs
(↑LinearMap.det
(LinearMap.comp (↑ℤ (Submodule.subtype (span {r})))
(AddMonoidHom.toIntLinearMap
↑(Basis.equiv b (basisSpanSingleton b hr) (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S)))))) =
Int.natAbs (↑LinearMap.det (↑(Algebra.lmul ℤ S) r))
[PROOFSTEP]
congr
[GOAL]
case neg.e_m.h.e_6.h
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
r : S
hr : ¬r = 0
this : Fintype (S ⧸ span {r}) := fintypeQuotientOfFreeOfNeBot (span {r}) (_ : ¬span {r} = ⊥)
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
⊢ LinearMap.comp (↑ℤ (Submodule.subtype (span {r})))
(AddMonoidHom.toIntLinearMap
↑(Basis.equiv b (basisSpanSingleton b hr) (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S)))) =
↑(Algebra.lmul ℤ S) r
[PROOFSTEP]
refine b.ext fun i => ?_
[GOAL]
case neg.e_m.h.e_6.h
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
r : S
hr : ¬r = 0
this : Fintype (S ⧸ span {r}) := fintypeQuotientOfFreeOfNeBot (span {r}) (_ : ¬span {r} = ⊥)
b : Basis (Module.Free.ChooseBasisIndex ℤ S) ℤ S := Module.Free.chooseBasis ℤ S
i : Module.Free.ChooseBasisIndex ℤ S
⊢ ↑(LinearMap.comp (↑ℤ (Submodule.subtype (span {r})))
(AddMonoidHom.toIntLinearMap
↑(Basis.equiv b (basisSpanSingleton b hr) (Equiv.refl (Module.Free.ChooseBasisIndex ℤ S)))))
(↑b i) =
↑(↑(Algebra.lmul ℤ S) r) (↑b i)
[PROOFSTEP]
simp
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I : Ideal S
x : S
h : x ∈ I
⊢ ↑(↑absNorm I) ∣ ↑(Algebra.norm ℤ) x
[PROOFSTEP]
rw [← Int.dvd_natAbs, ← absNorm_span_singleton x, Int.coe_nat_dvd]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I : Ideal S
x : S
h : x ∈ I
⊢ ↑absNorm I ∣ ↑absNorm (span {x})
[PROOFSTEP]
exact absNorm_dvd_absNorm_of_le ((span_singleton_le_iff_mem _).mpr h)
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
r : S
s : Set S
⊢ ↑absNorm (span {r}) ∣ Int.natAbs (↑(Algebra.norm ℤ) r)
[PROOFSTEP]
rw [absNorm_span_singleton]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I : Ideal S
hI : Irreducible (↑absNorm I)
h : IsUnit I
⊢ IsUnit (↑absNorm I)
[PROOFSTEP]
simpa only [Ideal.isUnit_iff, Nat.isUnit_iff, absNorm_eq_one_iff] using h
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I : Ideal S
hI : Irreducible (↑absNorm I)
⊢ ∀ (a b : Ideal S), I = a * b → IsUnit a ∨ IsUnit b
[PROOFSTEP]
rintro a b rfl
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
a b : Ideal S
hI : Irreducible (↑absNorm (a * b))
⊢ IsUnit a ∨ IsUnit b
[PROOFSTEP]
simpa only [Ideal.isUnit_iff, Nat.isUnit_iff, absNorm_eq_one_iff] using hI.isUnit_or_isUnit (_root_.map_mul absNorm a b)
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I : Ideal S
⊢ ↑(↑absNorm I) ∈ I
[PROOFSTEP]
rw [absNorm_apply, cardQuot, ← Ideal.Quotient.eq_zero_iff_mem, map_natCast, Quotient.index_eq_zero]
[GOAL]
S : Type u_1
inst✝⁵ : CommRing S
inst✝⁴ : IsDomain S
inst✝³ : Infinite S
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Free ℤ S
inst✝ : Module.Finite ℤ S
I : Ideal S
⊢ span {↑(↑absNorm I)} ≤ I
[PROOFSTEP]
simp only [Ideal.span_le, Set.singleton_subset_iff, SetLike.mem_coe, Ideal.absNorm_mem I]
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
⊢ Set.Finite {I | ↑absNorm I = n}
[PROOFSTEP]
let f := fun I : Ideal S => Ideal.map (Ideal.Quotient.mk (@Ideal.span S _ {↑n})) I
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
f : Ideal S → Ideal (S ⧸ span {↑n}) := fun I => map (Quotient.mk (span {↑n})) I
⊢ Set.Finite {I | ↑absNorm I = n}
[PROOFSTEP]
refine @Set.Finite.of_finite_image _ _ _ f ?_ ?_
[GOAL]
case refine_1
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
f : Ideal S → Ideal (S ⧸ span {↑n}) := fun I => map (Quotient.mk (span {↑n})) I
⊢ Set.Finite (f '' {I | ↑absNorm I = n})
[PROOFSTEP]
suffices Finite (S ⧸ @Ideal.span S _ {↑n})
by
let g := ((↑) : Ideal (S ⧸ @Ideal.span S _ {↑n}) → Set (S ⧸ @Ideal.span S _ {↑n}))
refine @Set.Finite.of_finite_image _ _ _ g ?_ (SetLike.coe_injective.injOn _)
exact Set.Finite.subset (@Set.finite_univ _ (@Set.finite' _ this)) (Set.subset_univ _)
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
f : Ideal S → Ideal (S ⧸ span {↑n}) := fun I => map (Quotient.mk (span {↑n})) I
this : Finite (S ⧸ span {↑n})
⊢ Set.Finite (f '' {I | ↑absNorm I = n})
[PROOFSTEP]
let g := ((↑) : Ideal (S ⧸ @Ideal.span S _ {↑n}) → Set (S ⧸ @Ideal.span S _ {↑n}))
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
f : Ideal S → Ideal (S ⧸ span {↑n}) := fun I => map (Quotient.mk (span {↑n})) I
this : Finite (S ⧸ span {↑n})
g : Ideal (S ⧸ span {↑n}) → Set (S ⧸ span {↑n}) := SetLike.coe
⊢ Set.Finite (f '' {I | ↑absNorm I = n})
[PROOFSTEP]
refine @Set.Finite.of_finite_image _ _ _ g ?_ (SetLike.coe_injective.injOn _)
[GOAL]
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
f : Ideal S → Ideal (S ⧸ span {↑n}) := fun I => map (Quotient.mk (span {↑n})) I
this : Finite (S ⧸ span {↑n})
g : Ideal (S ⧸ span {↑n}) → Set (S ⧸ span {↑n}) := SetLike.coe
⊢ Set.Finite (g '' (f '' {I | ↑absNorm I = n}))
[PROOFSTEP]
exact Set.Finite.subset (@Set.finite_univ _ (@Set.finite' _ this)) (Set.subset_univ _)
[GOAL]
case refine_1
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
f : Ideal S → Ideal (S ⧸ span {↑n}) := fun I => map (Quotient.mk (span {↑n})) I
⊢ Finite (S ⧸ span {↑n})
[PROOFSTEP]
rw [← absNorm_ne_zero_iff, absNorm_span_singleton]
[GOAL]
case refine_1
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
f : Ideal S → Ideal (S ⧸ span {↑n}) := fun I => map (Quotient.mk (span {↑n})) I
⊢ Int.natAbs (↑(Algebra.norm ℤ) ↑n) ≠ 0
[PROOFSTEP]
simpa only [Ne.def, Int.natAbs_eq_zero, Algebra.norm_eq_zero_iff, Nat.cast_eq_zero] using ne_of_gt hn
[GOAL]
case refine_2
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
f : Ideal S → Ideal (S ⧸ span {↑n}) := fun I => map (Quotient.mk (span {↑n})) I
⊢ Set.InjOn f {I | ↑absNorm I = n}
[PROOFSTEP]
intro I hI J hJ h
[GOAL]
case refine_2
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
f : Ideal S → Ideal (S ⧸ span {↑n}) := fun I => map (Quotient.mk (span {↑n})) I
I : Ideal S
hI : I ∈ {I | ↑absNorm I = n}
J : Ideal S
hJ : J ∈ {I | ↑absNorm I = n}
h : f I = f J
⊢ I = J
[PROOFSTEP]
rw [← comap_map_mk (span_singleton_absNorm_le I), ← hI.symm, ← comap_map_mk (span_singleton_absNorm_le J), ← hJ.symm]
[GOAL]
case refine_2
S : Type u_1
inst✝⁶ : CommRing S
inst✝⁵ : IsDomain S
inst✝⁴ : Infinite S
inst✝³ : IsDedekindDomain S
inst✝² : Module.Free ℤ S
inst✝¹ : Module.Finite ℤ S
inst✝ : CharZero S
n : ℕ
hn : 0 < n
f : Ideal S → Ideal (S ⧸ span {↑n}) := fun I => map (Quotient.mk (span {↑n})) I
I : Ideal S
hI : I ∈ {I | ↑absNorm I = n}
J : Ideal S
hJ : J ∈ {I | ↑absNorm I = n}
h : f I = f J
⊢ comap (Quotient.mk (span {↑n})) (map (Quotient.mk (span {↑n})) I) =
comap (Quotient.mk (span {↑n})) (map (Quotient.mk (span {↑n})) J)
[PROOFSTEP]
congr
[GOAL]
R : Type u_1
inst✝⁵ : CommRing R
S : Type u_2
inst✝⁴ : CommRing S
inst✝³ : Algebra R S
inst✝² : Nontrivial S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
x : R
hx : x ∈ ↑(Algebra.norm R) '' ↑⊥
⊢ x = 0
[PROOFSTEP]
simpa using hx
[GOAL]
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
I : Ideal S
⊢ spanNorm R I = ⊥ ↔ I = ⊥
[PROOFSTEP]
simp only [spanNorm, Ideal.span_eq_bot, Set.mem_image, SetLike.mem_coe, forall_exists_index, and_imp,
forall_apply_eq_imp_iff₂, Algebra.norm_eq_zero_iff_of_basis (Module.Free.chooseBasis R S), @eq_bot_iff _ _ _ I,
SetLike.le_def]
[GOAL]
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
I : Ideal S
⊢ (∀ (a : S), a ∈ I → a = 0) ↔ ∀ ⦃x : S⦄, x ∈ I → x ∈ ⊥
[PROOFSTEP]
rfl
[GOAL]
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
r : S
x : R
hx : x ∈ ↑(Algebra.norm R) '' ↑(span {r})
⊢ ↑(Algebra.norm R) r ∣ x
[PROOFSTEP]
obtain ⟨x, hx', rfl⟩ := (Set.mem_image _ _ _).mp hx
[GOAL]
case intro.intro
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
r x : S
hx' : x ∈ ↑(span {r})
hx : ↑(Algebra.norm R) x ∈ ↑(Algebra.norm R) '' ↑(span {r})
⊢ ↑(Algebra.norm R) r ∣ ↑(Algebra.norm R) x
[PROOFSTEP]
exact map_dvd _ (mem_span_singleton.mp hx')
[GOAL]
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
⊢ spanNorm R ⊤ = ⊤
[PROOFSTEP]
rw [← Ideal.span_singleton_one, spanNorm_singleton]
[GOAL]
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
⊢ span {↑(Algebra.norm R) 1} = ⊤
[PROOFSTEP]
simp
[GOAL]
R : Type u_1
inst✝³ : CommRing R
S : Type u_2
inst✝² : CommRing S
inst✝¹ : Algebra R S
I : Ideal S
T : Type u_3
inst✝ : CommRing T
f : R →+* T
⊢ map f (spanNorm R I) = span (↑f ∘ ↑(Algebra.norm R) '' ↑I)
[PROOFSTEP]
rw [spanNorm, map_span, Set.image_image]
-- Porting note: `Function.comp` reducibility
[GOAL]
R : Type u_1
inst✝³ : CommRing R
S : Type u_2
inst✝² : CommRing S
inst✝¹ : Algebra R S
I : Ideal S
T : Type u_3
inst✝ : CommRing T
f : R →+* T
⊢ span ((fun x => ↑f (↑(Algebra.norm R) x)) '' ↑I) = span (↑f ∘ ↑(Algebra.norm R) '' ↑I)
[PROOFSTEP]
rfl
[GOAL]
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = map (algebraMap R Rₘ) (spanNorm R I)
[PROOFSTEP]
cases h : subsingleton_or_nontrivial R
[GOAL]
case inl
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Subsingleton R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = map (algebraMap R Rₘ) (spanNorm R I)
[PROOFSTEP]
haveI := IsLocalization.unique R Rₘ M
[GOAL]
case inl
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Subsingleton R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
this : Unique Rₘ
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = map (algebraMap R Rₘ) (spanNorm R I)
[PROOFSTEP]
simp
[GOAL]
case inr
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = map (algebraMap R Rₘ) (spanNorm R I)
[PROOFSTEP]
let b := Module.Free.chooseBasis R S
[GOAL]
case inr
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = map (algebraMap R Rₘ) (spanNorm R I)
[PROOFSTEP]
rw [map_spanNorm]
[GOAL]
case inr
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
⊢ spanNorm Rₘ (map (algebraMap S Sₘ) I) = span (↑(algebraMap R Rₘ) ∘ ↑(Algebra.norm R) '' ↑I)
[PROOFSTEP]
refine span_eq_span (Set.image_subset_iff.mpr ?_) (Set.image_subset_iff.mpr ?_)
[GOAL]
case inr.refine_1
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
⊢ ↑(map (algebraMap S Sₘ) I) ⊆
↑(Algebra.norm Rₘ) ⁻¹' ↑(Submodule.span Rₘ (↑(algebraMap R Rₘ) ∘ ↑(Algebra.norm R) '' ↑I))
[PROOFSTEP]
rintro a' ha'
[GOAL]
case inr.refine_1
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
ha' : a' ∈ ↑(map (algebraMap S Sₘ) I)
⊢ a' ∈ ↑(Algebra.norm Rₘ) ⁻¹' ↑(Submodule.span Rₘ (↑(algebraMap R Rₘ) ∘ ↑(Algebra.norm R) '' ↑I))
[PROOFSTEP]
simp only [Set.mem_preimage, submodule_span_eq, ← map_spanNorm, SetLike.mem_coe,
IsLocalization.mem_map_algebraMap_iff (Algebra.algebraMapSubmonoid S M) Sₘ,
IsLocalization.mem_map_algebraMap_iff M Rₘ, Prod.exists] at ha' ⊢
[GOAL]
case inr.refine_1
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
ha' : ∃ a b, a' * ↑(algebraMap S Sₘ) ↑b = ↑(algebraMap S Sₘ) ↑a
⊢ ∃ a b, ↑(Algebra.norm Rₘ) a' * ↑(algebraMap R Rₘ) ↑b = ↑(algebraMap R Rₘ) ↑a
[PROOFSTEP]
obtain ⟨⟨a, ha⟩, ⟨_, ⟨s, hs, rfl⟩⟩, has⟩ := ha'
[GOAL]
case inr.refine_1.intro.mk.intro.mk.intro.intro
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
a : S
ha : a ∈ I
s : R
hs : s ∈ ↑M
has :
a' *
↑(algebraMap S Sₘ)
↑{ val := ↑(algebraMap R S) s, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = ↑(algebraMap R S) s) } =
↑(algebraMap S Sₘ) ↑{ val := a, property := ha }
⊢ ∃ a b, ↑(Algebra.norm Rₘ) a' * ↑(algebraMap R Rₘ) ↑b = ↑(algebraMap R Rₘ) ↑a
[PROOFSTEP]
refine
⟨⟨Algebra.norm R a, norm_mem_spanNorm _ _ ha⟩, ⟨s ^ Fintype.card (Module.Free.ChooseBasisIndex R S), pow_mem hs _⟩,
?_⟩
[GOAL]
case inr.refine_1.intro.mk.intro.mk.intro.intro
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
a : S
ha : a ∈ I
s : R
hs : s ∈ ↑M
has :
a' *
↑(algebraMap S Sₘ)
↑{ val := ↑(algebraMap R S) s, property := (_ : ∃ a, a ∈ ↑M ∧ ↑(algebraMap R S) a = ↑(algebraMap R S) s) } =
↑(algebraMap S Sₘ) ↑{ val := a, property := ha }
⊢ ↑(Algebra.norm Rₘ) a' *
↑(algebraMap R Rₘ)
↑{ val := s ^ Fintype.card (Module.Free.ChooseBasisIndex R S),
property := (_ : s ^ Fintype.card (Module.Free.ChooseBasisIndex R S) ∈ M) } =
↑(algebraMap R Rₘ) ↑{ val := ↑(Algebra.norm R) a, property := (_ : ↑(Algebra.norm R) a ∈ spanNorm R I) }
[PROOFSTEP]
simp only [Submodule.coe_mk, Subtype.coe_mk, map_pow] at has ⊢
[GOAL]
case inr.refine_1.intro.mk.intro.mk.intro.intro
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
a : S
ha : a ∈ I
s : R
hs : s ∈ ↑M
has : a' * ↑(algebraMap S Sₘ) (↑(algebraMap R S) s) = ↑(algebraMap S Sₘ) a
⊢ ↑(Algebra.norm Rₘ) a' * ↑(algebraMap R Rₘ) s ^ Fintype.card (Module.Free.ChooseBasisIndex R S) =
↑(algebraMap R Rₘ) (↑(Algebra.norm R) a)
[PROOFSTEP]
apply_fun Algebra.norm Rₘ at has
[GOAL]
case inr.refine_1.intro.mk.intro.mk.intro.intro
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a' : Sₘ
a : S
ha : a ∈ I
s : R
hs : s ∈ ↑M
has : ↑(Algebra.norm Rₘ) (a' * ↑(algebraMap S Sₘ) (↑(algebraMap R S) s)) = ↑(Algebra.norm Rₘ) (↑(algebraMap S Sₘ) a)
⊢ ↑(Algebra.norm Rₘ) a' * ↑(algebraMap R Rₘ) s ^ Fintype.card (Module.Free.ChooseBasisIndex R S) =
↑(algebraMap R Rₘ) (↑(Algebra.norm R) a)
[PROOFSTEP]
rwa [_root_.map_mul, ← IsScalarTower.algebraMap_apply, IsScalarTower.algebraMap_apply R Rₘ,
Algebra.norm_algebraMap_of_basis (b.localizationLocalization Rₘ M Sₘ), Algebra.norm_localization R M a] at has
[GOAL]
case inr.refine_2
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
⊢ ↑I ⊆
↑(algebraMap R Rₘ) ∘ ↑(Algebra.norm R) ⁻¹' ↑(Submodule.span Rₘ (↑(Algebra.norm Rₘ) '' ↑(map (algebraMap S Sₘ) I)))
[PROOFSTEP]
intro a ha
[GOAL]
case inr.refine_2
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a : S
ha : a ∈ ↑I
⊢ a ∈ ↑(algebraMap R Rₘ) ∘ ↑(Algebra.norm R) ⁻¹' ↑(Submodule.span Rₘ (↑(Algebra.norm Rₘ) '' ↑(map (algebraMap S Sₘ) I)))
[PROOFSTEP]
rw [Set.mem_preimage, Function.comp_apply, ← Algebra.norm_localization (Sₘ := Sₘ) R M a]
[GOAL]
case inr.refine_2
R : Type u_1
inst✝¹⁴ : CommRing R
S : Type u_2
inst✝¹³ : CommRing S
inst✝¹² : Algebra R S
I : Ideal S
inst✝¹¹ : Module.Finite R S
inst✝¹⁰ : Module.Free R S
M : Submonoid R
Rₘ : Type u_3
Sₘ : Type u_4
inst✝⁹ : CommRing Rₘ
inst✝⁸ : Algebra R Rₘ
inst✝⁷ : CommRing Sₘ
inst✝⁶ : Algebra S Sₘ
inst✝⁵ : Algebra Rₘ Sₘ
inst✝⁴ : Algebra R Sₘ
inst✝³ : IsScalarTower R Rₘ Sₘ
inst✝² : IsScalarTower R S Sₘ
inst✝¹ : IsLocalization M Rₘ
inst✝ : IsLocalization (Algebra.algebraMapSubmonoid S M) Sₘ
h✝ : Nontrivial R
h : (_ : Subsingleton R ∨ Nontrivial R) = (_ : Subsingleton R ∨ Nontrivial R)
b : Basis (Module.Free.ChooseBasisIndex R S) R S := Module.Free.chooseBasis R S
a : S
ha : a ∈ ↑I
⊢ ↑(Algebra.norm Rₘ) (↑(algebraMap S Sₘ) a) ∈ ↑(Submodule.span Rₘ (↑(Algebra.norm Rₘ) '' ↑(map (algebraMap S Sₘ) I)))
[PROOFSTEP]
exact subset_span (Set.mem_image_of_mem _ (mem_map_of_mem _ ha))
[GOAL]
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
I J : Ideal S
⊢ spanNorm R I * spanNorm R J ≤ spanNorm R (I * J)
[PROOFSTEP]
rw [spanNorm, spanNorm, spanNorm, Ideal.span_mul_span', ← Set.image_mul]
[GOAL]
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
I J : Ideal S
⊢ span (↑(Algebra.norm R) '' (↑I * ↑J)) ≤ span (↑(Algebra.norm R) '' ↑(I * J))
[PROOFSTEP]
refine Ideal.span_mono (Set.monotone_image ?_)
[GOAL]
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
I J : Ideal S
⊢ ↑I * ↑J ≤ ↑(I * J)
[PROOFSTEP]
rintro _ ⟨x, y, hxI, hyJ, rfl⟩
[GOAL]
case intro.intro.intro.intro
R : Type u_1
inst✝² : CommRing R
S : Type u_2
inst✝¹ : CommRing S
inst✝ : Algebra R S
I J : Ideal S
x y : S
hxI : x ∈ ↑I
hyJ : y ∈ ↑J
⊢ (fun x x_1 => x * x_1) x y ∈ ↑(I * J)
[PROOFSTEP]
exact Ideal.mul_mem_mul hxI hyJ
[GOAL]
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
eq_bot_or_top : ∀ (I : Ideal R), I = ⊥ ∨ I = ⊤
I J : Ideal S
⊢ spanNorm R (I * J) = spanNorm R I * spanNorm R J
[PROOFSTEP]
refine le_antisymm ?_ (spanNorm_mul_spanNorm_le R _ _)
[GOAL]
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
eq_bot_or_top : ∀ (I : Ideal R), I = ⊥ ∨ I = ⊤
I J : Ideal S
⊢ spanNorm R (I * J) ≤ spanNorm R I * spanNorm R J
[PROOFSTEP]
cases' eq_bot_or_top (spanNorm R I) with hI hI
[GOAL]
case inl
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
eq_bot_or_top : ∀ (I : Ideal R), I = ⊥ ∨ I = ⊤
I J : Ideal S
hI : spanNorm R I = ⊥
⊢ spanNorm R (I * J) ≤ spanNorm R I * spanNorm R J
[PROOFSTEP]
rw [hI, spanNorm_eq_bot_iff.mp hI, bot_mul, spanNorm_bot]
[GOAL]
case inl
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
eq_bot_or_top : ∀ (I : Ideal R), I = ⊥ ∨ I = ⊤
I J : Ideal S
hI : spanNorm R I = ⊥
⊢ ⊥ ≤ ⊥ * spanNorm R J
[PROOFSTEP]
exact bot_le
[GOAL]
case inr
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
eq_bot_or_top : ∀ (I : Ideal R), I = ⊥ ∨ I = ⊤
I J : Ideal S
hI : spanNorm R I = ⊤
⊢ spanNorm R (I * J) ≤ spanNorm R I * spanNorm R J
[PROOFSTEP]
rw [hI, Ideal.top_mul]
[GOAL]
case inr
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
eq_bot_or_top : ∀ (I : Ideal R), I = ⊥ ∨ I = ⊤
I J : Ideal S
hI : spanNorm R I = ⊤
⊢ spanNorm R (I * J) ≤ spanNorm R J
[PROOFSTEP]
cases' eq_bot_or_top (spanNorm R J) with hJ hJ
[GOAL]
case inr.inl
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
eq_bot_or_top : ∀ (I : Ideal R), I = ⊥ ∨ I = ⊤
I J : Ideal S
hI : spanNorm R I = ⊤
hJ : spanNorm R J = ⊥
⊢ spanNorm R (I * J) ≤ spanNorm R J
[PROOFSTEP]
rw [hJ, spanNorm_eq_bot_iff.mp hJ, mul_bot, spanNorm_bot]
[GOAL]
case inr.inr
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
eq_bot_or_top : ∀ (I : Ideal R), I = ⊥ ∨ I = ⊤
I J : Ideal S
hI : spanNorm R I = ⊤
hJ : spanNorm R J = ⊤
⊢ spanNorm R (I * J) ≤ spanNorm R J
[PROOFSTEP]
rw [hJ]
[GOAL]
case inr.inr
R : Type u_1
inst✝⁶ : CommRing R
S : Type u_2
inst✝⁵ : CommRing S
inst✝⁴ : Algebra R S
inst✝³ : IsDomain R
inst✝² : IsDomain S
inst✝¹ : Module.Free R S
inst✝ : Module.Finite R S
eq_bot_or_top : ∀ (I : Ideal R), I = ⊥ ∨ I = ⊤
I J : Ideal S
hI : spanNorm R I = ⊤
hJ : spanNorm R J = ⊤
⊢ spanNorm R (I * J) ≤ ⊤
[PROOFSTEP]
exact le_top
[GOAL]
R : Type u_1
inst✝⁸ : CommRing R
S : Type u_2
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : IsDomain R
inst✝⁴ : IsDomain S
inst✝³ : IsDedekindDomain R
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite R S
inst✝ : Module.Free R S
I J : Ideal S
⊢ spanNorm R (I * J) = spanNorm R I * spanNorm R J
[PROOFSTEP]
nontriviality R
[GOAL]
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
⊢ spanNorm R (I * J) = spanNorm R I * spanNorm R J
[PROOFSTEP]
cases subsingleton_or_nontrivial S
[GOAL]
case inl
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Subsingleton S
⊢ spanNorm R (I * J) = spanNorm R I * spanNorm R J
[PROOFSTEP]
have : ∀ I : Ideal S, I = ⊤ := fun I => Subsingleton.elim I ⊤
[GOAL]
case inl
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Subsingleton S
this : ∀ (I : Ideal S), I = ⊤
⊢ spanNorm R (I * J) = spanNorm R I * spanNorm R J
[PROOFSTEP]
simp [this I, this J, this (I * J)]
[GOAL]
case inr
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
⊢ spanNorm R (I * J) = spanNorm R I * spanNorm R J
[PROOFSTEP]
refine eq_of_localization_maximal ?_
[GOAL]
case inr
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
⊢ ∀ (P : Ideal R) (x : IsMaximal P),
map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
intro P hP
[GOAL]
case inr
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
by_cases hP0 : P = ⊥
[GOAL]
case pos
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
hP0 : P = ⊥
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
subst hP0
[GOAL]
case pos
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
hP : IsMaximal ⊥
⊢ map (algebraMap R (Localization.AtPrime ⊥)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime ⊥)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
rw [spanNorm_mul_of_bot_or_top]
[GOAL]
case pos.eq_bot_or_top
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
hP : IsMaximal ⊥
⊢ ∀ (I : Ideal R), I = ⊥ ∨ I = ⊤
[PROOFSTEP]
intro I
[GOAL]
case pos.eq_bot_or_top
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I✝ J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
hP : IsMaximal ⊥
I : Ideal R
⊢ I = ⊥ ∨ I = ⊤
[PROOFSTEP]
refine or_iff_not_imp_right.mpr fun hI => ?_
[GOAL]
case pos.eq_bot_or_top
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I✝ J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
hP : IsMaximal ⊥
I : Ideal R
hI : ¬I = ⊤
⊢ I = ⊥
[PROOFSTEP]
exact (hP.eq_of_le hI bot_le).symm
[GOAL]
case neg
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
hP0 : ¬P = ⊥
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
let P' := Algebra.algebraMapSubmonoid S P.primeCompl
[GOAL]
case neg
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
hP0 : ¬P = ⊥
P' : Submonoid S := Algebra.algebraMapSubmonoid S (primeCompl P)
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
letI : Algebra (Localization.AtPrime P) (Localization P') := localizationAlgebra P.primeCompl S
[GOAL]
case neg
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
hP0 : ¬P = ⊥
P' : Submonoid S := Algebra.algebraMapSubmonoid S (primeCompl P)
this : Algebra (Localization.AtPrime P) (Localization P') := localizationAlgebra (primeCompl P) S
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
haveI : IsScalarTower R (Localization.AtPrime P) (Localization P') :=
IsScalarTower.of_algebraMap_eq
(fun x => (IsLocalization.map_eq (T := P') (Q := Localization P') P.primeCompl.le_comap_map x).symm)
[GOAL]
case neg
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
hP0 : ¬P = ⊥
P' : Submonoid S := Algebra.algebraMapSubmonoid S (primeCompl P)
this✝ : Algebra (Localization.AtPrime P) (Localization P') := localizationAlgebra (primeCompl P) S
this : IsScalarTower R (Localization.AtPrime P) (Localization P')
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
have h : P' ≤ S⁰ :=
map_le_nonZeroDivisors_of_injective _ (NoZeroSMulDivisors.algebraMap_injective _ _) P.primeCompl_le_nonZeroDivisors
[GOAL]
case neg
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
hP0 : ¬P = ⊥
P' : Submonoid S := Algebra.algebraMapSubmonoid S (primeCompl P)
this✝ : Algebra (Localization.AtPrime P) (Localization P') := localizationAlgebra (primeCompl P) S
this : IsScalarTower R (Localization.AtPrime P) (Localization P')
h : P' ≤ S⁰
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
haveI : IsDomain (Localization P') := IsLocalization.isDomain_localization h
[GOAL]
case neg
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
hP0 : ¬P = ⊥
P' : Submonoid S := Algebra.algebraMapSubmonoid S (primeCompl P)
this✝¹ : Algebra (Localization.AtPrime P) (Localization P') := localizationAlgebra (primeCompl P) S
this✝ : IsScalarTower R (Localization.AtPrime P) (Localization P')
h : P' ≤ S⁰
this : IsDomain (Localization P')
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
haveI : IsDedekindDomain (Localization P') := IsLocalization.isDedekindDomain S h _
[GOAL]
case neg
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
hP0 : ¬P = ⊥
P' : Submonoid S := Algebra.algebraMapSubmonoid S (primeCompl P)
this✝² : Algebra (Localization.AtPrime P) (Localization P') := localizationAlgebra (primeCompl P) S
this✝¹ : IsScalarTower R (Localization.AtPrime P) (Localization P')
h : P' ≤ S⁰
this✝ : IsDomain (Localization P')
this : IsDedekindDomain (Localization P')
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
letI := Classical.decEq (Ideal (Localization P'))
[GOAL]
case neg
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
hP0 : ¬P = ⊥
P' : Submonoid S := Algebra.algebraMapSubmonoid S (primeCompl P)
this✝³ : Algebra (Localization.AtPrime P) (Localization P') := localizationAlgebra (primeCompl P) S
this✝² : IsScalarTower R (Localization.AtPrime P) (Localization P')
h : P' ≤ S⁰
this✝¹ : IsDomain (Localization P')
this✝ : IsDedekindDomain (Localization P')
this : DecidableEq (Ideal (Localization P')) := Classical.decEq (Ideal (Localization P'))
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
haveI : IsPrincipalIdealRing (Localization P') := IsDedekindDomain.isPrincipalIdealRing_localization_over_prime S P hP0
[GOAL]
case neg
R : Type u_1
inst✝⁹ : CommRing R
S : Type u_2
inst✝⁸ : CommRing S
inst✝⁷ : Algebra R S
inst✝⁶ : IsDomain R
inst✝⁵ : IsDomain S
inst✝⁴ : IsDedekindDomain R
inst✝³ : IsDedekindDomain S
inst✝² : Module.Finite R S
inst✝¹ : Module.Free R S
I J : Ideal S
inst✝ : Nontrivial R
h✝ : Nontrivial S
P : Ideal R
hP : IsMaximal P
hP0 : ¬P = ⊥
P' : Submonoid S := Algebra.algebraMapSubmonoid S (primeCompl P)
this✝⁴ : Algebra (Localization.AtPrime P) (Localization P') := localizationAlgebra (primeCompl P) S
this✝³ : IsScalarTower R (Localization.AtPrime P) (Localization P')
h : P' ≤ S⁰
this✝² : IsDomain (Localization P')
this✝¹ : IsDedekindDomain (Localization P')
this✝ : DecidableEq (Ideal (Localization P')) := Classical.decEq (Ideal (Localization P'))
this : IsPrincipalIdealRing (Localization P')
⊢ map (algebraMap R (Localization.AtPrime P)) (spanNorm R (I * J)) =
map (algebraMap R (Localization.AtPrime P)) (spanNorm R I * spanNorm R J)
[PROOFSTEP]
rw [Ideal.map_mul, ← spanNorm_localization R I P.primeCompl (Localization P'), ←
spanNorm_localization R J P.primeCompl (Localization P'), ←
spanNorm_localization R (I * J) P.primeCompl (Localization P'), Ideal.map_mul, ← (I.map _).span_singleton_generator, ←
(J.map _).span_singleton_generator, span_singleton_mul_span_singleton, spanNorm_singleton, spanNorm_singleton,
spanNorm_singleton, span_singleton_mul_span_singleton, _root_.map_mul]
[GOAL]
R : Type u_1
inst✝⁸ : CommRing R
S : Type u_2
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : IsDomain R
inst✝⁴ : IsDomain S
inst✝³ : IsDedekindDomain R
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite R S
inst✝ : Module.Free R S
⊢ ZeroHom.toFun { toFun := spanNorm R, map_zero' := (_ : spanNorm R ⊥ = ⊥) } 1 = 1
[PROOFSTEP]
dsimp only
[GOAL]
R : Type u_1
inst✝⁸ : CommRing R
S : Type u_2
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : IsDomain R
inst✝⁴ : IsDomain S
inst✝³ : IsDedekindDomain R
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite R S
inst✝ : Module.Free R S
⊢ spanNorm R 1 = 1
[PROOFSTEP]
rw [one_eq_top, spanNorm_top R, one_eq_top]
[GOAL]
R : Type u_1
inst✝⁸ : CommRing R
S : Type u_2
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : IsDomain R
inst✝⁴ : IsDomain S
inst✝³ : IsDedekindDomain R
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite R S
inst✝ : Module.Free R S
⊢ ↑(relNorm R) ⊥ = ⊥
[PROOFSTEP]
simpa only [zero_eq_bot] using _root_.map_zero (relNorm R : Ideal S →*₀ _)
[GOAL]
R : Type u_1
inst✝⁸ : CommRing R
S : Type u_2
inst✝⁷ : CommRing S
inst✝⁶ : Algebra R S
inst✝⁵ : IsDomain R
inst✝⁴ : IsDomain S
inst✝³ : IsDedekindDomain R
inst✝² : IsDedekindDomain S
inst✝¹ : Module.Finite R S
inst✝ : Module.Free R S
⊢ ↑(relNorm R) ⊤ = ⊤
[PROOFSTEP]
simpa only [one_eq_top] using map_one (relNorm R : Ideal S →*₀ _)
|
\documentclass[aps,pra,notitlepage,amsmath,amssymb,letterpaper,12pt]{revtex4-1}
\usepackage{amsthm}
\usepackage{graphicx}
\newenvironment{problem}[2][Problem]{\begin{trivlist}
\item[\hskip \labelsep {\bfseries #1}\hskip \labelsep {\bfseries #2.}]}{\end{trivlist}}
\newenvironment{solution}{\begin{proof}[Solution]}{\end{proof}}
\begin{document}
\title{Classwork 13: George and Moana but In LaTeX}
\author{Morgan Holve}
\affiliation{MATH 220, Schmid College of Science and Technology, Chapman University}
\date{\today}
\maketitle
\section{Introduction}
The goal of this is to basically put everything from Classwork 12 and Homework 12 into LaTeX. Allow me to restate everything from those Jupyter notebooks into this:
\vspace{5mm}
We are considering a ball of mass $m$ rolling in a double-well potential (whatever that is) of $V(x) = x^4/4 - x^2/2$. This potential is unaptly called the "sombrero potential" despite its likeness toward stingrays.
\vspace{5mm}
Taking physics things into account and also remembering that the ball must follow Newton's Second Law, we obtain the equation:
$$m\ddot{x} = f_{\text{hat}}(x) + f_{\text{drag}}(\dot{x}) + f_{\text{drive}}(t) = x - x^3 - \nu \dot{x} + F\cos(\omega t)$$
Which can be split into the system of differential equations:
$$\dot{x}(t) = y(t)$$
$$m\dot{y}(t) = -\nu y(t) + x(t) - x^3(t) + F\cos(\omega t)$$
Here, we will solve these using the Runge-Kutta 4th Order method outlined in the past two classworks, taking $m = 1$, $\omega = 1$ and $\nu = .25$. We'll graph our results and then see what everything means. \par
\noindent
Reminder of the method:
$u_{k+1} = u_k + (K_1 + 2K_2 + 2K_3 + K_4)/6$,
with
$K_1 = \Delta t\,f[t_k,u_k]$,
$K_2 = \Delta t\, f[t_k + \Delta t/2, u_k + K_1/2]$,
$K_3 = \Delta t\, f[t_k + \Delta t/2, u_k + K_2/2]$,
$K_4 = \Delta t\,f[t_k + \Delta t, u_k + K_3]$
\section{Implementation}
We solved the differential equation each for different $F$ values and initial conditions.
\subsection{Varying Intial Conditions}
When our code was implemented, the following figures were produced for the different initial conditions.
\begin{figure}[h!]
\includegraphics[width=0.4\textwidth]{frame02.jpg}
\caption{Initial Conditions: $F = 0.18$, $t\in[0,2\pi\, 50]$, with $x(0) = 0.9$ and $y(0) = 0$; Scatter Plot}
\label{fig:figlabel}
\end{figure}
\begin{figure}[h!] % h forces the figure to be placed here, in the text
\includegraphics[width=0.4\textwidth]{frame04.jpg} % if pdflatex is used, jpg, pdf, and png are permitted
\caption{Initial Conditions: $F = 0.25$, $t\in[0,2\pi\, 50]$, with $x(0) = 0.2$ and $y(0) = 0.1$}
\label{fig:figlabel}
\end{figure}
\section{Analysis}
Now, what do these graphs mean? To do this, we look at the relative density of the lines on each side of the graph. For Figure 1, we see that both the left and right sides of the figure are balanced, meaning the ball moved uniformly and evenly in between the wells. However, in Figure 2, we see that the right side is obviously favored over the left, meaning the ball spend more time in the rightmost well rather than the left. \par
\noindent
For your viewing pleasure, here is the Moana graph because I'm a little obsessed with it.
\begin{figure}[h!] % h forces the figure to be placed here, in the text
\includegraphics[width=0.4\textwidth]{frame03.jpg} % if pdflatex is used, jpg, pdf, and png are permitted
\caption{See the light as it shines on the sea, it calls me. And no one knows how far it goes. If the wind in my sail on the sea stays behind me, I know one day I'll find the way.}
\label{fig:figlabel}
\end{figure}
\end{document}
|
(* *********************************************************************)
(* *)
(* The Compcert verified compiler *)
(* *)
(* Xavier Leroy, INRIA Paris-Rocquencourt *)
(* *)
(* Copyright Institut National de Recherche en Informatique et en *)
(* Automatique. All rights reserved. This file is distributed *)
(* 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 file is also distributed *)
(* under the terms of the INRIA Non-Commercial License Agreement. *)
(* *)
(* *********************************************************************)
(** Arithmetic and logical operators for the Compcert C and Clight languages *)
Require Import Coqlib.
Require Import AST.
Require Import Integers.
Require Import Floats.
Require Import Values.
Require Import Memory.
Require Import MapleLightTypes.
Require Archi.
(** * Syntax of operators. *)
Definition boffset := N.
Definition bsize := N.
Definition Boffset := N.
Inductive unary_operation : Type :=
| O_abs : unary_operation
| O_bnot : unary_operation
| O_lnot : unary_operation
| O_neg : unary_operation
| O_recip : unary_operation
| O_sext : bsize -> unary_operation
| O_zext : bsize -> unary_operation
(*| O_extractbits : boffset -> bsize -> unary_operation*)
| O_sqrt : unary_operation.
Inductive binary_operation : Type :=
| O_add : binary_operation
| O_ashr : binary_operation
| O_band : binary_operation
| O_bior : binary_operation
| O_bxor : binary_operation
| O_cmp : prim_type -> binary_operation
| O_cmpg : prim_type -> binary_operation
| O_cmpl : prim_type -> binary_operation
(*| O_depositbits : boffset -> bsize -> binary_operation*)
| O_div : binary_operation
| O_eq : prim_type -> binary_operation
| O_ge : prim_type -> binary_operation
| O_gt : prim_type -> binary_operation
| O_land : binary_operation
| O_lior : binary_operation
| O_le : prim_type -> binary_operation
| O_lshr : binary_operation
| O_lt : prim_type -> binary_operation
| O_max : binary_operation
| O_min : binary_operation
| O_mul : binary_operation
| O_ne : prim_type -> binary_operation
| O_rem : binary_operation
| O_shl : binary_operation
| O_sub : binary_operation.
Inductive incr_or_decr : Type := Incr | Decr.
(** * Type classification and semantics of operators. *)
(** Most C operators are overloaded (they apply to arguments of various
types) and their semantics depend on the types of their arguments.
The following [classify_*] functions take as arguments the types
of the arguments of an operation. They return enough information
to resolve overloading for this operator applications, such as
``both arguments are floats'', or ``the first is a pointer
and the second is an integer''. This classification is used in the
compiler (module [Cshmgen]) to resolve overloading statically.
The [sem_*] functions below compute the result of an operator
application. Since operators are overloaded, the result depends
both on the static types of the arguments and on their run-time values.
The corresponding [classify_*] function is first called on the
types of the arguments to resolve static overloading. It is then
followed by a case analysis on the values of the arguments. *)
(** ** Casts and truth values *)
Inductive classify_cast_cases : Type :=
| cast_case_pointer (**r between pointer types or intptr_t types *)
| cast_case_i2i (sz2:intsize) (si2:signedness) (**r int -> int *)
| cast_case_f2f (**r double -> double *)
| cast_case_s2s (**r single -> single *)
| cast_case_f2s (**r double -> single *)
| cast_case_s2f (**r single -> double *)
| cast_case_i2f (si1: signedness) (**r int -> double *)
| cast_case_i2s (si1: signedness) (**r int -> single *)
| cast_case_f2i (sz2:intsize) (si2:signedness) (**r double -> int *)
| cast_case_s2i (sz2:intsize) (si2:signedness) (**r single -> int *)
| cast_case_l2l (**r long -> long *)
| cast_case_i2l (si1: signedness) (**r int -> long *)
| cast_case_l2i (sz2: intsize) (si2: signedness) (**r long -> int *)
| cast_case_l2f (si1: signedness) (**r long -> double *)
| cast_case_l2s (si1: signedness) (**r long -> single *)
| cast_case_f2l (si2:signedness) (**r double -> long *)
| cast_case_s2l (si2:signedness) (**r single -> long *)
| cast_case_i2bool (**r int -> bool *)
| cast_case_l2bool (**r long -> bool *)
| cast_case_f2bool (**r double -> bool *)
| cast_case_s2bool (**r single -> bool *)
| cast_case_composite (id1 id2: ident) (**r struct -> struct *)
| cast_case_void (**r any -> void *)
| cast_case_agg
| cast_case_default.
Definition classify_cast (tfrom tto: type) : classify_cast_cases :=
match tto, tfrom with
(* To [void] *)
| Tprim PTvoid, _ => cast_case_void
(* To [bool] *)
| Tprim PTbool, Tprim (PTint I64 _ | PTaddr A64) => cast_case_l2bool
| Tprim PTbool, Tprim (PTint _ _ | PTaddr A32) => cast_case_i2bool
| Tprim PTbool, Tprim (PTfloat F32) => cast_case_s2bool
| Tprim PTbool, Tprim (PTfloat F64) => cast_case_f2bool
| Tprim PTbool, (Tpointer _ | Tarray _ _ | Tprim PTptr | Tprim PTref) =>
if Archi.ptr64 then cast_case_l2bool else cast_case_i2bool
(* To [long] *)
| Tprim (PTint I64 _), Tprim (PTint I64 _ | PTaddr A64) =>
if Archi.ptr64 then cast_case_pointer else cast_case_l2l
| Tprim (PTint I64 _), Tprim (PTint _ si1) => cast_case_i2l si1
| Tprim (PTint I64 _), Tprim (PTaddr A32) => cast_case_i2l Unsigned
| Tprim (PTint I64 si2), Tprim (PTfloat F64) => cast_case_f2l si2
| Tprim (PTint I64 si2), Tprim (PTfloat F32) => cast_case_s2l si2
| Tprim (PTint I64 si2), (Tpointer _ | Tarray _ _ | Tprim PTptr | Tprim PTref) =>
if Archi.ptr64 then cast_case_pointer else cast_case_i2l si2
(* To [int] *)
| Tprim (PTint sz2 si2), Tprim (PTint I64 _ | PTaddr A64) => cast_case_l2i sz2 si2
| Tprim (PTint sz2 si2), Tprim (PTint _ _ | PTaddr A32) =>
if Archi.ptr64 then cast_case_i2i sz2 si2
else if intsize_eq sz2 I32 then cast_case_pointer
else cast_case_i2i sz2 si2
| Tprim (PTint sz2 si2), Tprim (PTfloat F64) => cast_case_f2i sz2 si2
| Tprim (PTint sz2 si2), Tprim (PTfloat F32) => cast_case_s2i sz2 si2
| Tprim (PTint sz2 si2), (Tpointer _ | Tarray _ _ | Tprim PTptr | Tprim PTref) =>
if Archi.ptr64 then cast_case_l2i sz2 si2
else if intsize_eq sz2 I32 then cast_case_pointer
else cast_case_i2i sz2 si2
(* To [float] *)
| Tprim (PTfloat F64), Tprim (PTint I64 si1) => cast_case_l2f si1
| Tprim (PTfloat F32), Tprim (PTint I64 si1) => cast_case_l2s si1
| Tprim (PTfloat F64), Tprim (PTint sz1 si1) => cast_case_i2f si1
| Tprim (PTfloat F32), Tprim (PTint sz1 si1) => cast_case_i2s si1
| Tprim (PTfloat F64), Tprim (PTfloat F64) => cast_case_f2f
| Tprim (PTfloat F32), Tprim (PTfloat F32) => cast_case_s2s
| Tprim (PTfloat F64), Tprim (PTfloat F32) => cast_case_s2f
| Tprim (PTfloat F32), Tprim (PTfloat F64) => cast_case_f2s
(* To pointer types *)
| (Tpointer _ | Tprim PTptr | Tprim PTref), Tprim (PTint I64 _ | PTaddr A64) =>
if Archi.ptr64 then cast_case_pointer else cast_case_l2i I32 Unsigned
| (Tpointer _ | Tprim PTptr | Tprim PTref), Tprim (PTint _ si) =>
if Archi.ptr64 then cast_case_i2l si else cast_case_pointer
| (Tpointer _ | Tprim PTptr | Tprim PTref), Tprim (PTaddr A32) =>
if Archi.ptr64 then cast_case_i2l Unsigned else cast_case_pointer
| (Tpointer _ | Tprim PTptr | Tprim PTref), (Tpointer _ | Tarray _ _ | Tprim PTptr | Tprim PTref) => cast_case_pointer
(* To [addr] *)
| Tprim (PTaddr A64), Tprim (PTint I64 _ | PTaddr A64) =>
if Archi.ptr64 then cast_case_pointer else cast_case_l2l
| Tprim (PTaddr A64), Tprim (PTint _ si1) => cast_case_i2l si1
| Tprim (PTaddr A64), Tprim (PTaddr A32) => cast_case_i2l Unsigned
| Tprim (PTaddr A64), Tprim (PTfloat F64) => cast_case_f2l Unsigned
| Tprim (PTaddr A64), Tprim (PTfloat F32) => cast_case_s2l Unsigned
| Tprim (PTaddr A64), (Tpointer _ | Tarray _ _ | Tprim PTptr | Tprim PTref) =>
if Archi.ptr64 then cast_case_pointer else cast_case_i2l Unsigned
| Tprim (PTaddr A32), Tprim (PTint I64 _ | PTaddr A64) => cast_case_l2i I32 Unsigned
| Tprim (PTaddr A32), Tprim (PTint _ _ | PTaddr A32) =>
if Archi.ptr64 then cast_case_i2i I32 Unsigned
else cast_case_pointer
| Tprim (PTaddr A32), Tprim (PTfloat F64) => cast_case_f2i I32 Unsigned
| Tprim (PTaddr A32), Tprim (PTfloat F32) => cast_case_s2i I32 Unsigned
| Tprim (PTaddr A32), (Tpointer _ | Tarray _ _ | Tprim PTptr | Tprim PTref) =>
if Archi.ptr64 then cast_case_l2i I32 Unsigned
else cast_case_pointer
(* To agg *)
| Tprim PTagg, Tcomposite _ => cast_case_agg
(* To composite types *)
| Tcomposite id1, Tcomposite id2 => cast_case_composite id1 id2
(* Catch-all *)
| _, _ => cast_case_default
end.
(** Semantics of casts. [sem_cast v1 t1 t2 m = Some v2] if value [v1],
viewed with static type [t1], can be converted to type [t2],
resulting in value [v2]. *)
Definition cast_int_int (sz: intsize) (sg: signedness) (i: int) : int :=
match sz, sg with
| I8, Signed => Int.sign_ext 8 i
| I8, Unsigned => Int.zero_ext 8 i
| I16, Signed => Int.sign_ext 16 i
| I16, Unsigned => Int.zero_ext 16 i
| _, _ => i
end.
Definition cast_int_float (si: signedness) (i: int) : float :=
match si with
| Signed => Float.of_int i
| Unsigned => Float.of_intu i
end.
Definition cast_float_int (si : signedness) (f: float) : option int :=
match si with
| Signed => Float.to_int f
| Unsigned => Float.to_intu f
end.
Definition cast_int_single (si: signedness) (i: int) : float32 :=
match si with
| Signed => Float32.of_int i
| Unsigned => Float32.of_intu i
end.
Definition cast_single_int (si : signedness) (f: float32) : option int :=
match si with
| Signed => Float32.to_int f
| Unsigned => Float32.to_intu f
end.
Definition cast_int_long (si: signedness) (i: int) : int64 :=
match si with
| Signed => Int64.repr (Int.signed i)
| Unsigned => Int64.repr (Int.unsigned i)
end.
Definition cast_long_float (si: signedness) (i: int64) : float :=
match si with
| Signed => Float.of_long i
| Unsigned => Float.of_longu i
end.
Definition cast_long_single (si: signedness) (i: int64) : float32 :=
match si with
| Signed => Float32.of_long i
| Unsigned => Float32.of_longu i
end.
Definition cast_float_long (si : signedness) (f: float) : option int64 :=
match si with
| Signed => Float.to_long f
| Unsigned => Float.to_longu f
end.
Definition cast_single_long (si : signedness) (f: float32) : option int64 :=
match si with
| Signed => Float32.to_long f
| Unsigned => Float32.to_longu f
end.
Definition sem_cast (v: val) (t1 t2: type) (m: mem) (ce: composite_env) : option val :=
match classify_cast t1 t2 with
| cast_case_pointer =>
match v with
| Vptr _ _ => Some v
| Vint _ => if Archi.ptr64 then None else Some v
| Vlong _ => if Archi.ptr64 then Some v else None
| _ => None
end
| cast_case_i2i sz2 si2 =>
match v with
| Vint i => Some (Vint (cast_int_int sz2 si2 i))
| _ => None
end
| cast_case_f2f =>
match v with
| Vfloat f => Some (Vfloat f)
| _ => None
end
| cast_case_s2s =>
match v with
| Vsingle f => Some (Vsingle f)
| _ => None
end
| cast_case_s2f =>
match v with
| Vsingle f => Some (Vfloat (Float.of_single f))
| _ => None
end
| cast_case_f2s =>
match v with
| Vfloat f => Some (Vsingle (Float.to_single f))
| _ => None
end
| cast_case_i2f si1 =>
match v with
| Vint i => Some (Vfloat (cast_int_float si1 i))
| _ => None
end
| cast_case_i2s si1 =>
match v with
| Vint i => Some (Vsingle (cast_int_single si1 i))
| _ => None
end
| cast_case_f2i sz2 si2 =>
match v with
| Vfloat f =>
match cast_float_int si2 f with
| Some i => Some (Vint (cast_int_int sz2 si2 i))
| None => None
end
| _ => None
end
| cast_case_s2i sz2 si2 =>
match v with
| Vsingle f =>
match cast_single_int si2 f with
| Some i => Some (Vint (cast_int_int sz2 si2 i))
| None => None
end
| _ => None
end
| cast_case_i2bool =>
match v with
| Vint n =>
Some(Vint(if Int.eq n Int.zero then Int.zero else Int.one))
| Vptr b ofs =>
if Archi.ptr64 then None else
if Mem.weak_valid_pointer m b (Ptrofs.unsigned ofs) then Some Vone else None
| _ => None
end
| cast_case_l2bool =>
match v with
| Vlong n =>
Some(Vint(if Int64.eq n Int64.zero then Int.zero else Int.one))
| Vptr b ofs =>
if negb Archi.ptr64 then None else
if Mem.weak_valid_pointer m b (Ptrofs.unsigned ofs) then Some Vone else None
| _ => None
end
| cast_case_f2bool =>
match v with
| Vfloat f =>
Some(Vint(if Float.cmp Ceq f Float.zero then Int.zero else Int.one))
| _ => None
end
| cast_case_s2bool =>
match v with
| Vsingle f =>
Some(Vint(if Float32.cmp Ceq f Float32.zero then Int.zero else Int.one))
| _ => None
end
| cast_case_l2l =>
match v with
| Vlong n => Some (Vlong n)
| _ => None
end
| cast_case_i2l si =>
match v with
| Vint n => Some(Vlong (cast_int_long si n))
| _ => None
end
| cast_case_l2i sz si =>
match v with
| Vlong n => Some(Vint (cast_int_int sz si (Int.repr (Int64.unsigned n))))
| _ => None
end
| cast_case_l2f si1 =>
match v with
| Vlong i => Some (Vfloat (cast_long_float si1 i))
| _ => None
end
| cast_case_l2s si1 =>
match v with
| Vlong i => Some (Vsingle (cast_long_single si1 i))
| _ => None
end
| cast_case_f2l si2 =>
match v with
| Vfloat f =>
match cast_float_long si2 f with
| Some i => Some (Vlong i)
| None => None
end
| _ => None
end
| cast_case_s2l si2 =>
match v with
| Vsingle f =>
match cast_single_long si2 f with
| Some i => Some (Vlong i)
| None => None
end
| _ => None
end
| cast_case_composite id1 id2 =>
if ident_eq id1 id2
|| In_dec ident_eq id1 (superclasses_id ce id2)
|| In_dec ident_eq id1 (superinterfaces_id ce id2)
then Some v
else None
| cast_case_agg => Some v
| cast_case_void =>
Some v
| cast_case_default =>
None
end.
(** The following describes types that can be interpreted as a boolean:
integers, floats, pointers. It is used for the semantics of
the [!] and [?] operators, as well as the [if], [while],
and [for] statements. *)
Inductive classify_bool_cases : Type :=
| bool_case_i (**r integer *)
| bool_case_l (**r long *)
| bool_case_f (**r double float *)
| bool_case_s (**r single float *)
| bool_default.
Definition classify_bool (mt: type) : classify_bool_cases :=
match typeconv mt with
| Tprim (PTint (I8 | I16 | I32) _) => bool_case_i
| Tprim (PTint I64 _) => bool_case_l
| Tprim (PTaddr A32) => bool_case_i
| Tprim (PTaddr A64) => bool_case_l
| Tprim (PTptr | PTref) | Tpointer _ => if Archi.ptr64 then bool_case_l else bool_case_i
| Tprim (PTfloat F64) => bool_case_f
| Tprim (PTfloat F32) => bool_case_s
| _ => bool_default
end.
(** Interpretation of values as truth values.
Non-zero integers, non-zero floats and non-null pointers are
considered as true. The integer zero (which also represents
the null pointer) and the float 0.0 are false. *)
Definition bool_val (v: val) (mt: type) (m: mem) : option bool :=
match classify_bool mt with
| bool_case_i =>
match v with
| Vint n => Some (negb (Int.eq n Int.zero))
| Vptr b ofs =>
if Archi.ptr64 then None else
if Mem.weak_valid_pointer m b (Ptrofs.unsigned ofs) then Some true else None
| _ => None
end
| bool_case_l =>
match v with
| Vlong n => Some (negb (Int64.eq n Int64.zero))
| Vptr b ofs =>
if negb Archi.ptr64 then None else
if Mem.weak_valid_pointer m b (Ptrofs.unsigned ofs) then Some true else None
| _ => None
end
| bool_case_f =>
match v with
| Vfloat f => Some (negb (Float.cmp Ceq f Float.zero))
| _ => None
end
| bool_case_s =>
match v with
| Vsingle f => Some (negb (Float32.cmp Ceq f Float32.zero))
| _ => None
end
| bool_default => None
end.
(** ** Unary operators *)
(** *** Boolean negation *)
Definition sem_lnot (v: val) (mt: type) (m: mem): option val :=
option_map (fun b => Val.of_bool (negb b)) (bool_val v mt m).
(** *** Opposite and absolute value *)
Inductive classify_neg_cases : Type :=
| neg_case_i(s: signedness) (**r int *)
| neg_case_f (**r double float *)
| neg_case_s (**r single float *)
| neg_case_l(s: signedness) (**r long *)
| neg_default.
Definition classify_neg (mt: type) : classify_neg_cases :=
match mt with
| Tprim pt =>
match pt with
| PTint I32 Unsigned | PTbool => neg_case_i Unsigned
| PTint I64 si => neg_case_l si
| PTint _ _ => neg_case_i Signed
| PTfloat F64 => neg_case_f
| PTfloat F32 => neg_case_s
| _ => neg_default
end
| _ => neg_default
end.
Definition sem_neg (v: val) (mt: type) : option val :=
match classify_neg mt with
| neg_case_i sg =>
match v with
| Vint n => Some (Vint (Int.neg n))
| _ => None
end
| neg_case_f =>
match v with
| Vfloat f => Some (Vfloat (Float.neg f))
| _ => None
end
| neg_case_s =>
match v with
| Vsingle f => Some (Vsingle (Float32.neg f))
| _ => None
end
| neg_case_l sg =>
match v with
| Vlong n => Some (Vlong (Int64.neg n))
| _ => None
end
| neg_default => None
end.
Definition sem_abs (v: val) (mt: type) : option val :=
match classify_neg mt with
| neg_case_i Unsigned =>
match v with
| Vint n => Some (Vint n)
| _ => None
end
| neg_case_i Signed =>
match v with
| Vint n => Some (Vint (Int.repr (Z.abs (Int.signed n))))
| _ => None
end
| neg_case_f =>
match v with
| Vfloat f => Some (Vfloat (Float.abs f))
| _ => None
end
| neg_case_s =>
match v with
| Vsingle f => Some (Vsingle (Float32.abs f))
| _ => None
end
| neg_case_l Unsigned =>
match v with
| Vlong n => Some (Vlong n)
| _ => None
end
| neg_case_l Signed =>
match v with
| Vlong n => Some (Vlong (Int64.repr (Z.abs (Int64.signed n))))
| _ => None
end
| neg_default => None
end.
(** *** Bitwise complement *)
Inductive classify_bnot_cases : Type :=
| bnot_case_i(s: signedness) (**r int *)
| bnot_case_l(s: signedness) (**r long *)
| bnot_default.
Definition classify_bnot (mt: type) : classify_bnot_cases :=
match mt with
| Tprim pt =>
match pt with
| PTint I32 Unsigned | PTbool => bnot_case_i Unsigned
| PTint I64 si => bnot_case_l si
| PTint _ _ => bnot_case_i Signed
| _ => bnot_default
end
| _ => bnot_default
end.
Definition sem_bnot (v: val) (mt: type): option val :=
match classify_bnot mt with
| bnot_case_i sg =>
match v with
| Vint n => Some (Vint (Int.not n))
| _ => None
end
| bnot_case_l sg =>
match v with
| Vlong n => Some (Vlong (Int64.not n))
| _ => None
end
| notint_default => None
end.
(** *** Reciprocal *)
Inductive classify_recip_cases : Type :=
| recip_case_f (**r float *)
| recip_case_s (**r single *)
| recip_default.
Definition classify_recip (mt: type) : classify_recip_cases :=
match mt with
| Tprim pt =>
match pt with
| PTfloat F32 => recip_case_s
| PTfloat F64 => recip_case_f
| _ => recip_default
end
| _ => recip_default
end.
Definition sem_recip (v: val) (mt: type) : option val :=
match classify_recip mt with
| recip_case_f =>
match v with
| Vfloat f =>
Some (Vfloat (Float.div (Float.of_int Int.one) f))
| _ => None
end
| recip_case_s =>
match v with
| Vsingle s =>
Some (Vsingle (Float32.div (Float32.of_int Int.one) s))
| _ => None
end
| recip_case_default => None
end.
(** *** Signed extension & Zero extension *)
Inductive classify_ext_cases : Type :=
| zext_case_i
| zext_case_l
| sext_case_i
| sext_case_l
| ext_default.
Definition classify_ext (mt: type) : classify_ext_cases :=
match mt with
| Tprim pt =>
match pt with
| PTint I64 Unsigned => zext_case_l
| PTint I64 Signed => sext_case_l
| PTint _ Unsigned => zext_case_i
| PTint _ Signed => sext_case_i
| _ => ext_default
end
| _ => ext_default
end.
Definition sem_zext (v: val) (sz: N) (mt: type): option val :=
match classify_ext mt with
| zext_case_i =>
match v with
| Vint n => Some (Vint (Int.zero_ext (Z.of_N sz) n))
| _ => None
end
| zext_case_l =>
match v with
| Vlong n => Some (Vlong (Int64.zero_ext (Z.of_N sz) n))
| _ => None
end
| _ => None
end.
Definition sem_sext (v: val) (sz: N) (mt: type): option val :=
match classify_ext mt with
| sext_case_i =>
match v with
| Vint n => Some (Vint (Int.sign_ext (Z.of_N sz) n))
| _ => None
end
| sext_case_l =>
match v with
| Vlong n => Some (Vlong (Int64.sign_ext (Z.of_N sz) n))
| _ => None
end
| _ => None
end.
(** *** Sqrt *)
Definition sem_sqrt (v: val) (mt: type) : option val :=
match classify_recip mt with
| recip_case_f =>
match v with
| Vfloat f =>
Some (Vfloat (Float.sqrt f))
| _ => None
end
| recip_case_s =>
match v with
| Vsingle s =>
Some (Vsingle (Float32.sqrt s))
| _ => None
end
| recip_case_default => None
end.
(** ** Binary operators *)
(** For binary operations, the "usual binary conversions" consist in
- determining the type at which the operation is to be performed
(a form of least upper bound of the types of the two arguments);
- casting the two arguments to this common type;
- performing the operation at that type.
*)
Inductive binarith_cases: Type :=
| bin_case_i (s: signedness) (**r at int type *)
| bin_case_l (s: signedness) (**r at long int type *)
| bin_case_f (**r at double float type *)
| bin_case_s (**r at single float type *)
| bin_default. (**r error *)
Definition classify_binarith (mt1: type) (mt2: type) : binarith_cases :=
match mt1, mt2 with
| Tprim pt1, Tprim pt2 =>
match pt1, pt2 with
| PTint I64 Signed, PTint I64 Signed => bin_case_l Signed
| PTint I64 _, PTint I64 _ => bin_case_l Unsigned
| PTint I64 sg, PTint _ _ => bin_case_l sg
| PTint _ _, PTint I64 sg => bin_case_l sg
| PTint I32 Unsigned, PTint _ _ => bin_case_i Unsigned
| PTint _ _, PTint I32 Unsigned => bin_case_i Unsigned
| PTint _ _, PTint _ _ => bin_case_i Signed
| PTfloat F32, PTfloat F32 => bin_case_s
| PTfloat _, PTfloat _ => bin_case_f
| PTfloat F64, PTint _ _ => bin_case_f
| PTint _ _, PTfloat F64 => bin_case_f
| PTfloat F32, PTint _ _ => bin_case_s
| PTint _ _, PTfloat F32 => bin_case_s
| _, _ => bin_default
end
| _, _ => bin_default
end.
(** The static type of the result. Both arguments are converted to this type
before the actual computation. *)
Definition binarith_type (c: binarith_cases) : type :=
match c with
| bin_case_i sg => Tprim (PTint I32 sg)
| bin_case_l sg => Tprim (PTint I64 sg)
| bin_case_f => Tprim (PTfloat F64)
| bin_case_s => Tprim (PTfloat F32)
| bin_default => Tprim (PTvoid)
end.
Lemma binarith_type_of_int_preserve:
forall si,
binarith_type (classify_binarith (Tprim (PTint I32 si)) (Tprim (PTint I32 si))) = (Tprim (PTint I32 si)).
Proof.
intros. destruct si; simpl; auto.
Qed.
Lemma binarith_type_of_long_preserve:
forall si,
binarith_type (classify_binarith (Tprim (PTint I64 si)) (Tprim (PTint I64 si))) = (Tprim (PTint I64 si)).
Proof.
intros. destruct si; simpl; auto.
Qed.
Lemma binarith_type_of_float_preserve:
binarith_type (classify_binarith (Tprim (PTfloat F64)) (Tprim (PTfloat F64))) = (Tprim (PTfloat F64)).
Proof.
intros. simpl; auto.
Qed.
Lemma binarith_type_of_single_preserve:
binarith_type (classify_binarith (Tprim (PTfloat F32)) (Tprim (PTfloat F32))) = (Tprim (PTfloat F32)).
Proof.
intros. simpl; auto.
Qed.
Definition sem_binarith
(sem_int: signedness -> int -> int -> option val)
(sem_long: signedness -> int64 -> int64 -> option val)
(sem_float: float -> float -> option val)
(sem_single: float32 -> float32 -> option val)
(v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env): option val :=
let c := classify_binarith mt1 mt2 in
let mt := binarith_type c in
match sem_cast v1 mt1 mt m ce with
| None => None
| Some v1' =>
match sem_cast v2 mt2 mt m ce with
| None => None
| Some v2' =>
match c with
| bin_case_i sg =>
match v1, v2 with
| Vint n1, Vint n2 => sem_int sg n1 n2
| _, _ => None
end
| bin_case_f =>
match v1, v2 with
| Vfloat n1, Vfloat n2 => sem_float n1 n2
| _, _ => None
end
| bin_case_s =>
match v1, v2 with
| Vsingle n1, Vsingle n2 => sem_single n1 n2
| _, _ => None
end
| bin_case_l sg =>
match v1, v2 with
| Vlong n1, Vlong n2 => sem_long sg n1 n2
| _, _ => None
end
| bin_default => None
end end end.
(** *** Addition *)
Definition sem_add (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some(Vint(Int.add n1 n2)))
(fun sg n1 n2 => Some(Vlong(Int64.add n1 n2)))
(fun n1 n2 => Some(Vfloat(Float.add n1 n2)))
(fun n1 n2 => Some(Vsingle(Float32.add n1 n2)))
v1 mt1 v2 mt2 m ce.
(** *** Subtraction *)
Definition sem_sub (v1: val) (mt1: type) (v2: val) (mt2: type) (m:mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some(Vint(Int.sub n1 n2)))
(fun sg n1 n2 => Some(Vlong(Int64.sub n1 n2)))
(fun n1 n2 => Some(Vfloat(Float.sub n1 n2)))
(fun n1 n2 => Some(Vsingle(Float32.sub n1 n2)))
v1 mt1 v2 mt2 m ce.
(** *** Multiplication, division, modulus *)
Definition sem_mul (v1: val) (mt1: type) (v2: val) (mt2: type) (m:mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some(Vint(Int.mul n1 n2)))
(fun sg n1 n2 => Some(Vlong(Int64.mul n1 n2)))
(fun n1 n2 => Some(Vfloat(Float.mul n1 n2)))
(fun n1 n2 => Some(Vsingle(Float32.mul n1 n2)))
v1 mt1 v2 mt2 m ce.
Definition sem_div (v1: val) (mt1: type) (v2: val) (mt2: type) (m:mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 =>
match sg with
| Signed =>
if Int.eq n2 Int.zero
|| Int.eq n1 (Int.repr Int.min_signed) && Int.eq n2 Int.mone
then None else Some(Vint(Int.divs n1 n2))
| Unsigned =>
if Int.eq n2 Int.zero
then None else Some(Vint(Int.divu n1 n2))
end)
(fun sg n1 n2 =>
match sg with
| Signed =>
if Int64.eq n2 Int64.zero
|| Int64.eq n1 (Int64.repr Int64.min_signed) && Int64.eq n2 Int64.mone
then None else Some(Vlong(Int64.divs n1 n2))
| Unsigned =>
if Int64.eq n2 Int64.zero
then None else Some(Vlong(Int64.divu n1 n2))
end)
(fun n1 n2 => Some(Vfloat(Float.div n1 n2)))
(fun n1 n2 => Some(Vsingle(Float32.div n1 n2)))
v1 mt1 v2 mt2 m ce.
Definition sem_rem (v1: val) (mt1: type) (v2: val) (mt2: type) (m:mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 =>
match sg with
| Signed =>
if Int.eq n2 Int.zero
|| Int.eq n1 (Int.repr Int.min_signed) && Int.eq n2 Int.mone
then None else Some(Vint(Int.mods n1 n2))
| Unsigned =>
if Int.eq n2 Int.zero
then None else Some(Vint(Int.modu n1 n2))
end)
(fun sg n1 n2 =>
match sg with
| Signed =>
if Int64.eq n2 Int64.zero
|| Int64.eq n1 (Int64.repr Int64.min_signed) && Int64.eq n2 Int64.mone
then None else Some(Vlong(Int64.mods n1 n2))
| Unsigned =>
if Int64.eq n2 Int64.zero
then None else Some(Vlong(Int64.modu n1 n2))
end)
(fun n1 n2 => None)
(fun n1 n2 => None)
v1 mt1 v2 mt2 m ce.
Definition sem_band (v1: val) (mt1: type) (v2: val) (mt2: type) (m:mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some(Vint(Int.and n1 n2)))
(fun sg n1 n2 => Some(Vlong(Int64.and n1 n2)))
(fun n1 n2 => None)
(fun n1 n2 => None)
v1 mt1 v2 mt2 m ce.
Definition sem_bior (v1: val) (mt1: type) (v2: val) (mt2: type) (m:mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some(Vint(Int.or n1 n2)))
(fun sg n1 n2 => Some(Vlong(Int64.or n1 n2)))
(fun n1 n2 => None)
(fun n1 n2 => None)
v1 mt1 v2 mt2 m ce.
Definition sem_bxor (v1:val) (mt1: type) (v2: val) (mt2: type) (m:mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some(Vint(Int.xor n1 n2)))
(fun sg n1 n2 => Some(Vlong(Int64.xor n1 n2)))
(fun n1 n2 => None)
(fun n1 n2 => None)
v1 mt1 v2 mt2 m ce.
(** *** Shifts *)
(** Shifts do not perform the usual binary conversions. Instead,
each argument is converted independently, and the signedness
of the result is always that of the first argument. *)
Inductive classify_shift_cases : Type:=
| shift_case_ii(s: signedness) (**r int , int *)
| shift_case_ll(s: signedness) (**r long, long *)
| shift_case_il(s: signedness) (**r int, long *)
| shift_case_li(s: signedness) (**r long, int *)
| shift_default.
Definition classify_shift (mt1: type) (mt2: type) :=
match typeconv mt1, typeconv mt2 with
| Tprim pt1, Tprim pt2 =>
match pt1, pt2 with
| PTint I64 s, PTint I64 _ => shift_case_ll s
| PTint I64 s, PTint _ _ => shift_case_li s
| PTint I32 Unsigned, PTint I64 _ => shift_case_il Unsigned
| PTint _ _, PTint I64 _ => shift_case_il Signed
| PTint I32 Unsigned, PTint _ _ => shift_case_ii Unsigned
| PTint _ _, PTint _ _ => shift_case_ii Signed
| _,_ => shift_default
end
| _, _ => shift_default
end.
Definition sem_shift
(sem_int: signedness -> int -> int -> int)
(sem_long: signedness -> int64 -> int64 -> int64)
(v1: val) (mt1: type) (v2: val) (mt2: type) : option val :=
match classify_shift mt1 mt2 with
| shift_case_ii sg =>
match v1, v2 with
| Vint n1, Vint n2 =>
if Int.ltu n2 Int.iwordsize
then Some(Vint(sem_int sg n1 n2)) else None
| _, _ => None
end
| shift_case_il sg =>
match v1, v2 with
| Vint n1, Vlong n2 =>
if Int64.ltu n2 (Int64.repr 32)
then Some(Vint(sem_int sg n1 (Int64.loword n2))) else None
| _, _ => None
end
| shift_case_li sg =>
match v1, v2 with
| Vlong n1, Vint n2 =>
if Int.ltu n2 Int64.iwordsize'
then Some(Vlong(sem_long sg n1 (Int64.repr (Int.unsigned n2)))) else None
| _, _ => None
end
| shift_case_ll sg =>
match v1, v2 with
| Vlong n1, Vlong n2 =>
if Int64.ltu n2 Int64.iwordsize
then Some(Vlong(sem_long sg n1 n2)) else None
| _, _ => None
end
| shift_default => None
end.
Definition sem_shl (v1: val) (mt1: type) (v2: val) (mt2: type) : option val :=
sem_shift
(fun sg n1 n2 => Int.shl n1 n2)
(fun sg n1 n2 => Int64.shl n1 n2)
v1 mt1 v2 mt2.
Definition sem_ashr (v1: val) (mt1: type) (v2: val) (mt2: type) : option val :=
sem_shift
(fun sg n1 n2 => Int.shr n1 n2)
(fun sg n1 n2 => Int64.shr n1 n2)
v1 mt1 v2 mt2.
Definition sem_lshr (v1: val) (mt1: type) (v2: val) (mt2: type) : option val :=
sem_shift
(fun sg n1 n2 => Int.shru n1 n2)
(fun sg n1 n2 => Int64.shru n1 n2)
v1 mt1 v2 mt2.
(** *** Comparisons *)
Inductive classify_cmp_cases : Type :=
| cmp_case_pp (**r pointer, pointer *)
| cmp_case_pi (si: signedness) (**r pointer, int *)
| cmp_case_ip (si: signedness) (**r int, pointer *)
| cmp_case_pl (**r pointer, long *)
| cmp_case_lp (**r long, pointer *)
| cmp_default. (**r numerical, numerical *)
Definition classify_cmp (mt1: type) (mt2: type) :=
match typeconv mt1, typeconv mt2 with
| (Tpointer _ | Tprim (PTptr | PTref)), Tprim (PTint I64 _ | PTaddr A64) => cmp_case_pl
| Tprim (PTint I64 _ | PTaddr A64), (Tpointer _ | Tprim (PTptr | PTref)) => cmp_case_lp
| (Tpointer _ | Tprim (PTptr | PTref)), (Tpointer _ | Tprim (PTptr | PTref)) => cmp_case_pp
| (Tpointer _ | Tprim (PTptr | PTref)), Tprim (PTint _ si) => cmp_case_pi si
| (Tpointer _ | Tprim (PTptr | PTref)), Tprim (PTaddr A32) => cmp_case_pi Unsigned
| Tprim (PTint _ si), (Tpointer _ | Tprim (PTptr | PTref)) => cmp_case_ip si
| _, _ => cmp_default
end.
Definition cmp_ptr (m: mem) (c: comparison) (v1 v2: val): option val :=
option_map Val.of_bool
(if Archi.ptr64
then Val.cmplu_bool (Mem.valid_pointer m) c v1 v2
else Val.cmpu_bool (Mem.valid_pointer m) c v1 v2).
Definition ptrofs_of_int (si: signedness) (n: int) : ptrofs :=
match si with
| Signed => Ptrofs.of_ints n
| Unsigned => Ptrofs.of_intu n
end.
Definition sem_cmp_bool (c:comparison) (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env): option val :=
match classify_cmp mt1 mt2 with
| cmp_case_pp =>
cmp_ptr m c v1 v2
| cmp_case_pi si =>
match v2 with
| Vint n2 =>
let v2' := Vptrofs (ptrofs_of_int si n2) in
cmp_ptr m c v1 v2'
| Vptr b ofs =>
if Archi.ptr64 then None else cmp_ptr m c v1 v2
| _ =>
None
end
| cmp_case_ip si =>
match v1 with
| Vint n1 =>
let v1' := Vptrofs (ptrofs_of_int si n1) in
cmp_ptr m c v1' v2
| Vptr b ofs =>
if Archi.ptr64 then None else cmp_ptr m c v1 v2
| _ =>
None
end
| cmp_case_pl =>
match v2 with
| Vlong n2 =>
let v2' := Vptrofs (Ptrofs.of_int64 n2) in
cmp_ptr m c v1 v2'
| Vptr b ofs =>
if Archi.ptr64 then cmp_ptr m c v1 v2 else None
| _ =>
None
end
| cmp_case_lp =>
match v1 with
| Vlong n1 =>
let v1' := Vptrofs (Ptrofs.of_int64 n1) in
cmp_ptr m c v1' v2
| Vptr b ofs =>
if Archi.ptr64 then cmp_ptr m c v1 v2 else None
| _ =>
None
end
| cmp_default =>
sem_binarith
(fun sg n1 n2 =>
Some(Val.of_bool(match sg with Signed => Int.cmp c n1 n2 | Unsigned => Int.cmpu c n1 n2 end)))
(fun sg n1 n2 =>
Some(Val.of_bool(match sg with Signed => Int64.cmp c n1 n2 | Unsigned => Int64.cmpu c n1 n2 end)))
(fun n1 n2 =>
Some(Val.of_bool(Float.cmp c n1 n2)))
(fun n1 n2 =>
Some(Val.of_bool(Float32.cmp c n1 n2)))
v1 mt1 v2 mt2 m ce
end.
Definition cmp_int (sg: signedness) (x y: int) : Datatypes.comparison :=
match sg with
| Signed => Z.compare (Int.signed x) (Int.signed y)
| Unsigned => Z.compare (Int.unsigned x) (Int.unsigned y)
end.
Definition cmp_long (sg: signedness) (x y: int64) : Datatypes.comparison :=
match sg with
| Signed => Z.compare (Int64.signed x) (Int64.signed y)
| Unsigned => Z.compare (Int64.unsigned x) (Int64.unsigned y)
end.
Definition val_of_comparison (c: Datatypes.comparison) :=
match c with
| Eq => Vint Int.zero
| Gt => Vint Int.one
| Lt => Vint Int.mone
end.
Definition sem_cmp (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some (val_of_comparison (cmp_int sg n1 n2)))
(fun sg n1 n2 => Some (val_of_comparison (cmp_long sg n1 n2)))
(fun n1 n2 => option_map val_of_comparison (Float.compare n1 n2))
(fun n1 n2 => option_map val_of_comparison (Float32.compare n1 n2))
v1 mt1 v2 mt2 m ce.
Definition cmpg_float (x y: float) : Datatypes.comparison :=
match Float.compare x y with
| Some c => c
| None => Gt
end.
Definition cmpg_single (x y: float32) : Datatypes.comparison :=
match Float32.compare x y with
| Some c => c
| None => Gt
end.
Definition sem_cmpg (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some (val_of_comparison (cmp_int sg n1 n2)))
(fun sg n1 n2 => Some (val_of_comparison (cmp_long sg n1 n2)))
(fun n1 n2 => Some (val_of_comparison (cmpg_float n1 n2)))
(fun n1 n2 => Some (val_of_comparison (cmpg_single n1 n2)))
v1 mt1 v2 mt2 m ce.
Definition cmpl_float (x y: float) : Datatypes.comparison :=
match Float.compare x y with
| Some c => c
| None => Lt
end.
Definition cmpl_single (x y: float32) : Datatypes.comparison :=
match Float32.compare x y with
| Some c => c
| None => Lt
end.
Definition sem_cmpl (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some (val_of_comparison (cmp_int sg n1 n2)))
(fun sg n1 n2 => Some (val_of_comparison (cmp_long sg n1 n2)))
(fun n1 n2 => Some (val_of_comparison (cmpl_float n1 n2)))
(fun n1 n2 => Some (val_of_comparison (cmpl_single n1 n2)))
v1 mt1 v2 mt2 m ce.
Definition sem_max (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some (Vint (match cmp_int sg n1 n2 with Lt => n2 | _ => n1 end)))
(fun sg n1 n2 => Some (Vlong (match cmp_long sg n1 n2 with Lt => n2 | _ => n1 end)))
(fun n1 n2 => match Float.compare n1 n2 with Some Lt => Some (Vfloat n2) | Some _ => Some (Vfloat n1) | None => None end)
(fun n1 n2 => match Float32.compare n1 n2 with Some Lt => Some (Vsingle n2) | Some _ => Some (Vsingle n1) | None => None end)
v1 mt1 v2 mt2 m ce.
Definition sem_min (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some (Vint (match cmp_int sg n1 n2 with Gt => n2 | _ => n1 end)))
(fun sg n1 n2 => Some (Vlong (match cmp_long sg n1 n2 with Gt => n2 | _ => n1 end)))
(fun n1 n2 => match Float.compare n1 n2 with Some Gt => Some (Vfloat n2) | Some _ => Some (Vfloat n1) | None => None end)
(fun n1 n2 => match Float32.compare n1 n2 with Some Gt => Some (Vsingle n2) | Some _ => Some (Vsingle n1) | None => None end)
v1 mt1 v2 mt2 m ce.
(*
Definition bool_int (n: int) := negb (Int.eq n Int.zero).
Definition land_int (x y: int) := bool_int x && bool_int y.
Definition lior_int (x y: int) := bool_int x || bool_int y.
Definition bool_long (n: int64) := negb (Int64.eq n Int64.zero).
Definition land_long (x y: int64) := bool_long x && bool_long y.
Definition lior_long (x y: int64) := bool_long x || bool_long y.
Definition sem_land (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some (Val.of_bool (land_int n1 n2)))
(fun sg n1 n2 => Some (Val.of_bool (land_long n1 n2)))
(fun n1 n2 => None)
(fun n1 n2 => None)
v1 mt1 v2 mt2 m ce.
Definition sem_lior (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env) : option val :=
sem_binarith
(fun sg n1 n2 => Some (Val.of_bool (lior_int n1 n2)))
(fun sg n1 n2 => Some (Val.of_bool (lior_long n1 n2)))
(fun n1 n2 => None)
(fun n1 n2 => None)
v1 mt1 v2 mt2 m ce.
*)
Definition sem_land (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env) : option val :=
match bool_val v1 mt1 m, bool_val v2 mt2 m with
| Some b1, Some b2 => Some (Val.of_bool (b1 && b2))
| _, _ => None
end.
Definition sem_lior (v1: val) (mt1: type) (v2: val) (mt2: type) (m: mem) (ce: composite_env) : option val :=
match bool_val v1 mt1 m, bool_val v2 mt2 m with
| Some b1, Some b2 => Some (Val.of_bool (b1 || b2))
| _, _ => None
end.
(** ** Argument of a [switch] statement *)
Inductive classify_switch_cases : Type :=
| switch_case_i
| switch_case_l
| switch_default.
Definition classify_switch (mt: type) :=
match mt with
| Tprim pt =>
match pt with
| PTint I64 _ => switch_case_l
| PTint _ _ => switch_case_i
| _ => switch_default
end
| _ => switch_default
end.
Definition sem_switch_arg (v: val) (mt: type): option Z :=
match classify_switch mt with
| switch_case_i =>
match v with Vint n => Some (Int.unsigned n) | _ => None end
| switch_case_l =>
match v with Vlong n => Some (Int64.unsigned n) | _ => None end
| switch_default =>
None
end.
(** * Combined semantics of unary and binary operators *)
Definition sem_unary_operation
(op: unary_operation) (v: val) (tfrom tto: type) (m: mem) (ce: composite_env) : option val :=
match sem_cast v tto tfrom m ce with
| Some v' =>
match op with
| O_abs => sem_abs v' tto
| O_bnot => sem_bnot v' tto
| O_lnot =>
match sem_lnot v' tto m with
| Some v'' => sem_cast v'' (Tprim (PTint I32 Signed)) tto m ce
| None => None
end
| O_neg => sem_neg v' tto
| O_recip => sem_recip v' tto
| O_sext sz => sem_sext v' sz tto
| O_zext sz => sem_zext v' sz tto
| O_sqrt => sem_sqrt v' tto
end
| None => None
end.
Definition sem_binary_operation
(op: binary_operation)
(v1: val) (mt1: type) (v2: val) (mt2: type) (mt: type)
(m: mem) (ce: composite_env) : option val :=
match op with
| O_add =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_add v1' mt v2' mt m ce
| _, _ => None
end
| O_sub =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_sub v1' mt v2' mt m ce
| _, _ => None
end
| O_mul =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_mul v1' mt v2' mt m ce
| _, _ => None
end
| O_div =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_div v1' mt v2' mt m ce
| _, _ => None
end
| O_rem =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_rem v1' mt v2' mt m ce
| _, _ => None
end
| O_band =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_band v1' mt v2' mt m ce
| _, _ => None
end
| O_bior =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_bior v1' mt v2' mt m ce
| _, _ => None
end
| O_bxor =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_bxor v1' mt v2' mt m ce
| _, _ => None
end
| O_land =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' =>
match sem_land v1' mt v2' mt m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
| O_lior =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' =>
match sem_lior v1' mt v2' mt m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
| O_ashr =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_ashr v1' mt v2' mt
| _, _ => None
end
| O_lshr =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_lshr v1' mt v2' mt
| _, _ => None
end
| O_shl =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_shl v1' mt v2' mt
| _, _ => None
end
| O_max =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_max v1' mt v2' mt m ce
| _, _ => None
end
| O_min =>
match sem_cast v1 mt1 mt m ce, sem_cast v2 mt2 mt m ce with
| Some v1', Some v2' => sem_min v1' mt v2' mt m ce
| _, _ => None
end
| O_cmp pt =>
match sem_cast v1 mt1 (Tprim pt) m ce, sem_cast v2 mt2 (Tprim pt) m ce with
| Some v1', Some v2' =>
match sem_cmp v1' (Tprim pt) v2' (Tprim pt) m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
| O_cmpg pt =>
match sem_cast v1 mt1 (Tprim pt) m ce, sem_cast v2 mt2 (Tprim pt) m ce with
| Some v1', Some v2' =>
match sem_cmpg v1' (Tprim pt) v2' (Tprim pt) m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
| O_cmpl pt =>
match sem_cast v1 mt1 (Tprim pt) m ce, sem_cast v2 mt2 (Tprim pt) m ce with
| Some v1', Some v2' =>
match sem_cmpl v1' (Tprim pt) v2' (Tprim pt) m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
| O_eq pt =>
match sem_cast v1 mt1 (Tprim pt) m ce, sem_cast v2 mt2 (Tprim pt) m ce with
| Some v1', Some v2' =>
match sem_cmp_bool Ceq v1' (Tprim pt) v2' (Tprim pt) m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
| O_ne pt =>
match sem_cast v1 mt1 (Tprim pt) m ce, sem_cast v2 mt2 (Tprim pt) m ce with
| Some v1', Some v2' =>
match sem_cmp_bool Cne v1' (Tprim pt) v2' (Tprim pt) m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
| O_lt pt =>
match sem_cast v1 mt1 (Tprim pt) m ce, sem_cast v2 mt2 (Tprim pt) m ce with
| Some v1', Some v2' =>
match sem_cmp_bool Clt v1' (Tprim pt) v2' (Tprim pt) m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
| O_gt pt =>
match sem_cast v1 mt1 (Tprim pt) m ce, sem_cast v2 mt2 (Tprim pt) m ce with
| Some v1', Some v2' =>
match sem_cmp_bool Cgt v1' (Tprim pt) v2' (Tprim pt) m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
| O_le pt =>
match sem_cast v1 mt1 (Tprim pt) m ce, sem_cast v2 mt2 (Tprim pt) m ce with
| Some v1', Some v2' =>
match sem_cmp_bool Cle v1' (Tprim pt) v2' (Tprim pt) m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
| O_ge pt =>
match sem_cast v1 mt1 (Tprim pt) m ce, sem_cast v2 mt2 (Tprim pt) m ce with
| Some v1', Some v2' =>
match sem_cmp_bool Cge v1' (Tprim pt) v2' (Tprim pt) m ce with
| Some v => sem_cast v (Tprim (PTint I32 Signed)) mt m ce
| None => None
end
| _, _ => None
end
end.
Definition sem_trunc (v: val) (ptfrom ptto: prim_type) : option val :=
match classify_cast (Tprim ptfrom) (Tprim ptto), v with
| cast_case_f2i sz si, Vfloat f =>
match cast_float_int si f with
| Some i => Some (Vint (cast_int_int sz si i))
| None => None
end
| cast_case_f2l si, Vfloat f =>
match cast_float_long si f with
| Some i => Some (Vlong i)
| None => None
end
| cast_case_s2i sz si, Vsingle f =>
match cast_single_int si f with
| Some i => Some (Vint (cast_int_int sz si i))
| None => None
end
| cast_case_f2l si, Vsingle f =>
match cast_single_long si f with
| Some i => Some (Vlong i)
| None => None
end
| _, _ => None
end.
Definition ceil_float_int (si: signedness) (f: float) : option int :=
match si with
| Signed =>
match Float.to_int f with
| Some n =>
match Float.compare f (Float.of_int n) with
| Some Gt => Some (Int.add n Int.one)
| Some _ => Some n
| None => None
end
| None => None
end
| Unsigned =>
match Float.to_intu f with
| Some n =>
match Float.compare f (Float.of_intu n) with
| Some Gt => Some (Int.add n Int.one)
| Some _ => Some n
| None => None
end
| None => None
end
end.
Definition ceil_float_long (si: signedness) (f: float) : option int64 :=
match si with
| Signed =>
match Float.to_long f with
| Some n =>
match Float.compare f (Float.of_long n) with
| Some Gt => Some (Int64.add n Int64.one)
| Some _ => Some n
| None => None
end
| None => None
end
| Unsigned =>
match Float.to_longu f with
| Some n =>
match Float.compare f (Float.of_longu n) with
| Some Gt => Some (Int64.add n Int64.one)
| Some _ => Some n
| None => None
end
| None => None
end
end.
Definition ceil_single_int (si: signedness) (f: float32) : option int :=
match si with
| Signed =>
match Float32.to_int f with
| Some n =>
match Float32.compare f (Float32.of_int n) with
| Some Gt => Some (Int.add n Int.one)
| Some _ => Some n
| None => None
end
| None => None
end
| Unsigned =>
match Float32.to_intu f with
| Some n =>
match Float32.compare f (Float32.of_intu n) with
| Some Gt => Some (Int.add n Int.one)
| Some _ => Some n
| None => None
end
| None => None
end
end.
Definition ceil_single_long (si: signedness) (f: float32) : option int64 :=
match si with
| Signed =>
match Float32.to_long f with
| Some n =>
match Float32.compare f (Float32.of_long n) with
| Some Gt => Some (Int64.add n Int64.one)
| Some _ => Some n
| None => None
end
| None => None
end
| Unsigned =>
match Float32.to_longu f with
| Some n =>
match Float32.compare f (Float32.of_longu n) with
| Some Gt => Some (Int64.add n Int64.one)
| Some _ => Some n
| None => None
end
| None => None
end
end.
Definition sem_ceil (v: val) (ptfrom ptto: prim_type) : option val :=
match classify_cast (Tprim ptfrom) (Tprim ptto), v with
| cast_case_f2i sz si, Vfloat f =>
match ceil_float_int si f with
| Some i => Some (Vint (cast_int_int sz si i))
| None => None
end
| cast_case_f2l si, Vfloat f =>
match ceil_float_long si f with
| Some i => Some (Vlong i)
| None => None
end
| cast_case_s2i sz si, Vsingle f =>
match ceil_single_int si f with
| Some i => Some (Vint (cast_int_int sz si i))
| None => None
end
| cast_case_f2l si, Vsingle f =>
match ceil_single_long si f with
| Some i => Some (Vlong i)
| None => None
end
| _, _ => None
end.
Definition floor_float_int (si: signedness) (f: float) : option int :=
match si with
| Signed =>
match Float.to_int f with
| Some n =>
match Float.compare f (Float.of_int n) with
| Some Lt => Some (Int.sub n Int.one)
| Some _ => Some n
| None => None
end
| None => None
end
| Unsigned =>
match Float.to_intu f with
| Some n =>
match Float.compare f (Float.of_intu n) with
| Some Lt => Some (Int.sub n Int.one)
| Some _ => Some n
| None => None
end
| None => None
end
end.
Definition floor_float_long (si: signedness) (f: float) : option int64 :=
match si with
| Signed =>
match Float.to_long f with
| Some n =>
match Float.compare f (Float.of_long n) with
| Some Lt => Some (Int64.sub n Int64.one)
| Some _ => Some n
| None => None
end
| None => None
end
| Unsigned =>
match Float.to_longu f with
| Some n =>
match Float.compare f (Float.of_longu n) with
| Some Lt => Some (Int64.sub n Int64.one)
| Some _ => Some n
| None => None
end
| None => None
end
end.
Definition floor_single_int (si: signedness) (f: float32) : option int :=
match si with
| Signed =>
match Float32.to_int f with
| Some n =>
match Float32.compare f (Float32.of_int n) with
| Some Lt => Some (Int.sub n Int.one)
| Some _ => Some n
| None => None
end
| None => None
end
| Unsigned =>
match Float32.to_intu f with
| Some n =>
match Float32.compare f (Float32.of_intu n) with
| Some Lt => Some (Int.sub n Int.one)
| Some _ => Some n
| None => None
end
| None => None
end
end.
Definition floor_single_long (si: signedness) (f: float32) : option int64 :=
match si with
| Signed =>
match Float32.to_long f with
| Some n =>
match Float32.compare f (Float32.of_long n) with
| Some Lt => Some (Int64.sub n Int64.one)
| Some _ => Some n
| None => None
end
| None => None
end
| Unsigned =>
match Float32.to_longu f with
| Some n =>
match Float32.compare f (Float32.of_longu n) with
| Some Lt => Some (Int64.sub n Int64.one)
| Some _ => Some n
| None => None
end
| None => None
end
end.
Definition sem_floor (v: val) (ptfrom ptto: prim_type) : option val :=
match classify_cast (Tprim ptfrom) (Tprim ptto), v with
| cast_case_f2i sz si, Vfloat f =>
match floor_float_int si f with
| Some i => Some (Vint (cast_int_int sz si i))
| None => None
end
| cast_case_f2l si, Vfloat f =>
match floor_float_long si f with
| Some i => Some (Vlong i)
| None => None
end
| cast_case_s2i sz si, Vsingle f =>
match floor_single_int si f with
| Some i => Some (Vint (cast_int_int sz si i))
| None => None
end
| cast_case_f2l si, Vsingle f =>
match floor_single_long si f with
| Some i => Some (Vlong i)
| None => None
end
| _, _ => None
end.
(*
Definition sem_incrdecr (cenv: composite_env) (id: incr_or_decr) (v: val) (ty: type) (m: mem) :=
match id with
| Incr => sem_add cenv v ty (Vint Int.one) type_int32s m
| Decr => sem_sub cenv v ty (Vint Int.one) type_int32s m
end.
Definition incrdecr_type (ty: type) :=
match typeconv ty with
| Tpointer ty a => Tpointer ty a
| Tint sz sg a => Tint sz sg noattr
| Tlong sg a => Tlong sg noattr
| Tfloat sz a => Tfloat sz noattr
| _ => Tvoid
end.
(** * Compatibility with extensions and injections *)
Section GENERIC_INJECTION.
Variable f: meminj.
Variables m m': mem.
Hypothesis valid_pointer_inj:
forall b1 ofs b2 delta,
f b1 = Some(b2, delta) ->
Mem.valid_pointer m b1 (Ptrofs.unsigned ofs) = true ->
Mem.valid_pointer m' b2 (Ptrofs.unsigned (Ptrofs.add ofs (Ptrofs.repr delta))) = true.
Hypothesis weak_valid_pointer_inj:
forall b1 ofs b2 delta,
f b1 = Some(b2, delta) ->
Mem.weak_valid_pointer m b1 (Ptrofs.unsigned ofs) = true ->
Mem.weak_valid_pointer m' b2 (Ptrofs.unsigned (Ptrofs.add ofs (Ptrofs.repr delta))) = true.
Hypothesis weak_valid_pointer_no_overflow:
forall b1 ofs b2 delta,
f b1 = Some(b2, delta) ->
Mem.weak_valid_pointer m b1 (Ptrofs.unsigned ofs) = true ->
0 <= Ptrofs.unsigned ofs + Ptrofs.unsigned (Ptrofs.repr delta) <= Ptrofs.max_unsigned.
Hypothesis valid_different_pointers_inj:
forall b1 ofs1 b2 ofs2 b1' delta1 b2' delta2,
b1 <> b2 ->
Mem.valid_pointer m b1 (Ptrofs.unsigned ofs1) = true ->
Mem.valid_pointer m b2 (Ptrofs.unsigned ofs2) = true ->
f b1 = Some (b1', delta1) ->
f b2 = Some (b2', delta2) ->
b1' <> b2' \/
Ptrofs.unsigned (Ptrofs.add ofs1 (Ptrofs.repr delta1)) <> Ptrofs.unsigned (Ptrofs.add ofs2 (Ptrofs.repr delta2)).
Remark val_inject_vtrue: forall f, Val.inject f Vtrue Vtrue.
Proof. unfold Vtrue; auto. Qed.
Remark val_inject_vfalse: forall f, Val.inject f Vfalse Vfalse.
Proof. unfold Vfalse; auto. Qed.
Remark val_inject_of_bool: forall f b, Val.inject f (Val.of_bool b) (Val.of_bool b).
Proof. intros. unfold Val.of_bool. destruct b; [apply val_inject_vtrue|apply val_inject_vfalse].
Qed.
Remark val_inject_vptrofs: forall n, Val.inject f (Vptrofs n) (Vptrofs n).
Proof. intros. unfold Vptrofs. destruct Archi.ptr64; auto. Qed.
Local Hint Resolve val_inject_vtrue val_inject_vfalse val_inject_of_bool val_inject_vptrofs : core.
Ltac TrivialInject :=
match goal with
| [ H: None = Some _ |- _ ] => discriminate
| [ H: Some _ = Some _ |- _ ] => inv H; TrivialInject
| [ H: match ?x with Some _ => _ | None => _ end = Some _ |- _ ] => destruct x; TrivialInject
| [ H: match ?x with true => _ | false => _ end = Some _ |- _ ] => destruct x eqn:?; TrivialInject
| [ |- exists v', Some ?v = Some v' /\ _ ] => exists v; split; auto
| _ => idtac
end.
Lemma sem_cast_inj:
forall v1 ty1 ty v tv1,
sem_cast v1 ty1 ty m = Some v ->
Val.inject f v1 tv1 ->
exists tv, sem_cast tv1 ty1 ty m'= Some tv /\ Val.inject f v tv.
Proof.
unfold sem_cast; intros; destruct (classify_cast ty1 ty); inv H0; TrivialInject.
- econstructor; eauto.
- erewrite weak_valid_pointer_inj by eauto. TrivialInject.
- erewrite weak_valid_pointer_inj by eauto. TrivialInject.
- destruct (ident_eq id1 id2); TrivialInject. econstructor; eauto.
- destruct (ident_eq id1 id2); TrivialInject. econstructor; eauto.
- econstructor; eauto.
Qed.
Lemma bool_val_inj:
forall v ty b tv,
bool_val v ty m = Some b ->
Val.inject f v tv ->
bool_val tv ty m' = Some b.
Proof.
unfold bool_val; intros.
destruct (classify_bool ty); inv H0; try congruence.
destruct Archi.ptr64; try discriminate.
destruct (Mem.weak_valid_pointer m b1 (Ptrofs.unsigned ofs1)) eqn:VP; inv H.
erewrite weak_valid_pointer_inj by eauto. auto.
destruct Archi.ptr64; try discriminate.
destruct (Mem.weak_valid_pointer m b1 (Ptrofs.unsigned ofs1)) eqn:VP; inv H.
erewrite weak_valid_pointer_inj by eauto. auto.
Qed.
Lemma sem_unary_operation_inj:
forall op v1 ty v tv1,
sem_unary_operation op v1 ty m = Some v ->
Val.inject f v1 tv1 ->
exists tv, sem_unary_operation op tv1 ty m' = Some tv /\ Val.inject f v tv.
Proof.
unfold sem_unary_operation; intros. destruct op.
- (* notbool *)
unfold sem_notbool in *. destruct (bool_val v1 ty m) as [b|] eqn:BV; simpl in H; inv H.
erewrite bool_val_inj by eauto. simpl. TrivialInject.
- (* notint *)
unfold sem_notint in *; destruct (classify_notint ty); inv H0; inv H; TrivialInject.
- (* neg *)
unfold sem_neg in *; destruct (classify_neg ty); inv H0; inv H; TrivialInject.
- (* absfloat *)
unfold sem_absfloat in *; destruct (classify_neg ty); inv H0; inv H; TrivialInject.
Qed.
Definition optval_self_injects (ov: option val) : Prop :=
match ov with
| Some (Vptr b ofs) => False
| _ => True
end.
Remark sem_binarith_inject:
forall sem_int sem_long sem_float sem_single v1 t1 v2 t2 v v1' v2',
sem_binarith sem_int sem_long sem_float sem_single v1 t1 v2 t2 m = Some v ->
Val.inject f v1 v1' -> Val.inject f v2 v2' ->
(forall sg n1 n2, optval_self_injects (sem_int sg n1 n2)) ->
(forall sg n1 n2, optval_self_injects (sem_long sg n1 n2)) ->
(forall n1 n2, optval_self_injects (sem_float n1 n2)) ->
(forall n1 n2, optval_self_injects (sem_single n1 n2)) ->
exists v', sem_binarith sem_int sem_long sem_float sem_single v1' t1 v2' t2 m' = Some v' /\ Val.inject f v v'.
Proof.
intros.
assert (SELF: forall ov v, ov = Some v -> optval_self_injects ov -> Val.inject f v v).
{
intros. subst ov; simpl in H7. destruct v0; contradiction || constructor.
}
unfold sem_binarith in *.
set (c := classify_binarith t1 t2) in *.
set (t := binarith_type c) in *.
destruct (sem_cast v1 t1 t m) as [w1|] eqn:C1; try discriminate.
destruct (sem_cast v2 t2 t m) as [w2|] eqn:C2; try discriminate.
exploit (sem_cast_inj v1); eauto. intros (w1' & C1' & INJ1).
exploit (sem_cast_inj v2); eauto. intros (w2' & C2' & INJ2).
rewrite C1'; rewrite C2'.
destruct c; inv INJ1; inv INJ2; discriminate || eauto.
Qed.
Remark sem_shift_inject:
forall sem_int sem_long v1 t1 v2 t2 v v1' v2',
sem_shift sem_int sem_long v1 t1 v2 t2 = Some v ->
Val.inject f v1 v1' -> Val.inject f v2 v2' ->
exists v', sem_shift sem_int sem_long v1' t1 v2' t2 = Some v' /\ Val.inject f v v'.
Proof.
intros. exists v.
unfold sem_shift in *; destruct (classify_shift t1 t2); inv H0; inv H1; try discriminate.
destruct (Int.ltu i0 Int.iwordsize); inv H; auto.
destruct (Int64.ltu i0 Int64.iwordsize); inv H; auto.
destruct (Int64.ltu i0 (Int64.repr 32)); inv H; auto.
destruct (Int.ltu i0 Int64.iwordsize'); inv H; auto.
Qed.
Remark sem_cmp_ptr_inj:
forall c v1 v2 v tv1 tv2,
cmp_ptr m c v1 v2 = Some v ->
Val.inject f v1 tv1 ->
Val.inject f v2 tv2 ->
exists tv, cmp_ptr m' c tv1 tv2 = Some tv /\ Val.inject f v tv.
Proof.
unfold cmp_ptr; intros.
remember (if Archi.ptr64
then Val.cmplu_bool (Mem.valid_pointer m) c v1 v2
else Val.cmpu_bool (Mem.valid_pointer m) c v1 v2) as ob.
destruct ob as [b|]; simpl in H; inv H.
exists (Val.of_bool b); split; auto.
destruct Archi.ptr64.
erewrite Val.cmplu_bool_inject by eauto. auto.
erewrite Val.cmpu_bool_inject by eauto. auto.
Qed.
Remark sem_cmp_inj:
forall cmp v1 tv1 ty1 v2 tv2 ty2 v,
sem_cmp cmp v1 ty1 v2 ty2 m = Some v ->
Val.inject f v1 tv1 ->
Val.inject f v2 tv2 ->
exists tv, sem_cmp cmp tv1 ty1 tv2 ty2 m' = Some tv /\ Val.inject f v tv.
Proof.
intros.
unfold sem_cmp in *; destruct (classify_cmp ty1 ty2).
- (* pointer - pointer *)
eapply sem_cmp_ptr_inj; eauto.
- (* pointer - int *)
inversion H1; subst; TrivialInject; eapply sem_cmp_ptr_inj; eauto.
- (* int - pointer *)
inversion H0; subst; TrivialInject; eapply sem_cmp_ptr_inj; eauto.
- (* pointer - long *)
inversion H1; subst; TrivialInject; eapply sem_cmp_ptr_inj; eauto.
- (* long - pointer *)
inversion H0; subst; TrivialInject; eapply sem_cmp_ptr_inj; eauto.
- (* numerical - numerical *)
assert (SELF: forall b, optval_self_injects (Some (Val.of_bool b))).
{
destruct b; exact I.
}
eapply sem_binarith_inject; eauto.
Qed.
Lemma sem_binary_operation_inj:
forall cenv op v1 ty1 v2 ty2 v tv1 tv2,
sem_binary_operation cenv op v1 ty1 v2 ty2 m = Some v ->
Val.inject f v1 tv1 -> Val.inject f v2 tv2 ->
exists tv, sem_binary_operation cenv op tv1 ty1 tv2 ty2 m' = Some tv /\ Val.inject f v tv.
Proof.
unfold sem_binary_operation; intros; destruct op.
- (* add *)
assert (A: forall cenv ty si v1' v2' tv1' tv2',
Val.inject f v1' tv1' -> Val.inject f v2' tv2' ->
sem_add_ptr_int cenv ty si v1' v2' = Some v ->
exists tv, sem_add_ptr_int cenv ty si tv1' tv2' = Some tv /\ Val.inject f v tv).
{ intros. unfold sem_add_ptr_int in *; inv H2; inv H3; TrivialInject.
econstructor. eauto. repeat rewrite Ptrofs.add_assoc. decEq. apply Ptrofs.add_commut. }
assert (B: forall cenv ty v1' v2' tv1' tv2',
Val.inject f v1' tv1' -> Val.inject f v2' tv2' ->
sem_add_ptr_long cenv ty v1' v2' = Some v ->
exists tv, sem_add_ptr_long cenv ty tv1' tv2' = Some tv /\ Val.inject f v tv).
{ intros. unfold sem_add_ptr_long in *; inv H2; inv H3; TrivialInject.
econstructor. eauto. repeat rewrite Ptrofs.add_assoc. decEq. apply Ptrofs.add_commut. }
unfold sem_add in *; destruct (classify_add ty1 ty2); eauto.
+ eapply sem_binarith_inject; eauto; intros; exact I.
- (* sub *)
unfold sem_sub in *; destruct (classify_sub ty1 ty2).
+ inv H0; inv H1; TrivialInject.
econstructor. eauto. rewrite Ptrofs.sub_add_l. auto.
+ inv H0; inv H1; TrivialInject.
destruct (eq_block b1 b0); try discriminate. subst b1.
rewrite H0 in H2; inv H2. rewrite dec_eq_true.
destruct (zlt 0 (sizeof cenv ty) && zle (sizeof cenv ty) Ptrofs.max_signed); inv H.
rewrite Ptrofs.sub_shifted. TrivialInject.
+ inv H0; inv H1; TrivialInject.
econstructor. eauto. rewrite Ptrofs.sub_add_l. auto.
+ eapply sem_binarith_inject; eauto; intros; exact I.
- (* mul *)
eapply sem_binarith_inject; eauto; intros; exact I.
- (* div *)
eapply sem_binarith_inject; eauto; intros.
destruct sg.
destruct (Int.eq n2 Int.zero
|| Int.eq n1 (Int.repr Int.min_signed) && Int.eq n2 Int.mone); exact I.
destruct (Int.eq n2 Int.zero); exact I.
destruct sg.
destruct (Int64.eq n2 Int64.zero
|| Int64.eq n1 (Int64.repr Int64.min_signed) && Int64.eq n2 Int64.mone); exact I.
destruct (Int64.eq n2 Int64.zero); exact I.
exact I.
exact I.
- (* mod *)
eapply sem_binarith_inject; eauto; intros.
destruct sg.
destruct (Int.eq n2 Int.zero
|| Int.eq n1 (Int.repr Int.min_signed) && Int.eq n2 Int.mone); exact I.
destruct (Int.eq n2 Int.zero); exact I.
destruct sg.
destruct (Int64.eq n2 Int64.zero
|| Int64.eq n1 (Int64.repr Int64.min_signed) && Int64.eq n2 Int64.mone); exact I.
destruct (Int64.eq n2 Int64.zero); exact I.
exact I.
exact I.
- (* and *)
eapply sem_binarith_inject; eauto; intros; exact I.
- (* or *)
eapply sem_binarith_inject; eauto; intros; exact I.
- (* xor *)
eapply sem_binarith_inject; eauto; intros; exact I.
- (* shl *)
eapply sem_shift_inject; eauto.
- (* shr *)
eapply sem_shift_inject; eauto.
(* comparisons *)
- eapply sem_cmp_inj; eauto.
- eapply sem_cmp_inj; eauto.
- eapply sem_cmp_inj; eauto.
- eapply sem_cmp_inj; eauto.
- eapply sem_cmp_inj; eauto.
- eapply sem_cmp_inj; eauto.
Qed.
End GENERIC_INJECTION.
Lemma sem_cast_inject:
forall f v1 ty1 ty m v tv1 tm,
sem_cast v1 ty1 ty m = Some v ->
Val.inject f v1 tv1 ->
Mem.inject f m tm ->
exists tv, sem_cast tv1 ty1 ty tm = Some tv /\ Val.inject f v tv.
Proof.
intros. eapply sem_cast_inj; eauto.
intros; eapply Mem.weak_valid_pointer_inject_val; eauto.
Qed.
Lemma sem_unary_operation_inject:
forall f m m' op v1 ty1 v tv1,
sem_unary_operation op v1 ty1 m = Some v ->
Val.inject f v1 tv1 ->
Mem.inject f m m' ->
exists tv, sem_unary_operation op tv1 ty1 m' = Some tv /\ Val.inject f v tv.
Proof.
intros. eapply sem_unary_operation_inj; eauto.
intros; eapply Mem.weak_valid_pointer_inject_val; eauto.
Qed.
Lemma sem_binary_operation_inject:
forall f m m' cenv op v1 ty1 v2 ty2 v tv1 tv2,
sem_binary_operation cenv op v1 ty1 v2 ty2 m = Some v ->
Val.inject f v1 tv1 -> Val.inject f v2 tv2 ->
Mem.inject f m m' ->
exists tv, sem_binary_operation cenv op tv1 ty1 tv2 ty2 m' = Some tv /\ Val.inject f v tv.
Proof.
intros. eapply sem_binary_operation_inj; eauto.
intros; eapply Mem.valid_pointer_inject_val; eauto.
intros; eapply Mem.weak_valid_pointer_inject_val; eauto.
intros; eapply Mem.weak_valid_pointer_inject_no_overflow; eauto.
intros; eapply Mem.different_pointers_inject; eauto.
Qed.
Lemma bool_val_inject:
forall f m m' v ty b tv,
bool_val v ty m = Some b ->
Val.inject f v tv ->
Mem.inject f m m' ->
bool_val tv ty m' = Some b.
Proof.
intros. eapply bool_val_inj; eauto.
intros; eapply Mem.weak_valid_pointer_inject_val; eauto.
Qed.
(** * Some properties of operator semantics *)
(** This section collects some common-sense properties about the type
classification and semantic functions above. Some properties are used
in the CompCert semantics preservation proofs. Others are not, but increase
confidence in the specification and its relation with the ISO C99 standard. *)
(** Relation between Boolean value and casting to [_Bool] type. *)
Lemma cast_bool_bool_val:
forall v t m,
sem_cast v t (Tint IBool Signed noattr) m =
match bool_val v t m with None => None | Some b => Some(Val.of_bool b) end.
intros.
assert (A: classify_bool t =
match t with
| Tint _ _ _ => bool_case_i
| Tpointer _ _ | Tarray _ _ _ | Tfunction _ _ _ => if Archi.ptr64 then bool_case_l else bool_case_i
| Tfloat F64 _ => bool_case_f
| Tfloat F32 _ => bool_case_s
| Tlong _ _ => bool_case_l
| _ => bool_default
end).
{
unfold classify_bool; destruct t; simpl; auto. destruct i; auto.
}
unfold bool_val. rewrite A.
unfold sem_cast, classify_cast; remember Archi.ptr64 as ptr64; destruct t; simpl; auto; destruct v; auto.
destruct (Int.eq i0 Int.zero); auto.
destruct ptr64; auto. destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i0)); auto.
destruct (Int64.eq i Int64.zero); auto.
destruct (negb ptr64); auto. destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct f; auto.
destruct f; auto.
destruct f; auto.
destruct f; auto.
destruct (Float.cmp Ceq f0 Float.zero); auto.
destruct f; auto.
destruct (Float32.cmp Ceq f0 Float32.zero); auto.
destruct f; auto.
destruct ptr64; auto.
destruct (Int.eq i Int.zero); auto.
destruct ptr64; auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Int64.eq i Int64.zero); auto.
destruct ptr64; auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Int.eq i Int.zero); auto.
destruct ptr64; auto. destruct (Int64.eq i Int64.zero); auto.
destruct ptr64; auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Int.eq i Int.zero); auto.
destruct ptr64; auto. destruct (Int64.eq i Int64.zero); auto.
destruct ptr64; auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
Qed.
(** Relation between Boolean value and Boolean negation. *)
Lemma notbool_bool_val:
forall v t m,
sem_notbool v t m =
match bool_val v t m with None => None | Some b => Some(Val.of_bool (negb b)) end.
Proof.
intros. unfold sem_notbool. destruct (bool_val v t m) as [[] | ]; reflexivity.
Qed.
(** Properties of values obtained by casting to a given type. *)
Section VAL_CASTED.
Inductive val_casted: val -> type -> Prop :=
| val_casted_int: forall sz si attr n,
cast_int_int sz si n = n ->
val_casted (Vint n) (Tint sz si attr)
| val_casted_float: forall attr n,
val_casted (Vfloat n) (Tfloat F64 attr)
| val_casted_single: forall attr n,
val_casted (Vsingle n) (Tfloat F32 attr)
| val_casted_long: forall si attr n,
val_casted (Vlong n) (Tlong si attr)
| val_casted_ptr_ptr: forall b ofs ty attr,
val_casted (Vptr b ofs) (Tpointer ty attr)
| val_casted_int_ptr: forall n ty attr,
Archi.ptr64 = false -> val_casted (Vint n) (Tpointer ty attr)
| val_casted_ptr_int: forall b ofs si attr,
Archi.ptr64 = false -> val_casted (Vptr b ofs) (Tint I32 si attr)
| val_casted_long_ptr: forall n ty attr,
Archi.ptr64 = true -> val_casted (Vlong n) (Tpointer ty attr)
| val_casted_ptr_long: forall b ofs si attr,
Archi.ptr64 = true -> val_casted (Vptr b ofs) (Tlong si attr)
| val_casted_struct: forall id attr b ofs,
val_casted (Vptr b ofs) (Tstruct id attr)
| val_casted_union: forall id attr b ofs,
val_casted (Vptr b ofs) (Tunion id attr)
| val_casted_void: forall v,
val_casted v Tvoid.
Local Hint Constructors val_casted : core.
Remark cast_int_int_idem:
forall sz sg i, cast_int_int sz sg (cast_int_int sz sg i) = cast_int_int sz sg i.
Proof.
intros. destruct sz; simpl; auto.
destruct sg; [apply Int.sign_ext_idem|apply Int.zero_ext_idem]; compute; intuition congruence.
destruct sg; [apply Int.sign_ext_idem|apply Int.zero_ext_idem]; compute; intuition congruence.
destruct (Int.eq i Int.zero); auto.
Qed.
Ltac DestructCases :=
match goal with
| [H: match match ?x with _ => _ end with _ => _ end = Some _ |- _ ] => destruct x eqn:?; DestructCases
| [H: match ?x with _ => _ end = Some _ |- _ ] => destruct x eqn:?; DestructCases
| [H: Some _ = Some _ |- _ ] => inv H; DestructCases
| [H: None = Some _ |- _ ] => discriminate H
| [H: @eq intsize _ _ |- _ ] => discriminate H || (clear H; DestructCases)
| [ |- val_casted (Vint (if ?x then Int.zero else Int.one)) _ ] =>
try (constructor; destruct x; reflexivity)
| [ |- val_casted (Vint _) (Tint ?sz ?sg _) ] =>
try (constructor; apply (cast_int_int_idem sz sg))
| _ => idtac
end.
Lemma cast_val_is_casted:
forall v ty ty' v' m, sem_cast v ty ty' m = Some v' -> val_casted v' ty'.
Proof.
unfold sem_cast; intros.
destruct ty, ty'; simpl in H; DestructCases; constructor; auto.
Qed.
End VAL_CASTED.
(** As a consequence, casting twice is equivalent to casting once. *)
Lemma cast_val_casted:
forall v ty m, val_casted v ty -> sem_cast v ty ty m = Some v.
Proof.
intros. unfold sem_cast; inversion H; clear H; subst v ty; simpl.
- destruct Archi.ptr64; [ | destruct (intsize_eq sz I32)].
+ destruct sz; f_equal; f_equal; assumption.
+ subst sz; auto.
+ destruct sz; f_equal; f_equal; assumption.
- auto.
- auto.
- destruct Archi.ptr64; auto.
- auto.
- rewrite H0; auto.
- rewrite H0; auto.
- rewrite H0; auto.
- rewrite H0; auto.
- rewrite dec_eq_true; auto.
- rewrite dec_eq_true; auto.
- auto.
Qed.
Lemma cast_idempotent:
forall v ty ty' v' m, sem_cast v ty ty' m = Some v' -> sem_cast v' ty' ty' m = Some v'.
Proof.
intros. apply cast_val_casted. eapply cast_val_is_casted; eauto.
Qed.
(** Moreover, casted values belong to the machine type corresponding to the
C type. *)
Lemma val_casted_has_type:
forall v ty, val_casted v ty -> ty <> Tvoid -> Val.has_type v (typ_of_type ty).
Proof.
intros. inv H; simpl typ_of_type.
- exact I.
- exact I.
- exact I.
- exact I.
- apply Val.Vptr_has_type.
- red; unfold Tptr; rewrite H1; auto.
- red; unfold Tptr; rewrite H1; auto.
- red; unfold Tptr; rewrite H1; auto.
- red; unfold Tptr; rewrite H1; auto.
- apply Val.Vptr_has_type.
- apply Val.Vptr_has_type.
- congruence.
Qed.
(** Relation with the arithmetic conversions of ISO C99, section 6.3.1 *)
Module ArithConv.
(** This is the ISO C algebra of arithmetic types, without qualifiers.
[S] stands for "signed" and [U] for "unsigned". *)
Inductive int_type : Type :=
| _Bool
| Char | SChar | UChar
| Short | UShort
| Int | UInt
| Long | ULong
| Longlong | ULonglong.
Inductive arith_type : Type :=
| I (it: int_type)
| Float
| Double
| Longdouble.
Definition eq_int_type: forall (x y: int_type), {x=y} + {x<>y}.
Proof. decide equality. Defined.
Definition is_unsigned (t: int_type) : bool :=
match t with
| _Bool => true
| Char => false (**r as in most of CompCert's target ABIs *)
| SChar => false
| UChar => true
| Short => false
| UShort => true
| Int => false
| UInt => true
| Long => false
| ULong => true
| Longlong => false
| ULonglong => true
end.
Definition unsigned_type (t: int_type) : int_type :=
match t with
| Char => UChar
| SChar => UChar
| Short => UShort
| Int => UInt
| Long => ULong
| Longlong => ULonglong
| _ => t
end.
Definition int_sizeof (t: int_type) : Z :=
match t with
| _Bool | Char | SChar | UChar => 1
| Short | UShort => 2
| Int | UInt | Long | ULong => 4
| Longlong | ULonglong => 8
end.
(** 6.3.1.1 para 1: integer conversion rank *)
Definition rank (t: int_type) : Z :=
match t with
| _Bool => 1
| Char | SChar | UChar => 2
| Short | UShort => 3
| Int | UInt => 4
| Long | ULong => 5
| Longlong | ULonglong => 6
end.
(** 6.3.1.1 para 2: integer promotions, a.k.a. usual unary conversions *)
Definition integer_promotion (t: int_type) : int_type :=
if zlt (rank t) (rank Int) then Int else t.
(** 6.3.1.8: Usual arithmetic conversions, a.k.a. binary conversions.
This function returns the type to which the two operands must be
converted. *)
Definition usual_arithmetic_conversion (t1 t2: arith_type) : arith_type :=
match t1, t2 with
(* First, if the corresponding real type of either operand is long
double, the other operand is converted, without change of type domain,
to a type whose corresponding real type is long double. *)
| Longdouble, _ | _, Longdouble => Longdouble
(* Otherwise, if the corresponding real type of either operand is
double, the other operand is converted, without change of type domain,
to a type whose corresponding real type is double. *)
| Double, _ | _, Double => Double
(* Otherwise, if the corresponding real type of either operand is
float, the other operand is converted, without change of type domain,
to a type whose corresponding real type is float. *)
| Float, _ | _, Float => Float
(* Otherwise, the integer promotions are performed on both operands. *)
| I i1, I i2 =>
let j1 := integer_promotion i1 in
let j2 := integer_promotion i2 in
(* Then the following rules are applied to the promoted operands:
If both operands have the same type, then no further conversion
is needed. *)
if eq_int_type j1 j2 then I j1 else
match is_unsigned j1, is_unsigned j2 with
(* Otherwise, if both operands have signed integer types or both
have unsigned integer types, the operand with the type of lesser
integer conversion rank is converted to the type of the operand with
greater rank. *)
| true, true | false, false =>
if zlt (rank j1) (rank j2) then I j2 else I j1
| true, false =>
(* Otherwise, if the operand that has unsigned integer type has
rank greater or equal to the rank of the type of the other operand,
then the operand with signed integer type is converted to the type of
the operand with unsigned integer type. *)
if zle (rank j2) (rank j1) then I j1 else
(* Otherwise, if the type of the operand with signed integer type
can represent all of the values of the type of the operand with
unsigned integer type, then the operand with unsigned integer type is
converted to the type of the operand with signed integer type. *)
if zlt (int_sizeof j1) (int_sizeof j2) then I j2 else
(* Otherwise, both operands are converted to the unsigned integer type
corresponding to the type of the operand with signed integer type. *)
I (unsigned_type j2)
| false, true =>
(* Same logic as above, swapping the roles of j1 and j2 *)
if zle (rank j1) (rank j2) then I j2 else
if zlt (int_sizeof j2) (int_sizeof j1) then I j1 else
I (unsigned_type j1)
end
end.
(** Mapping ISO arithmetic types to CompCert types *)
Definition proj_type (t: arith_type) : type :=
match t with
| I _Bool => Tint IBool Unsigned noattr
| I Char => Tint I8 Unsigned noattr
| I SChar => Tint I8 Signed noattr
| I UChar => Tint I8 Unsigned noattr
| I Short => Tint I16 Signed noattr
| I UShort => Tint I16 Unsigned noattr
| I Int => Tint I32 Signed noattr
| I UInt => Tint I32 Unsigned noattr
| I Long => Tint I32 Signed noattr
| I ULong => Tint I32 Unsigned noattr
| I Longlong => Tlong Signed noattr
| I ULonglong => Tlong Unsigned noattr
| Float => Tfloat F32 noattr
| Double => Tfloat F64 noattr
| Longdouble => Tfloat F64 noattr
end.
(** Relation between [typeconv] and integer promotion. *)
Lemma typeconv_integer_promotion:
forall i, typeconv (proj_type (I i)) = proj_type (I (integer_promotion i)).
Proof.
destruct i; reflexivity.
Qed.
(** Relation between [classify_binarith] and arithmetic conversion. *)
Lemma classify_binarith_arithmetic_conversion:
forall t1 t2,
binarith_type (classify_binarith (proj_type t1) (proj_type t2)) =
proj_type (usual_arithmetic_conversion t1 t2).
Proof.
destruct t1; destruct t2; try reflexivity.
- destruct it; destruct it0; reflexivity.
- destruct it; reflexivity.
- destruct it; reflexivity.
- destruct it; reflexivity.
- destruct it; reflexivity.
- destruct it; reflexivity.
- destruct it; reflexivity.
Qed.
End ArithConv.
*)
|
SUBROUTINE rkdumb(vstart,nvar,x1,x2,nstep,derivs)
INTEGER nstep,nvar,NMAX,NSTPMX
PARAMETER (NMAX=50,NSTPMX=200)
REAL x1,x2,vstart(nvar),xx(NSTPMX),y(NMAX,NSTPMX)
EXTERNAL derivs
COMMON /path/ xx,y
CU USES rk4
INTEGER i,k
REAL h,x,dv(NMAX),v(NMAX)
do 11 i=1,nvar
v(i)=vstart(i)
y(i,1)=v(i)
11 continue
xx(1)=x1
x=x1
h=(x2-x1)/nstep
do 13 k=1,nstep
call derivs(x,v,dv)
call rk4(v,dv,nvar,x,h,v,derivs)
if(x+h.eq.x)pause 'stepsize not significant in rkdumb'
x=x+h
xx(k+1)=x
do 12 i=1,nvar
y(i,k+1)=v(i)
12 continue
13 continue
return
END
|
[STATEMENT]
lemma isCont_has_Ub:
fixes f :: "real \<Rightarrow> 'a::linorder_topology"
shows "a \<le> b \<Longrightarrow> \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x \<Longrightarrow>
\<exists>M. (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> f x \<le> M) \<and> (\<forall>N. N < M \<longrightarrow> (\<exists>x. a \<le> x \<and> x \<le> b \<and> N < f x))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>a \<le> b; \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> \<exists>M. (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> f x \<le> M) \<and> (\<forall>N<M. \<exists>x\<ge>a. x \<le> b \<and> N < f x)
[PROOF STEP]
using isCont_eq_Ub[of a b f]
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>a \<le> b; \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> \<exists>M. (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> f x \<le> M) \<and> (\<exists>x\<ge>a. x \<le> b \<and> f x = M)
goal (1 subgoal):
1. \<lbrakk>a \<le> b; \<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x\<rbrakk> \<Longrightarrow> \<exists>M. (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> f x \<le> M) \<and> (\<forall>N<M. \<exists>x\<ge>a. x \<le> b \<and> N < f x)
[PROOF STEP]
by auto
|
module Circuits.NetList.Types
import Decidable.Equality
import Data.List.Elem
import public Circuits.Common
%default total
namespace Direction
public export
data Direction = INPUT | OUTPUT | INOUT
Uninhabited (INPUT = OUTPUT) where
uninhabited Refl impossible
Uninhabited (OUTPUT = INOUT) where
uninhabited Refl impossible
Uninhabited (INPUT = INOUT) where
uninhabited Refl impossible
export
DecEq Direction where
decEq INPUT INPUT = Yes Refl
decEq INPUT OUTPUT = No absurd
decEq INPUT INOUT = No absurd
decEq OUTPUT INPUT = No (negEqSym absurd)
decEq OUTPUT OUTPUT = Yes Refl
decEq OUTPUT INOUT = No absurd
decEq INOUT INPUT = No (negEqSym absurd)
decEq INOUT OUTPUT = No (negEqSym absurd)
decEq INOUT INOUT = Yes Refl
namespace Proj
public export
data Project : Direction -> Type where
WRITE : Project OUTPUT
READ : Project INPUT
namespace Cast
public export
data Cast : (from,to : Direction) -> Type where
BI : Cast INOUT INPUT
BO : Cast INOUT OUTPUT
Uninhabited (Cast OUTPUT flow) where
uninhabited BI impossible
uninhabited BO impossible
Uninhabited (Cast INPUT flow) where
uninhabited BI impossible
uninhabited BO impossible
Uninhabited (Cast INOUT INOUT) where
uninhabited BI impossible
uninhabited BO impossible
export
cast : (f,t : Direction) -> Dec (Cast f t)
cast INPUT _ = No absurd
cast OUTPUT _ = No absurd
cast INOUT INPUT = Yes BI
cast INOUT OUTPUT = Yes BO
cast INOUT INOUT = No absurd
namespace Index
public export
data Up : (flow : Direction) -> Type where
UO : Up OUTPUT
UB : Up INOUT
public export
data Down : (flow : Direction) -> Type where
DI : Down INPUT
DB : Down INOUT
public export
data Index : (flow : Direction) -> Type where
UP : Up f -> Index f
DOWN : Down f -> Index f
export
dirFromCast : Cast INOUT flow -> Index INOUT
dirFromCast BI = DOWN DB
dirFromCast BO = UP UB
namespace Gate
namespace Binary
public export
data Kind = AND | IOR | XOR
| ANDN | IORN | XORN
namespace Unary
public export
data Kind = NOT
export
Show Unary.Kind where
show NOT = "not"
namespace Types
public export
data Ty : Type where
TyUnit : Ty
TyPort : (Direction, DType) -> Ty
TyChan : DType -> Ty
TyGate : Ty
Uninhabited (TyUnit = TyPort x) where
uninhabited Refl impossible
Uninhabited (TyUnit = TyChan x) where
uninhabited Refl impossible
Uninhabited (TyUnit = TyGate) where
uninhabited Refl impossible
Uninhabited (TyPort x = TyGate) where
uninhabited Refl impossible
Uninhabited (TyPort x = TyChan y) where
uninhabited Refl impossible
Uninhabited (TyGate = TyChan y) where
uninhabited Refl impossible
export
DecEq Ty where
decEq TyUnit TyUnit = Yes Refl
decEq TyUnit (TyPort x) = No absurd
decEq TyUnit TyGate = No absurd
decEq TyUnit (TyChan x) = No absurd
decEq (TyPort x) TyUnit = No (negEqSym absurd)
decEq (TyPort x) (TyPort y) with (decEq x y)
decEq (TyPort x) (TyPort x) | (Yes Refl)
= Yes Refl
decEq (TyPort x) (TyPort y) | (No contra)
= No (\Refl => contra Refl)
decEq (TyPort x) TyGate = No (absurd)
decEq (TyPort x) (TyChan c) = No (absurd)
decEq TyGate TyUnit = No (negEqSym absurd)
decEq TyGate (TyPort x) = No (negEqSym absurd)
decEq TyGate TyGate = Yes Refl
decEq TyGate (TyChan x) = No absurd
decEq (TyChan ty) TyUnit = No (negEqSym absurd)
decEq (TyChan ty) (TyPort x) = No (negEqSym absurd)
decEq (TyChan ty) TyGate = No (negEqSym absurd)
decEq (TyChan x) (TyChan y) with (decEq x y)
decEq (TyChan x) (TyChan x) | (Yes Refl) = Yes Refl
decEq (TyChan x) (TyChan y) | (No contra) = No (\Refl => contra Refl)
-- [ EOF ]
|
State Before: α : Type u_1
inst✝³ : Group α
s✝ t : Subgroup α
inst✝² : Fintype α
s : Subgroup α
inst✝¹ : Fintype { x // x ∈ s }
inst✝ : DecidablePred fun a => a ∈ s
⊢ Fintype.card α = Fintype.card (α ⧸ s) * Fintype.card { x // x ∈ s } State After: α : Type u_1
inst✝³ : Group α
s✝ t : Subgroup α
inst✝² : Fintype α
s : Subgroup α
inst✝¹ : Fintype { x // x ∈ s }
inst✝ : DecidablePred fun a => a ∈ s
⊢ Fintype.card α = Fintype.card ((α ⧸ s) × { x // x ∈ s }) Tactic: rw [← Fintype.card_prod] State Before: α : Type u_1
inst✝³ : Group α
s✝ t : Subgroup α
inst✝² : Fintype α
s : Subgroup α
inst✝¹ : Fintype { x // x ∈ s }
inst✝ : DecidablePred fun a => a ∈ s
⊢ Fintype.card α = Fintype.card ((α ⧸ s) × { x // x ∈ s }) State After: no goals Tactic: exact Fintype.card_congr Subgroup.groupEquivQuotientProdSubgroup
|
# -*- coding: utf-8 -*-
"""
Plantilla 2 de la práctica 3
Referencias:
https://scikit-learn.org/stable/auto_examples/cluster/plot_dbscan.html
https://towardsdatascience.com/dbscan-d690cbae4c5d
https://www.aaai.org/Papers/KDD/1996/KDD96-037.pdf
"""
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets import make_blobs
import matplotlib.pyplot as plt
# #############################################################################
# Aquí tenemos definido el sistema X de 1000 elementos de dos estados
# construido a partir de una muestra aleatoria entorno a unos centros:
centers = [[1, 1], [-1, -1], [1, -1]]
X, labels_true = make_blobs(n_samples=1000, centers=centers, cluster_std=0.4,
random_state=0)
#Si quisieramos estandarizar los valores del sistema, haríamos:
#from sklearn.preprocessing import StandardScaler
#X = StandardScaler().fit_transform(X)
plt.plot(X[:,0],X[:,1],'ro', markersize=1)
plt.show()
# #############################################################################
# Los clasificamos mediante el algoritmo DBSCAN
epsilon = 0.3
db = DBSCAN(eps=epsilon, min_samples=10, metric='manhattan').fit(X)
core_samples_mask = np.zeros_like(db.labels_, dtype=bool)
core_samples_mask[db.core_sample_indices_] = True
labels = db.labels_
# Number of clusters in labels, ignoring noise if present.
n_clusters_ = len(set(labels)) - (1 if -1 in labels else 0)
n_noise_ = list(labels).count(-1)
print('Estimated number of clusters: %d' % n_clusters_)
print('Estimated number of noise points: %d' % n_noise_)
print("Adjusted Rand Index: %0.3f"
% metrics.adjusted_rand_score(labels_true, labels))
print("Silhouette Coefficient: %0.3f"
% metrics.silhouette_score(X, labels))
# #############################################################################
# Representamos el resultado con un plot
unique_labels = set(labels)
colors = [plt.cm.Spectral(each)
for each in np.linspace(0, 1, len(unique_labels))]
plt.figure(figsize=(8,4))
for k, col in zip(unique_labels, colors):
if k == -1:
# Black used for noise.
col = [0, 0, 0, 1]
class_member_mask = (labels == k)
xy = X[class_member_mask & core_samples_mask]
plt.plot(xy[:, 0], xy[:, 1], 'o', markerfacecolor=tuple(col),
markeredgecolor='k', markersize=5)
xy = X[class_member_mask & ~core_samples_mask]
plt.plot(xy[:, 0], xy[:, 1], 'o', markerfacecolor=tuple(col),
markeredgecolor='k', markersize=3)
plt.title('Estimated number of DBSCAN clusters: %d' % n_clusters_)
plt.show()
|
import category_theory.preadditive
import category_theory.abelian.projective
import category_theory.abelian.diagram_lemmas.four
import data.matrix.notation
import for_mathlib.abelian_category
import for_mathlib.fin_functor
import for_mathlib.split_exact
noncomputable theory
open category_theory
open category_theory.limits
open category_theory.preadditive
universes v u
namespace category_theory
variables (𝒞 : Type u) [category.{v} 𝒞]
@[ext]
structure short_exact_sequence [has_images 𝒞] [has_zero_morphisms 𝒞] [has_kernels 𝒞] :=
(fst snd trd : 𝒞)
(f : fst ⟶ snd)
(g : snd ⟶ trd)
[mono' : mono f]
[epi' : epi g]
(exact' : exact f g)
namespace short_exact_sequence
attribute [instance] mono' epi'
variables {𝒞} [has_images 𝒞] [has_zero_morphisms 𝒞] [has_kernels 𝒞]
@[simp, reassoc] lemma f_comp_g (A : short_exact_sequence 𝒞) : A.f ≫ A.g = 0 := A.exact'.w
@[ext]
structure hom (A B : short_exact_sequence 𝒞) :=
(fst : A.1 ⟶ B.1)
(snd : A.2 ⟶ B.2)
(trd : A.3 ⟶ B.3)
(sq1' : fst ≫ B.f = A.f ≫ snd . obviously)
(sq2' : snd ≫ B.g = A.g ≫ trd . obviously)
namespace hom
restate_axiom sq1' sq1
restate_axiom sq2' sq2
attribute [reassoc] sq1 sq2
end hom
instance : quiver (short_exact_sequence 𝒞) := ⟨hom⟩
def id (A : short_exact_sequence 𝒞) : A ⟶ A :=
{ fst := 𝟙 _,
snd := 𝟙 _,
trd := 𝟙 _,
sq1' := by simp only [category.id_comp, category.comp_id],
sq2' := by simp only [category.id_comp, category.comp_id], }
def comp {A B C : short_exact_sequence 𝒞} (f : A ⟶ B) (g : B ⟶ C) : A ⟶ C :=
{ fst := f.1 ≫ g.1,
snd := f.2 ≫ g.2,
trd := f.3 ≫ g.3,
sq1' := by rw [category.assoc, hom.sq1, hom.sq1_assoc],
sq2' := by rw [category.assoc, hom.sq2, hom.sq2_assoc], }
instance : category (short_exact_sequence 𝒞) :=
{ id := id,
comp := λ A B C f g, comp f g,
id_comp' := by { intros, ext; dsimp; apply category.id_comp, },
comp_id' := by { intros, ext; dsimp; apply category.comp_id, },
assoc' := by { intros, ext; dsimp; apply category.assoc, },
.. (infer_instance : quiver (short_exact_sequence 𝒞)) }
@[simp] lemma id_fst (A : short_exact_sequence 𝒞) : hom.fst (𝟙 A) = 𝟙 A.1 := rfl
@[simp] lemma id_snd (A : short_exact_sequence 𝒞) : hom.snd (𝟙 A) = 𝟙 A.2 := rfl
@[simp] lemma id_trd (A : short_exact_sequence 𝒞) : hom.trd (𝟙 A) = 𝟙 A.3 := rfl
variables {A B C : short_exact_sequence 𝒞} (f : A ⟶ B) (g : B ⟶ C)
@[simp, reassoc] lemma comp_fst : (f ≫ g).1 = f.1 ≫ g.1 := rfl
@[simp, reassoc] lemma comp_snd : (f ≫ g).2 = f.2 ≫ g.2 := rfl
@[simp, reassoc] lemma comp_trd : (f ≫ g).3 = f.3 ≫ g.3 := rfl
variables (𝒞)
@[simps] def Fst : short_exact_sequence 𝒞 ⥤ 𝒞 :=
{ obj := fst, map := λ A B f, f.1 }
@[simps] def Snd : short_exact_sequence 𝒞 ⥤ 𝒞 :=
{ obj := snd, map := λ A B f, f.2 }
@[simps] def Trd : short_exact_sequence 𝒞 ⥤ 𝒞 :=
{ obj := trd, map := λ A B f, f.3 }
@[simps] def f_nat : Fst 𝒞 ⟶ Snd 𝒞 :=
{ app := λ A, A.f,
naturality' := λ A B f, f.sq1 }
@[simps] def g_nat : Snd 𝒞 ⟶ Trd 𝒞 :=
{ app := λ A, A.g,
naturality' := λ A B f, f.sq2 }
instance : has_zero_morphisms (short_exact_sequence 𝒞) :=
{ has_zero := λ A B, ⟨{ fst := 0, snd := 0, trd := 0 }⟩,
comp_zero' := by { intros, ext; apply comp_zero },
zero_comp' := by { intros, ext; apply zero_comp }, }
.
@[simp] lemma hom_zero_fst : (0 : A ⟶ B).1 = 0 := rfl
@[simp] lemma hom_zero_snd : (0 : A ⟶ B).2 = 0 := rfl
@[simp] lemma hom_zero_trd : (0 : A ⟶ B).3 = 0 := rfl
variables {𝒞}
protected def functor (A : short_exact_sequence 𝒞) : fin 3 ⥤ 𝒞 :=
fin3_functor_mk ![A.1, A.2, A.3] A.f A.g
def functor_map {A B : short_exact_sequence 𝒞} (f : A ⟶ B) :
Π i, A.functor.obj i ⟶ B.functor.obj i
| ⟨0,h⟩ := f.1
| ⟨1,h⟩ := f.2
| ⟨2,h⟩ := f.3
| ⟨i+3,hi⟩ := by { exfalso, revert hi, dec_trivial }
meta def aux_tac : tactic unit :=
`[simp only [hom_of_le_refl, functor.map_id, category.id_comp, category.comp_id]]
lemma functor_map_naturality {A B : short_exact_sequence 𝒞} (f : A ⟶ B) :
∀ (i j : fin 3) (hij : i ≤ j),
functor_map f i ≫ B.functor.map hij.hom = A.functor.map hij.hom ≫ functor_map f j
| ⟨0,hi⟩ ⟨0,hj⟩ hij := by aux_tac
| ⟨1,hi⟩ ⟨1,hj⟩ hij := by aux_tac
| ⟨2,hi⟩ ⟨2,hj⟩ hij := by aux_tac
| ⟨0,hi⟩ ⟨1,hj⟩ hij := f.sq1
| ⟨1,hi⟩ ⟨2,hj⟩ hij := f.sq2
| ⟨i+3,hi⟩ _ _ := by { exfalso, revert hi, dec_trivial }
| _ ⟨j+3,hj⟩ _ := by { exfalso, revert hj, dec_trivial }
| ⟨i+1,hi⟩ ⟨0,hj⟩ H := by { exfalso, revert H, dec_trivial }
| ⟨i+2,hi⟩ ⟨1,hj⟩ H := by { exfalso, revert H, dec_trivial }
| ⟨0,hi⟩ ⟨2,hj⟩ hij :=
begin
have h01 : (0 : fin 3) ⟶ 1 := hom_of_le dec_trivial,
have h12 : (1 : fin 3) ⟶ 2 := hom_of_le dec_trivial,
calc functor_map f ⟨0, hi⟩ ≫ B.functor.map hij.hom
= functor_map f ⟨0, hi⟩ ≫ B.functor.map h01 ≫ B.functor.map h12 : _
... = (functor_map f ⟨0, hi⟩ ≫ B.functor.map h01) ≫ B.functor.map h12 : by rw category.assoc
... = (A.functor.map h01 ≫ functor_map f _) ≫ B.functor.map h12 : _
... = A.functor.map h01 ≫ functor_map f _ ≫ B.functor.map h12 : category.assoc _ _ _
... = A.functor.map h01 ≫ A.functor.map h12 ≫ functor_map f _ : _
... = A.functor.map hij.hom ≫ functor_map f ⟨2, hj⟩ : _,
{ rw [← functor.map_comp], congr, },
{ congr' 1, exact f.sq1 },
{ congr' 1, exact f.sq2 },
{ rw [← functor.map_comp_assoc], congr, },
end
@[simps] def Functor : short_exact_sequence 𝒞 ⥤ fin 3 ⥤ 𝒞 :=
{ obj := short_exact_sequence.functor,
map := λ A B f,
{ app := functor_map f,
naturality' := λ i j hij, (functor_map_naturality f i j hij.le).symm },
map_id' := λ A, by { ext i, fin_cases i; refl },
map_comp' := λ A B C f g, by { ext i, fin_cases i; refl } }
end short_exact_sequence
namespace short_exact_sequence
variables {𝒞} [abelian 𝒞]
variables {A B C : short_exact_sequence 𝒞} (f : A ⟶ B) (g : B ⟶ C)
section iso
variables {A B C} (f g)
open_locale zero_object
/-- One form of the five lemma: if a morphism of short exact sequences has isomorphisms
as first and third component, then the second component is also an isomorphism. -/
lemma snd_is_iso (h1 : is_iso f.1) (h3 : is_iso f.3) : is_iso f.2 :=
@abelian.is_iso_of_is_iso_of_is_iso_of_is_iso_of_is_iso 𝒞 _ _
0 A.1 A.2 A.3
0 B.1 B.2 B.3
0 A.f A.g
0 B.f B.g
0 f.1 f.2 f.3 (by rw [zero_comp, zero_comp]) f.sq1 f.sq2
0 0
0 0 0 (by rw [comp_zero, comp_zero])
(exact_zero_left_of_mono _)
A.exact'
((epi_iff_exact_zero_right _).mp infer_instance)
(exact_zero_left_of_mono _)
B.exact'
((epi_iff_exact_zero_right _).mp infer_instance) _ _ _ _
/-- One form of the five lemma: if a morphism `f` of short exact sequences has isomorphisms
as first and third component, then `f` itself is an isomorphism. -/
lemma is_iso_of_fst_of_trd (h1 : is_iso f.1) (h3 : is_iso f.3) : is_iso f :=
{ out :=
begin
haveI : is_iso f.2 := snd_is_iso f h1 h3,
refine ⟨⟨inv f.1, inv f.2, inv f.3, _, _⟩, _, _⟩,
{ dsimp, simp only [is_iso.inv_comp_eq, f.sq1_assoc, category.comp_id, is_iso.hom_inv_id], },
{ dsimp, simp only [is_iso.inv_comp_eq, f.sq2_assoc, category.comp_id, is_iso.hom_inv_id], },
{ ext; dsimp; simp only [is_iso.hom_inv_id], },
{ ext; dsimp; simp only [is_iso.inv_hom_id], },
end }
@[simps] def iso_of_components (f₁ : A.1 ≅ B.1) (f₂ : A.2 ≅ B.2) (f₃ : A.3 ≅ B.3)
(sq1 : f₁.hom ≫ B.f = A.f ≫ f₂.hom) (sq2 : f₂.hom ≫ B.g = A.g ≫ f₃.hom) :
A ≅ B :=
{ hom := ⟨f₁.hom, f₂.hom, f₃.hom, sq1, sq2⟩,
inv :=
begin
refine ⟨f₁.inv, f₂.inv, f₃.inv, _, _⟩; dsimp,
rw [iso.inv_comp_eq, ← category.assoc, iso.eq_comp_inv, sq1],
rw [iso.inv_comp_eq, ← category.assoc, iso.eq_comp_inv, sq2],
end,
hom_inv_id' := by { ext; apply iso.hom_inv_id, },
inv_hom_id' := by { ext; apply iso.inv_hom_id, } }
@[simps] def iso_of_components' (f₁ : A.1 ≅ B.1) (f₂ : A.2 ⟶ B.2) (f₃ : A.3 ≅ B.3)
(sq1 : f₁.hom ≫ B.f = A.f ≫ f₂) (sq2 : f₂ ≫ B.g = A.g ≫ f₃.hom) :
A ≅ B :=
let F : A ⟶ B := ⟨f₁.hom, f₂, f₃.hom, sq1, sq2⟩ in
{ hom := F,
inv :=
begin
haveI : is_iso F.2 := snd_is_iso _ infer_instance infer_instance,
refine ⟨f₁.inv, inv F.2, f₃.inv, _, _⟩; dsimp,
rw [iso.inv_comp_eq, ← category.assoc, is_iso.eq_comp_inv, sq1],
rw [is_iso.inv_comp_eq, ← category.assoc, iso.eq_comp_inv, sq2],
end,
hom_inv_id' := by { ext; try { apply iso.hom_inv_id, }, apply is_iso.hom_inv_id },
inv_hom_id' := by { ext; try { apply iso.inv_hom_id, }, apply is_iso.inv_hom_id } }
end iso
section split
/-- A short exact sequence `0 ⟶ A₁ -f⟶ A₂ -g⟶ A₃ ⟶ 0` is *left split*
if there exists a morphism `φ : A₂ ⟶ A₁` such that `f ≫ φ = 𝟙 A₁`. -/
def left_split (A : short_exact_sequence 𝒞) : Prop :=
∃ φ : A.2 ⟶ A.1, A.f ≫ φ = 𝟙 A.1
/-- A short exact sequence `0 ⟶ A₁ -f⟶ A₂ -g⟶ A₃ ⟶ 0` is *right split*
if there exists a morphism `φ : A₂ ⟶ A₁` such that `f ≫ φ = 𝟙 A₁`. -/
def right_split (A : short_exact_sequence 𝒞) : Prop :=
∃ χ : A.3 ⟶ A.2, χ ≫ A.g = 𝟙 A.3
variables {𝒜 : Type*} [category 𝒜] [abelian 𝒜]
lemma exact_of_split {A B C : 𝒜} (f : A ⟶ B) (g : B ⟶ C) (χ : C ⟶ B) (φ : B ⟶ A)
(hfg : f ≫ g = 0) (H : φ ≫ f + g ≫ χ = 𝟙 B) : exact f g :=
{ w := hfg,
epi :=
begin
let ψ : (kernel_subobject g : 𝒜) ⟶ image_subobject f :=
subobject.arrow _ ≫ φ ≫ factor_thru_image_subobject f,
suffices : ψ ≫ image_to_kernel f g hfg = 𝟙 _,
{ convert epi_of_epi ψ _, rw this, apply_instance },
rw ← cancel_mono (subobject.arrow _), swap, { apply_instance },
simp only [image_to_kernel_arrow, image_subobject_arrow_comp, category.id_comp, category.assoc],
calc (kernel_subobject g).arrow ≫ φ ≫ f
= (kernel_subobject g).arrow ≫ 𝟙 B : _
... = (kernel_subobject g).arrow : category.comp_id _,
rw [← H, preadditive.comp_add],
simp only [add_zero, zero_comp, kernel_subobject_arrow_comp_assoc],
end }
-- move this
lemma exact_inl_snd (A B : 𝒜) : exact (biprod.inl : A ⟶ A ⊞ B) biprod.snd :=
exact_of_split _ _ biprod.inr biprod.fst biprod.inl_snd biprod.total
def mk_of_split {A B C : 𝒜} (f : A ⟶ B) (g : B ⟶ C) (φ : B ⟶ A) (χ : C ⟶ B)
(hfg : f ≫ g = 0) (hφ : f ≫ φ = 𝟙 A) (hχ : χ ≫ g = 𝟙 C) (H : φ ≫ f + g ≫ χ = 𝟙 B) :
short_exact_sequence 𝒜 :=
{ fst := A,
snd := B,
trd := C,
f := f,
g := g,
mono' := by { haveI : mono (f ≫ φ), { rw hφ, apply_instance }, exact mono_of_mono f φ, },
epi' := by { haveI : epi (χ ≫ g), { rw hχ, apply_instance }, exact epi_of_epi χ g, },
exact' := exact_of_split f g χ φ hfg H }
def mk_of_split' {A B C : 𝒜} (f : A ⟶ B) (g : B ⟶ C)
(H : ∃ (φ : B ⟶ A) (χ : C ⟶ B), f ≫ g = 0 ∧ f ≫ φ = 𝟙 A ∧ χ ≫ g = 𝟙 C ∧ φ ≫ f + g ≫ χ = 𝟙 B) :
short_exact_sequence 𝒜 :=
mk_of_split f g H.some H.some_spec.some H.some_spec.some_spec.1 H.some_spec.some_spec.2.1
H.some_spec.some_spec.2.2.1 H.some_spec.some_spec.2.2.2
@[simp] def mk_split (A B : 𝒜) : short_exact_sequence 𝒜 :=
{ fst := A,
snd := A ⊞ B,
trd := B,
f := biprod.inl,
g := biprod.snd,
exact' := exact_inl_snd _ _ }
/-- A *splitting* of a short exact sequence `0 ⟶ A₁ -f⟶ A₂ -g⟶ A₃ ⟶ 0` is
an isomorphism to the short exact sequence `0 ⟶ A₁ ⟶ A₁ ⊕ A₃ ⟶ A₃ ⟶ 0`,
where the left and right components of the isomorphism are identity maps. -/
structure splitting (A : short_exact_sequence 𝒜) extends A ≅ (mk_split A.1 A.3) :=
(fst_eq_id : hom.1 = 𝟙 A.1)
(trd_eq_id : hom.3 = 𝟙 A.3)
/-- A short exact sequence `0 ⟶ A₁ -f⟶ A₂ -g⟶ A₃ ⟶ 0` is *split* if there exist
`φ : A₂ ⟶ A₁` and `χ : A₃ ⟶ A₂` such that:
* `f ≫ φ = 𝟙 A₁`
* `χ ≫ g = 𝟙 A₃`
* `χ ≫ φ = 0`
* `φ ≫ f + g ≫ χ = 𝟙 A₂`
-/
def split (A : short_exact_sequence 𝒜) : Prop :=
∃ (φ : A.2 ⟶ A.1) (χ : A.3 ⟶ A.2),
A.f ≫ φ = 𝟙 A.1 ∧ χ ≫ A.g = 𝟙 A.3 ∧ χ ≫ φ = 0 ∧ φ ≫ A.f + A.g ≫ χ = 𝟙 A.2
lemma mk_split_split (A B : 𝒜) : (mk_split A B).split :=
⟨biprod.fst, biprod.inr, biprod.inl_fst, biprod.inr_snd, biprod.inr_fst, biprod.total⟩
lemma splitting.split {A : short_exact_sequence 𝒜} (i : splitting A) : A.split :=
begin
refine ⟨i.hom.2 ≫ biprod.fst ≫ i.inv.1, i.hom.3 ≫ biprod.inr ≫ i.inv.2, _⟩,
simp only [category.assoc, ← hom.sq1_assoc, hom.sq2], dsimp,
simp only [biprod.inl_fst_assoc, biprod.inr_snd_assoc, category.comp_id, category.assoc,
← comp_fst, ← comp_snd_assoc, ← comp_trd, i.to_iso.hom_inv_id, i.to_iso.inv_hom_id],
dsimp,
simp only [true_and, biprod.inr_fst_assoc, zero_comp, eq_self_iff_true, comp_zero,
category.id_comp],
simp only [hom.sq1, ← hom.sq2_assoc, ← comp_add],
simp only [← category.assoc, ← add_comp, biprod.total,
category.comp_id, ← comp_snd, i.to_iso.hom_inv_id], refl,
end
def left_split.splitting {A : short_exact_sequence 𝒜} (h : A.left_split) : A.splitting :=
{ to_iso := iso_of_components' (iso.refl _) (biprod.lift h.some A.g) (iso.refl _)
(by { dsimp, simp only [category.id_comp], ext,
{ simpa only [biprod.inl_fst, biprod.lift_fst, category.assoc] using h.some_spec.symm, },
{ simp only [exact.w, f_comp_g, biprod.lift_snd, category.assoc, exact_inl_snd] } })
(by { dsimp, simp only [category.comp_id, biprod.lift_snd], }),
fst_eq_id := rfl,
trd_eq_id := rfl }
def right_split.splitting {A : short_exact_sequence 𝒜} (h : A.right_split) : A.splitting :=
{ to_iso := iso.symm $ iso_of_components' (iso.refl _) (biprod.desc A.f h.some) (iso.refl _)
(by { dsimp, simp only [biprod.inl_desc, category.id_comp], })
(by { dsimp, simp only [category.comp_id], ext,
{ simp only [exact.w, f_comp_g, biprod.inl_desc_assoc, exact_inl_snd] },
{ simpa only [biprod.inr_snd, biprod.inr_desc_assoc] using h.some_spec, } }),
fst_eq_id := rfl,
trd_eq_id := rfl }
lemma tfae_split (A : short_exact_sequence 𝒜) :
tfae [A.left_split, A.right_split, A.split, nonempty A.splitting] :=
begin
tfae_have : 3 → 1, { rintro ⟨φ, χ, hφ, hχ, hχφ, H⟩, exact ⟨φ, hφ⟩ },
tfae_have : 3 → 2, { rintro ⟨φ, χ, hφ, hχ, hχφ, H⟩, exact ⟨χ, hχ⟩ },
tfae_have : 4 → 3, { rintro ⟨i⟩, exact i.split, },
tfae_have : 1 → 4, { intro h, exact ⟨h.splitting⟩ },
tfae_have : 2 → 4, { intro h, exact ⟨h.splitting⟩ },
tfae_finish
end
end split
end short_exact_sequence
namespace short_exact_sequence
open category_theory.preadditive
variables {𝒞} [preadditive 𝒞] [has_images 𝒞] [has_kernels 𝒞]
variables (A B : short_exact_sequence 𝒞)
local notation `π₁` := congr_arg _root_.prod.fst
local notation `π₂` := congr_arg _root_.prod.snd
protected def hom_inj (f : A ⟶ B) : (A.1 ⟶ B.1) × (A.2 ⟶ B.2) × (A.3 ⟶ B.3) := ⟨f.1, f.2, f.3⟩
protected lemma hom_inj_injective : function.injective (short_exact_sequence.hom_inj A B) :=
λ f g h, let aux := π₂ h in
by { ext; [have := π₁ h, have := π₁ aux, have := π₂ aux]; exact this, }
instance : has_add (A ⟶ B) :=
{ add := λ f g,
{ fst := f.1 + g.1,
snd := f.2 + g.2,
trd := f.3 + g.3,
sq1' := by { rw [add_comp, comp_add, f.sq1, g.sq1], },
sq2' := by { rw [add_comp, comp_add, f.sq2, g.sq2], } } }
instance : has_neg (A ⟶ B) :=
{ neg := λ f,
{ fst := -f.1,
snd := -f.2,
trd := -f.3,
sq1' := by { rw [neg_comp, comp_neg, f.sq1], },
sq2' := by { rw [neg_comp, comp_neg, f.sq2], } } }
instance : has_sub (A ⟶ B) :=
{ sub := λ f g,
{ fst := f.1 - g.1,
snd := f.2 - g.2,
trd := f.3 - g.3,
sq1' := by { rw [sub_comp, comp_sub, f.sq1, g.sq1], },
sq2' := by { rw [sub_comp, comp_sub, f.sq2, g.sq2], } } }
instance has_nsmul : has_smul ℕ (A ⟶ B) :=
{ smul := λ n f,
{ fst := n • f.1,
snd := n • f.2,
trd := n • f.3,
sq1' := by rw [nsmul_comp, comp_nsmul, f.sq1],
sq2' := by rw [nsmul_comp, comp_nsmul, f.sq2] } }
instance has_zsmul : has_smul ℤ (A ⟶ B) :=
{ smul := λ n f,
{ fst := n • f.1,
snd := n • f.2,
trd := n • f.3,
sq1' := by rw [zsmul_comp, comp_zsmul, f.sq1],
sq2' := by rw [zsmul_comp, comp_zsmul, f.sq2] } }
variables (𝒞)
instance : preadditive (short_exact_sequence 𝒞) :=
{ hom_group := λ A B, (short_exact_sequence.hom_inj_injective A B).add_comm_group _
rfl (λ _ _, rfl) (λ _, rfl) (λ _ _, rfl) (λ _ _, rfl) (λ _ _, rfl),
add_comp' := by { intros, ext; apply add_comp },
comp_add' := by { intros, ext; apply comp_add }, }
.
instance Fst_additive : (Fst 𝒞).additive := {}
instance Snd_additive : (Snd 𝒞).additive := {}
instance Trd_additive : (Trd 𝒞).additive := {}
end short_exact_sequence
end category_theory
|
import cirq
import numpy as np
from cirq import protocols
def R0(theta):
"""Rotation matrix of theta on the single qubit we will eventually measure.
Args:
theta: Angle of rotation
Returns: a Y rotation matrix
"""
return cirq.Ry(theta)
"""SHIFTU and SHIFTD are for the proper application of Rl. They shift the
overall state's wave function """
class SHIFTU(cirq.Gate):
"""Gate acting on n qubits that shifts the basis of the all the
wavefunction's states up by one using a (2^n x 2^n) shifted identity matrix.
For a single qubit, this is an X gate. For two-qubit gate (4x4 unitary),
the unitary will be:
[[0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0]]
i.e. SHIFTU(a|00> + b|01> + c|10> + d|11>) = b|00> + c|01> + d|10> + a|11>)
Args:
num_qubits: the number of qubits on which the gate is to be applied
Returns: a gate with corresponding unitary as described above
"""
def __init__(self, num_qubits):
super(SHIFTU, self)
self._num_qubits = num_qubits
def num_qubits(self) -> int:
return self._num_qubits
def _unitary_(self):
unitary = np.eye(2**self._num_qubits, k=1)
unitary[-1][0] = 1
return unitary
def _circuit_diagram_info_(self, args: protocols.CircuitDiagramInfoArgs
) -> protocols.CircuitDiagramInfo:
return protocols.CircuitDiagramInfo(wire_symbols=(_shift_to_diagram_symbol(args, "ShiftU")), connected=True)
class SHIFTD(cirq.Gate):
"""Gate acting on n qubits that shifts the basis of the all the wave
function's states down by one using a (2^n x 2^n) shifted identity matrix.
For a single qubit, this is an X gate. For two-qubit gate (4x4 unitary),
the unitary will be:
[[0, 0, 0, 1], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]]
i.e. SHIFTD(a|00> + b|01> + c|10> + d|11>) = d|00> + a|01> + b|10> + c|11>)
SHIFTD = SHIFTU^-1
Args:
num_qubits: the number of qubits on which the gate is to be applied
Returns: a gate with corresponding unitary as described above
"""
def __init__(self, num_qubits):
super(SHIFTD, self)
self._num_qubits = num_qubits
def num_qubits(self) -> int:
return self._num_qubits
def _unitary_(self):
unitary = np.eye(2**self._num_qubits, k=-1)
unitary[0][-1] = 1
return unitary
def _circuit_diagram_info_(self, args: protocols.CircuitDiagramInfoArgs
) -> protocols.CircuitDiagramInfo:
return protocols.CircuitDiagramInfo(wire_symbols=(
_shift_to_diagram_symbol(args, "ShiftD")), connected=True)
def _shift_to_diagram_symbol(args: protocols.CircuitDiagramInfoArgs,
shift: str) -> str:
"""This takes the shift gates and makes them display more nicely on the
circuit.
Specifically this is for display purposes of SHIFTU, SHIFTD in the circuit.
Based on cirq.ops.matrix_gates from cirq docs.
Args:
args: arguments from the circuit, namely (known_qubit_count) for the
number of qubits to act on and (use_unicode_characters) to make
sure it is fine to use unicode
shift: type of shift gate to display
Returns: Tuple of strings to be displayed on circuit
"""
dimensionToAdd = args.known_qubit_count - 2
result = []
if args.use_unicode_characters:
result.append('┌' + '-' * (2 + len(shift)) +
'┐\n|' + ' ' * (2 + len(shift)) + '|')
for i in range(dimensionToAdd):
if (dimensionToAdd % 2 == 0):
if(i == dimensionToAdd/2 - 1):
result.append('|' + ' ' * (2 + len(shift)) +
'|\n'+'| ' + shift + ' |')
else:
result.append('|' + ' ' * (2 + len(shift)) +
'|\n' + '|' + ' ' * (2 + len(shift)) + '|')
else:
if(i == int(dimensionToAdd/2)):
result.append('| ' + shift + ' |\n|' +
' ' * (2 + len(shift)) + '|')
else:
result.append('|' + ' ' * (2 + len(shift)) + '|')
result.append('└' + '-' * (2 + len(shift)) + '┘')
return result
|
Formal statement is: lemma (in linorder_topology) connectedD_interval: assumes "connected U" and xy: "x \<in> U" "y \<in> U" and "x \<le> z" "z \<le> y" shows "z \<in> U" Informal statement is: If $U$ is a connected subset of a linearly ordered topological space, and $x, y \in U$ with $x \leq z \leq y$, then $z \<in> U$.
|
% Test file for trigtech/isnan.m
function pass = test_isnan(pref)
% Get preferences.
if ( nargin < 1 )
pref = trigtech.techPref();
end
testclass = trigtech();
% Test a scalar-valued function.
f = testclass.make(@(x) cos(pi*x), [], pref);
pass(1) = ~isnan(f);
% Test an array-valued function.
f = testclass.make(@(x) [cos(pi*x), cos(pi*x).^2], [], pref);
pass(2) = ~isnan(f);
% Artificially construct and test a NaN-valued function.
f = testclass.make(NaN);
pass(3) = isnan(f);
% Test a NaN scalar-valued function.
try
f = testclass.make(@(x) cos(pi*x) + NaN);
pass(4) = isnan(f);
catch ME
pass(4) = strcmpi(ME.message, 'Cannot handle functions that evaluate to Inf or NaN.');
end
% Test a NaN array-valued function.
try
f = testclass.make(@(x) [cos(pi*x) + NaN, cos(pi*x)]);
pass(5) = isnan(f);
catch ME
pass(5) = strcmpi(ME.message, 'Cannot handle functions that evaluate to Inf or NaN.');
end
end
|
function [J, grad] = costFunction(theta, X, y)
%COSTFUNCTION Compute cost and gradient for logistic regression
% J = COSTFUNCTION(theta, X, y) computes the cost of using theta as the
% parameter for logistic regression and the gradient of the cost
% w.r.t. to the parameters.
% Initialize some useful values
m = length(y); % number of training examples
% You need to return the following variables correctly
J = 0;
grad = zeros(size(theta));
% ====================== YOUR CODE HERE ======================
% Instructions: Compute the cost of a particular choice of theta.
% You should set J to the cost.
% Compute the partial derivatives and set grad to the partial
% derivatives of the cost w.r.t. each parameter in theta
%
% Note: grad should have the same dimensions as theta
%
J = (-1/m)*((y'*log(sigmoid(X*theta))) + ((1-y)'*log(1 - sigmoid(X*theta))));
grad = (1/m)*(X' * (sigmoid(X*theta) - y));
% =============================================================
end
|
\problemname{Guessing Camels}
\illustration{.35}{jjt-cropped-scaled.jpg}{Jaap, Jan and Thijs on camels (in some order). Photo by Tobias
Werth, cc by-sa.}%
\noindent
Jaap, Jan, and Thijs are on a trip to the desert after having attended the ACM ICPC World Finals 2015 in Morocco. The trip included a camel ride, and after returning from the ride, their guide invited them to a big
camel race in the evening. The camels they rode will also participate and it is
customary to bet on the results of the race.
One of the most interesting bets involves guessing the complete order in which the camels will
finish the race. This bet offers the biggest return on your money, since it is also the one that is
the hardest to get right.
Jaap, Jan, and Thijs have already placed their bets, but the race will not start until an hour from now, so they are
getting bored. They started wondering how many pairs of camels they have put in the same order. If
camel~$c$ is before camel~$d$ on Jaap's, Jan's and Thijs' bet, it means that all three of them put
$c$ and $d$ in the same order. Can you help them to calculate the number of pairs of camels for which
this happened?
\section*{Input}
The input consists of:
\begin{itemize}
\item one line with an integer $n$ ($2\leq n \leq 200\,000$), the number of
camels;
\item one line with $n$ integers $a_1, \ldots, a_n$ ($1 \le a_i \le n$ for all $i$), Jaap's bet.
Here $a_1$ is the camel in the first position of Jaap's bet, $a_2$ is the camel in the second position, and so on;
\item one line with Jan's bet, in the same format as Jaap's bet;
\item one line with Thijs' bet, in the same format as Jaap's bet.
\end{itemize}
The camels are numbered $1, \dots, n$. Each camel appears exactly
once in each bet.
\section*{Output}
Output the number of pairs of camels that appear in the same order in all $3$~bets.
|
lemma continuous_on_min [continuous_intros]: fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology" shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. min (f x) (g x))"
|
# Beginner Tutorial for SymPy Mechanics
Once you are at the python command line the first step is to import basic functionality from SymPy and the Mechanics module, otherwise you will only have basic python commands available to work with. We will import the `symbols` function from SymPy core and with the * method
bring in all functionality from the mechanics package.
```
from sympy import symbols
from sympy.physics.mechanics import *
```
You can now see what functions and variables that are available to you with::
```
dir()
```
['Dyadic',
'In',
'KanesMethod',
'LagrangesMethod',
'Lagrangian',
'MechanicsLatexPrinter',
'MechanicsPrettyPrinter',
'MechanicsStrPrinter',
'Out',
'Particle',
'Point',
'ReferenceFrame',
'RigidBody',
'Vector',
'_',
'__',
'___',
'__builtin__',
'__builtins__',
'__name__',
'__package__',
'_dh',
'_i',
'_i1',
'_i2',
'_ih',
'_ii',
'_iii',
'_oh',
'_sh',
'angular_momentum',
'cross',
'dot',
'dynamicsymbols',
'exit',
'express',
'get_ipython',
'help',
'inertia',
'inertia_of_point_mass',
'kinematic_equations',
'kinetic_energy',
'linear_momentum',
'mechanics_printing',
'mlatex',
'mpprint',
'mprint',
'outer',
'partial_velocity',
'potential_energy',
'quit',
'symbols']
This is a long list of available functions. Read about the python import statement to learn about better ways to import only
what you need. One good explanation is <http://effbot.org/zone/import-confusion.htm>.
To get started working with vectors we will need to create a reference frame,
as all vectors need to be defined with respect to a reference frame in the mechanics package. If you
know the name of the command that you want to use simply use the builtin help
function to bring up the documentation for the function. In our case we need to
use the ReferenceFrame class.
```
help(ReferenceFrame)
```
Help on class ReferenceFrame in module sympy.physics.mechanics.essential:
class ReferenceFrame(__builtin__.object)
| A reference frame in classical mechanics.
|
| ReferenceFrame is a class used to represent a reference frame in classical
| mechanics. It has a standard basis of three unit vectors in the frame's
| x, y, and z directions.
|
| It also can have a rotation relative to a parent frame; this rotation is
| defined by a direction cosine matrix relating this frame's basis vectors to
| the parent frame's basis vectors. It can also have an angular velocity
| vector, defined in another frame.
|
| Methods defined here:
|
| __getitem__(self, ind)
| Returns basis vector for the provided index (index being an str)
|
| __init__(self, name, indices=None, latexs=None)
| ReferenceFrame initialization method.
|
| A ReferenceFrame has a set of orthonormal basis vectors, along with
| orientations relative to other ReferenceFrames and angular velocities
| relative to other ReferenceFrames.
|
| Parameters
| ==========
|
| indices : list (of strings)
| If custom indices are desired for console, pretty, and LaTeX
| printing, supply three as a list. The basis vectors can then be
| accessed with the get_item method.
| latexs : list (of strings)
| If custom names are desired for LaTeX printing of each basis
| vector, supply the names here in a list.
|
| Examples
| ========
|
| >>> from sympy.physics.mechanics import ReferenceFrame, mlatex
| >>> N = ReferenceFrame('N')
| >>> N.x
| N.x
| >>> O = ReferenceFrame('O', ('1', '2', '3'))
| >>> O.x
| O['1']
| >>> O['1']
| O['1']
| >>> P = ReferenceFrame('P', latexs=('A1', 'A2', 'A3'))
| >>> mlatex(P.x)
| 'A1'
|
| __iter__(self)
|
| __repr__ = __str__(self)
|
| __str__(self)
| Returns the name of the frame.
|
| ang_acc_in(self, otherframe)
| Returns the angular acceleration Vector of the ReferenceFrame.
|
| Effectively returns the Vector:
| ^N alpha ^B
| which represent the angular acceleration of B in N, where B is self, and
| N is otherframe.
|
| Parameters
| ==========
|
| otherframe : ReferenceFrame
| The ReferenceFrame which the angular acceleration is returned in.
|
| Examples
| ========
|
| >>> from sympy.physics.mechanics import ReferenceFrame, Vector
| >>> N = ReferenceFrame('N')
| >>> A = ReferenceFrame('A')
| >>> V = 10 * N.x
| >>> A.set_ang_acc(N, V)
| >>> A.ang_acc_in(N)
| 10*N.x
|
| ang_vel_in(self, otherframe)
| Returns the angular velocity Vector of the ReferenceFrame.
|
| Effectively returns the Vector:
| ^N omega ^B
| which represent the angular velocity of B in N, where B is self, and
| N is otherframe.
|
| Parameters
| ==========
|
| otherframe : ReferenceFrame
| The ReferenceFrame which the angular velocity is returned in.
|
| Examples
| ========
|
| >>> from sympy.physics.mechanics import ReferenceFrame, Vector
| >>> N = ReferenceFrame('N')
| >>> A = ReferenceFrame('A')
| >>> V = 10 * N.x
| >>> A.set_ang_vel(N, V)
| >>> A.ang_vel_in(N)
| 10*N.x
|
| dcm(self, otherframe)
| The direction cosine matrix between frames.
|
| This gives the DCM between this frame and the otherframe.
| The format is N.xyz = N.dcm(B) * B.xyz
| A SymPy Matrix is returned.
|
| Parameters
| ==========
|
| otherframe : ReferenceFrame
| The otherframe which the DCM is generated to.
|
| Examples
| ========
|
| >>> from sympy.physics.mechanics import ReferenceFrame, Vector
| >>> from sympy import symbols
| >>> q1 = symbols('q1')
| >>> N = ReferenceFrame('N')
| >>> A = N.orientnew('A', 'Axis', [q1, N.x])
| >>> N.dcm(A)
| [1, 0, 0]
| [0, cos(q1), -sin(q1)]
| [0, sin(q1), cos(q1)]
|
| orient(self, parent, rot_type, amounts, rot_order='')
| Defines the orientation of this frame relative to a parent frame.
|
| Supported orientation types are Body, Space, Quaternion, Axis.
| Examples show correct usage.
|
| Parameters
| ==========
|
| parent : ReferenceFrame
| The frame that this ReferenceFrame will have its orientation matrix
| defined in relation to.
| rot_type : str
| The type of orientation matrix that is being created.
| amounts : list OR value
| The quantities that the orientation matrix will be defined by.
| rot_order : str
| If applicable, the order of a series of rotations.
|
| Examples
| ========
|
| >>> from sympy.physics.mechanics import ReferenceFrame, Vector
| >>> from sympy import symbols
| >>> q0, q1, q2, q3, q4 = symbols('q0 q1 q2 q3 q4')
| >>> N = ReferenceFrame('N')
| >>> B = ReferenceFrame('B')
|
| Now we have a choice of how to implement the orientation. First is
| Body. Body orientation takes this reference frame through three
| successive simple rotations. Acceptable rotation orders are of length
| 3, expressed in XYZ or 123, and cannot have a rotation about about an
| axis twice in a row.
|
| >>> B.orient(N, 'Body', [q1, q2, q3], '123')
| >>> B.orient(N, 'Body', [q1, q2, 0], 'ZXZ')
| >>> B.orient(N, 'Body', [0, 0, 0], 'XYX')
|
| Next is Space. Space is like Body, but the rotations are applied in the
| opposite order.
|
| >>> B.orient(N, 'Space', [q1, q2, q3], '312')
|
| Next is Quaternion. This orients the new ReferenceFrame with
| Quaternions, defined as a finite rotation about lambda, a unit vector,
| by some amount theta.
| This orientation is described by four parameters:
| q0 = cos(theta/2)
| q1 = lambda_x sin(theta/2)
| q2 = lambda_y sin(theta/2)
| q3 = lambda_z sin(theta/2)
| Quaternion does not take in a rotation order.
|
| >>> B.orient(N, 'Quaternion', [q0, q1, q2, q3])
|
| Last is Axis. This is a rotation about an arbitrary, non-time-varying
| axis by some angle. The axis is supplied as a Vector. This is how
| simple rotations are defined.
|
| >>> B.orient(N, 'Axis', [q1, N.x + 2 * N.y])
|
| orientnew(self, newname, rot_type, amounts, rot_order='', indices=None, latexs=None)
| Creates a new ReferenceFrame oriented with respect to this Frame.
|
| See ReferenceFrame.orient() for acceptable rotation types, amounts,
| and orders. Parent is going to be self.
|
| Parameters
| ==========
|
| newname : str
| The name for the new ReferenceFrame
| rot_type : str
| The type of orientation matrix that is being created.
| amounts : list OR value
| The quantities that the orientation matrix will be defined by.
| rot_order : str
| If applicable, the order of a series of rotations.
|
|
| Examples
| ========
|
| >>> from sympy.physics.mechanics import ReferenceFrame, Vector
| >>> from sympy import symbols
| >>> q1 = symbols('q1')
| >>> N = ReferenceFrame('N')
| >>> A = N.orientnew('A', 'Axis', [q1, N.x])
|
|
| .orient() documentation:
|
| ========================
|
| Defines the orientation of this frame relative to a parent frame.
|
| Supported orientation types are Body, Space, Quaternion, Axis.
| Examples show correct usage.
|
| Parameters
| ==========
|
| parent : ReferenceFrame
| The frame that this ReferenceFrame will have its orientation matrix
| defined in relation to.
| rot_type : str
| The type of orientation matrix that is being created.
| amounts : list OR value
| The quantities that the orientation matrix will be defined by.
| rot_order : str
| If applicable, the order of a series of rotations.
|
| Examples
| ========
|
| >>> from sympy.physics.mechanics import ReferenceFrame, Vector
| >>> from sympy import symbols
| >>> q0, q1, q2, q3, q4 = symbols('q0 q1 q2 q3 q4')
| >>> N = ReferenceFrame('N')
| >>> B = ReferenceFrame('B')
|
| Now we have a choice of how to implement the orientation. First is
| Body. Body orientation takes this reference frame through three
| successive simple rotations. Acceptable rotation orders are of length
| 3, expressed in XYZ or 123, and cannot have a rotation about about an
| axis twice in a row.
|
| >>> B.orient(N, 'Body', [q1, q2, q3], '123')
| >>> B.orient(N, 'Body', [q1, q2, 0], 'ZXZ')
| >>> B.orient(N, 'Body', [0, 0, 0], 'XYX')
|
| Next is Space. Space is like Body, but the rotations are applied in the
| opposite order.
|
| >>> B.orient(N, 'Space', [q1, q2, q3], '312')
|
| Next is Quaternion. This orients the new ReferenceFrame with
| Quaternions, defined as a finite rotation about lambda, a unit vector,
| by some amount theta.
| This orientation is described by four parameters:
| q0 = cos(theta/2)
| q1 = lambda_x sin(theta/2)
| q2 = lambda_y sin(theta/2)
| q3 = lambda_z sin(theta/2)
| Quaternion does not take in a rotation order.
|
| >>> B.orient(N, 'Quaternion', [q0, q1, q2, q3])
|
| Last is Axis. This is a rotation about an arbitrary, non-time-varying
| axis by some angle. The axis is supplied as a Vector. This is how
| simple rotations are defined.
|
| >>> B.orient(N, 'Axis', [q1, N.x + 2 * N.y])
|
| set_ang_acc(self, otherframe, value)
| Define the angular acceleration Vector in a ReferenceFrame.
|
| Defines the angular acceleration of this ReferenceFrame, in another.
| Angular acceleration can be defined with respect to multiple different
| ReferenceFrames. Care must be taken to not create loops which are
| inconsistent.
|
| Parameters
| ==========
|
| otherframe : ReferenceFrame
| A ReferenceFrame to define the angular acceleration in
| value : Vector
| The Vector representing angular acceleration
|
| Examples
| ========
|
| >>> from sympy.physics.mechanics import ReferenceFrame, Vector
| >>> N = ReferenceFrame('N')
| >>> A = ReferenceFrame('A')
| >>> V = 10 * N.x
| >>> A.set_ang_acc(N, V)
| >>> A.ang_acc_in(N)
| 10*N.x
|
| set_ang_vel(self, otherframe, value)
| Define the angular velocity vector in a ReferenceFrame.
|
| Defines the angular velocity of this ReferenceFrame, in another.
| Angular velocity can be defined with respect to multiple different
| ReferenceFrames. Care must be taken to not create loops which are
| inconsistent.
|
| Parameters
| ==========
|
| otherframe : ReferenceFrame
| A ReferenceFrame to define the angular velocity in
| value : Vector
| The Vector representing angular velocity
|
| Examples
| ========
|
| >>> from sympy.physics.mechanics import ReferenceFrame, Vector
| >>> N = ReferenceFrame('N')
| >>> A = ReferenceFrame('A')
| >>> V = 10 * N.x
| >>> A.set_ang_vel(N, V)
| >>> A.ang_vel_in(N)
| 10*N.x
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| x
| The basis Vector for the ReferenceFrame, in the x direction.
|
| y
| The basis Vector for the ReferenceFrame, in the y direction.
|
| z
| The basis Vector for the ReferenceFrame, in the z direction.
The `ReferenceFrame` class manages everything about rotations, angular velocities, and angular accelerations with respect to other reference frames. Now create an inertial reference frame called N for "Newtonian" as was described in the the docstring:
```
N = ReferenceFrame('N')
```
Keep in mind that `N` is the variable name of which the reference frame named "N"
is stored. It is important to note that `N` is an object and it has properties
and functions associated with it. To see a list of them type:
```
dir(N)
```
['__class__',
'__delattr__',
'__dict__',
'__doc__',
'__format__',
'__getattribute__',
'__getitem__',
'__hash__',
'__init__',
'__iter__',
'__module__',
'__new__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__setattr__',
'__sizeof__',
'__str__',
'__subclasshook__',
'__weakref__',
'_ang_acc_dict',
'_ang_vel_dict',
'_cur',
'_dcm_dict',
'_dict_list',
'_dlist',
'_w_diff_dcm',
'_x',
'_y',
'_z',
'ang_acc_in',
'ang_vel_in',
'dcm',
'indices',
'latex_vecs',
'name',
'orient',
'orientnew',
'pretty_vecs',
'set_ang_acc',
'set_ang_vel',
'str_vecs',
'x',
'y',
'z']
Notice that three of the properties are `x`, `y`, and `z`. These are the
orthonormal unit vectors associated with the reference frame and are the
building blocks for creating more general vectors. We can create a vector by simply
building a linear combination of the unit vectors:
```
v = 1 * N.x + 2 * N.y + 3 * N.z
```
Now a vector expressed in the N reference frame is stored in the variable `v`.
We can print `v` to the screen by typing:
```
print(v)
```
N.x + 2*N.y + 3*N.z
The vector `v` can be manipulated as expected. You can multiply and divide them by scalars:
```
2 * v
```
2*N.x + 4*N.y + 6*N.z
```
v / 3.0
```
0.333333333333333*N.x + 0.666666666666667*N.y + N.z
Note that three is expressed as `3.0` instead of `3`. The python language does
integer division by default. There are ways around this, but for now simply
remember to always declare numbers as floats (i.e. include a decimal).
You can also add and subtract vectors::
```
v + v
```
2*N.x + 4*N.y + 6*N.z
```
w = 5 * N.x + 7 * N.y
```
```
v - w
```
- 4*N.x - 5*N.y + 3*N.z
Vectors also have some useful properties:
```
dir(v)
```
['__add__',
'__and__',
'__class__',
'__delattr__',
'__dict__',
'__div__',
'__doc__',
'__eq__',
'__format__',
'__getattribute__',
'__hash__',
'__init__',
'__module__',
'__mul__',
'__ne__',
'__neg__',
'__new__',
'__or__',
'__radd__',
'__rand__',
'__reduce__',
'__reduce_ex__',
'__repr__',
'__rmul__',
'__ror__',
'__rsub__',
'__setattr__',
'__sizeof__',
'__str__',
'__sub__',
'__subclasshook__',
'__truediv__',
'__weakref__',
'__xor__',
'_latex',
'_pretty',
'_sympyrepr',
'_sympystr',
'args',
'cross',
'diff',
'doit',
'dot',
'dt',
'express',
'magnitude',
'normalize',
'outer',
'simp',
'simplify',
'subs']
You can find the magnitude of a vector by typing:
```
v.magnitude()
```
sqrt(14)
You can compute a unit vector in the direction of `v`:
```
v.normalize()
```
sqrt(14)/14*N.x + sqrt(14)/7*N.y + 3*sqrt(14)/14*N.z
You can find the measure numbers and the reference frame the vector was defined in
with::
```
v.args
```
[([1]
[2]
[3], N)]
Dot and cross products of vectors can also be computed::
```
dot(v, w)
```
19
```
cross(v, w)
```
- 21*N.x + 15*N.y - 3*N.z
We've only used numbers as our measure numbers so far, but it is just as easy
to use symbols. We will introduce six symbols for our measure numbers with the
SymPy `symbols` [`help(symbols) for the documentation`] function:
```
a1, a2, a3 = symbols('a1 a2 a3')
b1, b2, b3 = symbols('b1 b2 b3')
```
And create two new vectors that are completely symbolic:
```
x = a1 * N.x + a2 * N.y + a3 * N.z
y = b1 * N.x + b2 * N.y + b3 * N.z
```
```
dot(x, y)
```
a1*b1 + a2*b2 + a3*b3
```
z = cross(x, y)
z
```
(a2*b3 - a3*b2)*N.x + (-a1*b3 + a3*b1)*N.y + (a1*b2 - a2*b1)*N.z
Numbers and symbols work together seamlessly:
```
dot(v, x)
```
a1 + 2*a2 + 3*a3
You can also differentiate a vector with respect to a variable in a
reference frame:
```
z.diff(a1, N)
```
- b3*N.y + b2*N.z
Vectors don't have be defined with respect to just one reference frame. We can
create a new reference frame and orient it with respect to the `N` frame that
has already been created. We will use the `orient` method of the new frame to
do a simple rotation through `alpha` about the `N.x` axis:
```
A = ReferenceFrame('A')
alpha = symbols('alpha')
A.orient(N, 'Axis', [alpha, N.x])
```
Now the direction cosine matrix with of `A` with respect to `N` can be
computed:
```
A.dcm(N)
```
[1, 0, 0]
[0, cos(alpha), sin(alpha)]
[0, -sin(alpha), cos(alpha)]
Now that SymPy knows that `A` and `N` are oriented with respect to each other
we can express the vectors that we originally wrote in the `A` frame:
```
v.express(A)
```
A.x + (3*sin(alpha) + 2*cos(alpha))*A.y + (-2*sin(alpha) + 3*cos(alpha))*A.z
```
z.express(A)
```
(a2*b3 - a3*b2)*A.x + ((a1*b2 - a2*b1)*sin(alpha) + (-a1*b3 + a3*b1)*cos(alpha))*A.y + ((a1*b2 - a2*b1)*cos(alpha) - (-a1*b3 + a3*b1)*sin(alpha))*A.z
In dynamics systems, at least some of the relative orientation of reference
frames and vectors are time varying. The mechanics module provides a way to
specify quantities as time varying. Let's define two variables `beta` and `d` as
variables which are functions of time:
```
beta, d = dynamicsymbols('beta d')
beta, d
```
(beta(t), d(t))
Now we can create a new reference frame that is oriented with respect to the `A`
frame by `beta` and create a vector in that new frame that is a function of `d`.
This time we will use the `orientnew` method of the `A` frame to create the new
reference frame `B`:
```
B = A.orientnew('B', 'Axis', (beta, A.y))
```
```
vec = d * B.z
```
We can now compute the angular velocity of the reference frame `B` with respect
to other reference frames:
```
B.ang_vel_in(N)
```
beta'*A.y
This allows us to now differentiate the vector, `vec`, with respect to time and
a reference frame::
```
vecdot = vec.dt(N)
vecdot
```
d*beta'*B.x + d'*B.z
```
vecdot.express(N)
```
(d*cos(beta)*beta' + sin(beta)*d')*N.x + (d*sin(alpha)*sin(beta)*beta' - sin(alpha)*cos(beta)*d')*N.y + (-d*sin(beta)*cos(alpha)*beta' + cos(alpha)*cos(beta)*d')*N.z
The `dynamicsymbols` function also allows you to easily create the derivatives of time
varying variables and store them in a variable.
```
theta = dynamicsymbols('theta')
thetad = dynamicsymbols('theta', 1)
theta, thetad
```
(theta(t), Derivative(theta(t), t))
At this point we now have all the tools needed to setup the kinematics for a
dynamic system. Let's start with the classic mass spring damper system under the influence of gravity. Go to the next notebook to follow along: https://github.com/PythonDynamics/pydy_examples/tree/master/mass_spring_damper.
|
# Copyright 2022 The jax3d Authors.
#
# 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.
"""Interpolators for grids of latent codes."""
import abc
from typing import Sequence
import chex
from flax import linen as nn
from jax import numpy as jnp
from jax3d.projects.nesf.utils.typing import f32, i32 # pylint: disable=g-multiple-import
GridShape = Sequence[int]
def compute_corner_indices(
grid_shape: GridShape,
points: f32['... num_dims']) -> i32['... 2**num_dims num_dims']:
"""Computes the indices of the 2^num_dims corners surrounding points.
This assumes the point grid has grid_size points in each dimension.
Furthermore the first point is at 0.0 and the last point at 1.0 in each
dimension.
This means a grid_size=[n] would result in n-1 grid cells.
Example:
p = jnp.asarray([0.15, 0.25], dtype=jnp.float32)
grid_shape = [11, 11]
indices = compute_corner_indices(grid_shape=grid_shape, points=p)
np.testing.assert_array_equal(indices, np.asarray(
[[1, 2], [1, 3], [2, 2], [2, 3]]))
Args:
grid_shape: List of length num_dims. Number of grid points
along each dimension. Shape of the point_grid.
points: [..., num_dims] float32. Positions to get indices for.
Returns:
[..., 2^num_dims, num_dims] int32. Point indices of the corners that
surround each point in points.
"""
grid_shape = jnp.asarray(grid_shape, dtype=jnp.int32)
# Convert points to grid coordinates
points = points * (grid_shape - 1)
# Get the floor of the points (lower left corner of a 2D voxel)
points = points.astype(jnp.int32)[..., None, :]
# For the above example: points.shape[-1] == 2
# Iteration 1: i = 0, points = [[1, 2]]
# offset = [1, 0]
# points = [[1, 2], [2, 2]]
# Iteration 2: i = 1, points = [[1, 2], [2, 2]]
# offset = [0, 1]
# points = [[1, 2], [2, 2], [1, 3], [2, 3]]
for i in range(points.shape[-1]):
offset = jnp.asarray([int(i == j) for j in range(points.shape[-1])])
points = jnp.concatenate([points, points + offset], axis=-2)
points = jnp.clip(points, 0, grid_shape - 1)
return points
def compute_corner_weights(
grid_shape: GridShape,
points: f32['... num_dims']) -> f32['... 2**num_dims']:
"""Computes the weights of the 8 corners surrounding points.
This function calculates the weight of each of the 2**num_dims corners, when
performing tri-linear interpolation.
Args:
grid_shape: List of length num_dims. Number of voxels partitions
along each channel. Shape of the point_grid [x, y, z].
points: Positions to weights for.
Returns:
[..., 2^num_dims] float32. Trilinear weight of each voxel corner,
in the same order as compute_corner_indices above.
"""
num_dims = points.shape[-1]
weights = jnp.ones(points.shape[:-1] + (1,))
grid_shape = jnp.asarray(grid_shape)
# The weight depends on how far away the corner is from the point.
# This is then computed by getting the modulus of the point and the corner
channel_weight = jnp.fmod(points * (grid_shape - 1), 1)
# Example:
# grid_shape = [11, 11]
# points = jnp.asarray([0.17, 0.25], dtype=jnp.float32)
# num_dims = 2
# weights = [1]
# channel_weight = [0.7, 0.5]
# Iteration 1: i = 0
# cw = 0.7
# weights = [0.3, 0.7]
# Iteration 2: i = 1
# cw = 0.5
# weights = [0.15, 0.35, 0.15, 0.35]
# The following for-loop isn't as bad as it seems. For all cases we care
# about, num_dims == 3.
for i in range(num_dims):
cw = channel_weight[..., i:i+1]
# Linear interpolation to calculate weights. Note: this doubles the number
# of weights for each dimension, so we end up with 2^num_dims weights in
# total.
weights = jnp.concatenate([weights * (1 - cw), weights * cw], axis=-1)
return weights
class InterpolationFn(abc.ABC):
"""Abstract class for all implementations of latent code interpolation."""
@abc.abstractmethod
def __call__(
self,
grid_size: GridShape,
points: f32['... num_dims'],
latents: f32['... 2**num_dims num_features'],
corner_indices: i32['... 2**num_dims num_dims']
) -> f32['... num_features']:
"""Interpolate between corners inside a single voxel.
Args:
grid_size: List of length num_dims. Number of voxels partitions along each
channel. Shape of the point_grid [x, y, z].
points: Points to get interpolated latent codes for.
latents: Latent features to interpolate over. Ordered the same way as
corner_indices.
corner_indices: Indices for the voxel corners, ordered according to
compute_corner_indices.
Returns:
The interpolated latent.
"""
class TrilinearInterpolation(InterpolationFn):
"""Trilinear interpolation implementation."""
def __call__(
self,
grid_size: GridShape,
points: f32['... num_dims'],
latents: f32['... 2**num_dims num_features'],
corner_indices: i32['... 2**num_dims num_dims']
) -> f32['... num_features']:
"""Interpolate between corners inside a single voxel.
Args:
grid_size: List of length num_dims. Number of voxels partitions along each
channel. Shape of the point_grid [x, y, z].
points: Points to get interpolated latent codes for.
latents: Latent features to interpolate over. Ordered the same way as
corner_indices.
corner_indices: Indices for the voxel corners, ordered according to
compute_corner_indices.
Returns:
The interpolated latent.
"""
del corner_indices # Unused.
weights = compute_corner_weights(grid_size, points)
return jnp.einsum('...cf,...c->...f', latents, weights)
class GridInterpolator(nn.Module):
"""Interpolation of Grids using a specified function."""
interpolation: InterpolationFn
@nn.compact
def __call__(self,
voxel_embeddings: f32['num_grids, ..., num_features'],
grid_indexes: i32['... 1'],
points: f32['... num_dims']
) -> f32['... grid_features']:
"""Tri-Linearly interpolate the latent code in the latent grid.
For all points outside of the [-1; 1] bounding box, this module will return
zero latent vectors.
Args:
voxel_embeddings: the grid of latent codes to interpolate.
grid_indexes: the index of the grid to query.
points: points to get interpolated latent codes for.
Returns:
latent codes.
"""
chex.assert_equal_shape_prefix([grid_indexes, points],
len(points.shape) - 1)
grid_size = voxel_embeddings.shape[1:-1]
chex.assert_axis_dimension(points, -1, len(grid_size))
# rescale points from [-1; 1] to [0; 1]
points = (points + 1) / 2
# Shape: [..., 2^num_dims, num_dims] containing the corner indices
corner_indices = compute_corner_indices(grid_size, points)
# Shape: [..., 2^num_dims, 1]
grid_indexes = jnp.broadcast_to(grid_indexes[..., None, :],
(*corner_indices.shape[:-1], 1))
# Shape: [..., 2^num_dims, num_dims+1]
grid_corner_indices = jnp.concatenate(
[grid_indexes, corner_indices], axis=-1)
# # Move last axis to front.
# grid_corner_indices = jnp.rollaxis(grid_corner_indices, -1)
# latents = voxel_embeddings[(*grid_corner_indices,)]
latents = gather_v1(voxel_embeddings, grid_corner_indices)
latents = self.interpolation(
grid_size=grid_size,
points=points,
corner_indices=corner_indices,
latents=latents)
# Replace all outside value with zeros.
inside_points = (points >= 0.0) * (points <= 1.0)
inside_points = jnp.all(inside_points, axis=-1, keepdims=True)
latents *= inside_points
return latents
def gather_v1(values, indices):
"""Gather values[indices[..., 0], indices[..., 1], ...] from indices[..., n].
This implementation flattens batch dimensions in `values` and `indices`.
Args:
values: ...
indices: ...
Returns:
...
"""
values = jnp.asarray(values)
indices = jnp.asarray(indices, dtype=jnp.uint32)
# Flatten leading dimensions of indices.
*indices_batch_shape, num_spatial_dims = indices.shape
indices_flat = jnp.reshape(indices, (-1, num_spatial_dims))
indices_linear = flat_indices(indices_flat, values.shape)
# Flatten leading dimensions of values.
*values_batch_shape, num_value_dims = values.shape
del values_batch_shape
values_linear = jnp.reshape(values, (-1, num_value_dims))
# Gather values.
result_linear = values_linear[indices_linear]
# Unflatten leading dimensions.
result = jnp.reshape(result_linear, (*indices_batch_shape, num_value_dims))
return result
def flat_indices(indices, value_shape):
"""Computes linearized indices for a flattened version of value_shape."""
assert len(indices.shape) == 2
assert indices.shape[-1] == len(value_shape)-1
value_strides = strides(value_shape[:-1])
value_strides = jnp.asarray(value_strides, dtype=indices.dtype)
return jnp.sum(indices * value_strides, axis=-1)
def strides(shape):
"""Computes ndarray.strides for an array shape."""
result = []
stride = 1
for _, x in reversed(list(enumerate(shape))):
result.append(stride)
stride *= x
return list(reversed(result))
|
module Luau.RuntimeType where
open import Luau.Syntax using (Value; nil; addr; number; bool; string)
data RuntimeType : Set where
function : RuntimeType
number : RuntimeType
nil : RuntimeType
boolean : RuntimeType
string : RuntimeType
valueType : Value → RuntimeType
valueType nil = nil
valueType (addr a) = function
valueType (number n) = number
valueType (bool b) = boolean
valueType (string x) = string
|
/*
Copyright (c) 2006, Arvid Norberg
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution.
* Neither the name of the author nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TORRENT_SESSION_IMPL_HPP_INCLUDED
#define TORRENT_SESSION_IMPL_HPP_INCLUDED
#include <algorithm>
#include <vector>
#include <set>
#include <list>
#ifndef TORRENT_DISABLE_GEO_IP
#ifdef WITH_SHIPPED_GEOIP_H
#include "libtorrent/GeoIP.h"
#else
#include <GeoIP.h>
#endif
#endif
#ifdef _MSC_VER
#pragma warning(push, 1)
#endif
#include <boost/filesystem/path.hpp>
#include <boost/thread.hpp>
#include <boost/thread/condition.hpp>
#include <boost/pool/object_pool.hpp>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "libtorrent/torrent_handle.hpp"
#include "libtorrent/entry.hpp"
#include "libtorrent/socket.hpp"
#include "libtorrent/peer_id.hpp"
#include "libtorrent/tracker_manager.hpp"
#include "libtorrent/debug.hpp"
#include "libtorrent/piece_block_progress.hpp"
#include "libtorrent/ip_filter.hpp"
#include "libtorrent/config.hpp"
#include "libtorrent/session_settings.hpp"
#include "libtorrent/session_status.hpp"
#include "libtorrent/session.hpp"
#include "libtorrent/stat.hpp"
#include "libtorrent/file_pool.hpp"
#include "libtorrent/bandwidth_manager.hpp"
#include "libtorrent/socket_type.hpp"
#include "libtorrent/connection_queue.hpp"
#include "libtorrent/disk_io_thread.hpp"
#include "libtorrent/udp_socket.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/policy.hpp" // for policy::peer
#include "libtorrent/alert.hpp" // for alert_manager
#if TORRENT_COMPLETE_TYPES_REQUIRED
#include "libtorrent/peer_connection.hpp"
#endif
namespace libtorrent
{
namespace fs = boost::filesystem;
class peer_connection;
class upnp;
class natpmp;
class lsd;
struct fingerprint;
class torrent;
class alert;
namespace dht
{
struct dht_tracker;
}
namespace aux
{
struct session_impl;
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
struct tracker_logger;
#endif
// used to initialize the g_current_time before
// anything else
struct initialize_timer
{
initialize_timer();
};
// this is the link between the main thread and the
// thread started to run the main downloader loop
struct session_impl: boost::noncopyable, initialize_timer
{
// the size of each allocation that is chained in the send buffer
enum { send_buffer_size = 128 };
#ifdef TORRENT_DEBUG
friend class ::libtorrent::peer_connection;
#endif
friend struct checker_impl;
friend class invariant_access;
typedef std::set<boost::intrusive_ptr<peer_connection> > connection_map;
typedef std::map<sha1_hash, boost::shared_ptr<torrent> > torrent_map;
session_impl(
std::pair<int, int> listen_port_range
, fingerprint const& cl_fprint
, char const* listen_interface
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
, fs::path const& logpath
#endif
);
~session_impl();
#ifndef TORRENT_DISABLE_EXTENSIONS
void add_extension(boost::function<boost::shared_ptr<torrent_plugin>(
torrent*, void*)> ext);
#endif
#ifdef TORRENT_DEBUG
bool has_peer(peer_connection const* p) const
{
return std::find_if(m_connections.begin(), m_connections.end()
, boost::bind(&boost::intrusive_ptr<peer_connection>::get, _1) == p)
!= m_connections.end();
}
#endif
void operator()();
void open_listen_port();
// if we are listening on an IPv6 interface
// this will return one of the IPv6 addresses on this
// machine, otherwise just an empty endpoint
tcp::endpoint get_ipv6_interface() const;
tcp::endpoint get_ipv4_interface() const;
void async_accept(boost::shared_ptr<socket_acceptor> const& listener);
void on_accept_connection(boost::shared_ptr<socket_type> const& s
, boost::weak_ptr<socket_acceptor> listener, error_code const& e);
void on_socks_accept(boost::shared_ptr<socket_type> const& s
, error_code const& e);
void incoming_connection(boost::shared_ptr<socket_type> const& s);
// must be locked to access the data
// in this struct
typedef boost::mutex mutex_t;
mutable mutex_t m_mutex;
boost::weak_ptr<torrent> find_torrent(const sha1_hash& info_hash);
peer_id const& get_peer_id() const { return m_peer_id; }
void close_connection(peer_connection const* p, error_code const& ec);
void set_settings(session_settings const& s);
session_settings const& settings() const { return m_settings; }
#ifndef TORRENT_DISABLE_DHT
void add_dht_node(std::pair<std::string, int> const& node);
void add_dht_node(udp::endpoint n);
void add_dht_router(std::pair<std::string, int> const& node);
void set_dht_settings(dht_settings const& s);
dht_settings const& get_dht_settings() const { return m_dht_settings; }
void start_dht();
void stop_dht();
void start_dht(entry const& startup_state);
#ifndef TORRENT_NO_DEPRECATE
entry dht_state(session_impl::mutex_t::scoped_lock& l) const;
#endif
void maybe_update_udp_mapping(int nat, int local_port, int external_port);
void on_dht_router_name_lookup(error_code const& e
, tcp::resolver::iterator host);
#endif
#ifndef TORRENT_DISABLE_ENCRYPTION
void set_pe_settings(pe_settings const& settings);
pe_settings const& get_pe_settings() const { return m_pe_settings; }
#endif
void on_port_map_log(char const* msg, int map_transport);
void on_lsd_announce(error_code const& e);
// called when a port mapping is successful, or a router returns
// a failure to map a port
void on_port_mapping(int mapping, int port, error_code const& ec
, int nat_transport);
bool is_aborted() const { return m_abort; }
bool is_paused() const { return m_paused; }
void pause();
void resume();
void set_ip_filter(ip_filter const& f);
ip_filter const& get_ip_filter() const;
void set_port_filter(port_filter const& f);
bool listen_on(
std::pair<int, int> const& port_range
, const char* net_interface = 0);
bool is_listening() const;
torrent_handle add_torrent(add_torrent_params const&, error_code& ec);
void remove_torrent(torrent_handle const& h, int options);
std::vector<torrent_handle> get_torrents();
void queue_check_torrent(boost::shared_ptr<torrent> const& t);
void dequeue_check_torrent(boost::shared_ptr<torrent> const& t);
void set_alert_mask(int m);
size_t set_alert_queue_size_limit(size_t queue_size_limit_);
std::auto_ptr<alert> pop_alert();
void set_alert_dispatch(boost::function<void(alert const&)> const&);
alert const* wait_for_alert(time_duration max_wait);
int upload_rate_limit() const;
int download_rate_limit() const;
int local_upload_rate_limit() const;
int local_download_rate_limit() const;
void set_local_download_rate_limit(int bytes_per_second);
void set_local_upload_rate_limit(int bytes_per_second);
void set_download_rate_limit(int bytes_per_second);
void set_upload_rate_limit(int bytes_per_second);
void set_max_half_open_connections(int limit);
void set_max_connections(int limit);
void set_max_uploads(int limit);
int max_connections() const { return m_max_connections; }
int max_uploads() const { return m_max_uploads; }
int max_half_open_connections() const { return m_half_open.limit(); }
int num_uploads() const { return m_num_unchoked; }
int num_connections() const
{ return m_connections.size(); }
void unchoke_peer(peer_connection& c);
void choke_peer(peer_connection& c);
session_status status() const;
void set_peer_id(peer_id const& id);
void set_key(int key);
unsigned short listen_port() const;
void abort();
torrent_handle find_torrent_handle(sha1_hash const& info_hash);
void announce_lsd(sha1_hash const& ih);
void save_state(entry& e, boost::uint32_t flags, session_impl::mutex_t::scoped_lock& l) const;
void load_state(lazy_entry const& e);
void set_proxy(proxy_settings const& s);
proxy_settings const& proxy() const { return m_peer_proxy; }
void set_peer_proxy(proxy_settings const& s)
{
m_peer_proxy = s;
// in case we just set a socks proxy, we might have to
// open the socks incoming connection
if (!m_socks_listen_socket) open_new_incoming_socks_connection();
}
void set_web_seed_proxy(proxy_settings const& s)
{ m_web_seed_proxy = s; }
void set_tracker_proxy(proxy_settings const& s)
{ m_tracker_proxy = s; }
proxy_settings const& peer_proxy() const
{ return m_peer_proxy; }
proxy_settings const& web_seed_proxy() const
{ return m_web_seed_proxy; }
proxy_settings const& tracker_proxy() const
{ return m_tracker_proxy; }
#ifndef TORRENT_DISABLE_DHT
void set_dht_proxy(proxy_settings const& s)
{
m_dht_proxy = s;
m_dht_socket.set_proxy_settings(s);
}
proxy_settings const& dht_proxy() const
{ return m_dht_proxy; }
#endif
#ifndef TORRENT_DISABLE_GEO_IP
std::string as_name_for_ip(address const& a);
int as_for_ip(address const& a);
std::pair<const int, int>* lookup_as(int as);
bool load_asnum_db(char const* file);
bool has_asnum_db() const { return m_asnum_db; }
bool load_country_db(char const* file);
bool has_country_db() const { return m_country_db; }
char const* country_for_ip(address const& a);
#ifndef BOOST_FILESYSTEM_NARROW_ONLY
bool load_asnum_db(wchar_t const* file);
bool load_country_db(wchar_t const* file);
#endif
#endif
void start_lsd();
void start_natpmp(natpmp* n);
void start_upnp(upnp* u);
void stop_lsd();
void stop_natpmp();
void stop_upnp();
int next_port();
void add_redundant_bytes(size_type b)
{
TORRENT_ASSERT(b > 0);
m_total_redundant_bytes += b;
}
void add_failed_bytes(size_type b)
{
TORRENT_ASSERT(b > 0);
m_total_failed_bytes += b;
}
std::pair<char*, int> allocate_buffer(int size);
void free_buffer(char* buf, int size);
char* allocate_disk_buffer(char const* category);
void free_disk_buffer(char* buf);
void set_external_address(address const& ip);
address const& external_address() const { return m_external_address; }
// private:
void update_disk_thread_settings();
void on_dht_state_callback(boost::condition& c
, entry& e, bool& done) const;
void on_lsd_peer(tcp::endpoint peer, sha1_hash const& ih);
void setup_socket_buffers(socket_type& s);
// this is a shared pool where policy_peer objects
// are allocated. It's a pool since we're likely
// to have tens of thousands of peers, and a pool
// saves significant overhead
#ifdef TORRENT_STATS
struct logging_allocator
{
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
static char* malloc(const size_type bytes)
{
allocated_bytes += bytes;
++allocations;
return (char*)::malloc(bytes);
}
static void free(char* const block)
{
--allocations;
return ::free(block);
}
static int allocations;
static int allocated_bytes;
};
boost::object_pool<
policy::ipv4_peer, logging_allocator> m_ipv4_peer_pool;
# if TORRENT_USE_IPV6
boost::object_pool<
policy::ipv6_peer, logging_allocator> m_ipv6_peer_pool;
# endif
#else
boost::object_pool<policy::ipv4_peer> m_ipv4_peer_pool;
# if TORRENT_USE_IPV6
boost::object_pool<policy::ipv6_peer> m_ipv6_peer_pool;
# endif
#endif
// this vector is used to store the block_info
// objects pointed to by partial_piece_info returned
// by torrent::get_download_queue.
std::vector<block_info> m_block_info_storage;
#ifndef TORRENT_DISABLE_POOL_ALLOCATOR
// this pool is used to allocate and recycle send
// buffers from.
boost::pool<> m_send_buffers;
#endif
boost::mutex m_send_buffer_mutex;
// the file pool that all storages in this session's
// torrents uses. It sets a limit on the number of
// open files by this session.
// file pool must be destructed after the torrents
// since they will still have references to it
// when they are destructed.
file_pool m_files;
// this is where all active sockets are stored.
// the selector can sleep while there's no activity on
// them
mutable io_service m_io_service;
tcp::resolver m_host_resolver;
// handles delayed alerts
alert_manager m_alerts;
// handles disk io requests asynchronously
// peers have pointers into the disk buffer
// pool, and must be destructed before this
// object. The disk thread relies on the file
// pool object, and must be destructed before
// m_files. The disk io thread posts completion
// events to the io service, and needs to be
// constructed after it.
disk_io_thread m_disk_thread;
// this is a list of half-open tcp connections
// (only outgoing connections)
// this has to be one of the last
// members to be destructed
connection_queue m_half_open;
// the bandwidth manager is responsible for
// handing out bandwidth to connections that
// asks for it, it can also throttle the
// rate.
bandwidth_manager<peer_connection> m_download_rate;
bandwidth_manager<peer_connection> m_upload_rate;
// the global rate limiter bandwidth channels
bandwidth_channel m_download_channel;
bandwidth_channel m_upload_channel;
// bandwidth channels for local peers when
// rate limits are ignored. They are only
// throttled by these global rate limiters
// and they don't have a rate limit set by
// default
bandwidth_channel m_local_download_channel;
bandwidth_channel m_local_upload_channel;
bandwidth_channel* m_bandwidth_channel[2];
tracker_manager m_tracker_manager;
torrent_map m_torrents;
typedef std::list<boost::shared_ptr<torrent> > check_queue_t;
// this has all torrents that wants to be checked in it
check_queue_t m_queued_for_checking;
// this maps sockets to their peer_connection
// object. It is the complete list of all connected
// peers.
connection_map m_connections;
// filters incoming connections
ip_filter m_ip_filter;
// filters outgoing connections
port_filter m_port_filter;
// the peer id that is generated at the start of the session
peer_id m_peer_id;
// the key is an id that is used to identify the
// client with the tracker only. It is randomized
// at startup
int m_key;
// the number of retries we make when binding the
// listen socket. For each retry the port number
// is incremented by one
int m_listen_port_retries;
// the ip-address of the interface
// we are supposed to listen on.
// if the ip is set to zero, it means
// that we should let the os decide which
// interface to listen on
tcp::endpoint m_listen_interface;
// if we're listening on an IPv6 interface
// this is one of the non local IPv6 interfaces
// on this machine
tcp::endpoint m_ipv6_interface;
tcp::endpoint m_ipv4_interface;
struct listen_socket_t
{
listen_socket_t(): external_port(0) {}
// this is typically set to the same as the local
// listen port. In case a NAT port forward was
// successfully opened, this will be set to the
// port that is open on the external (NAT) interface
// on the NAT box itself. This is the port that has
// to be published to peers, since this is the port
// the client is reachable through.
int external_port;
// the actual socket
boost::shared_ptr<socket_acceptor> sock;
};
// since we might be listening on multiple interfaces
// we might need more than one listen socket
std::list<listen_socket_t> m_listen_sockets;
// when as a socks proxy is used for peers, also
// listen for incoming connections on a socks connection
boost::shared_ptr<socket_type> m_socks_listen_socket;
void open_new_incoming_socks_connection();
listen_socket_t setup_listener(tcp::endpoint ep, int retries, bool v6_only = false);
// the settings for the client
session_settings m_settings;
// the proxy settings for different
// kinds of connections
proxy_settings m_peer_proxy;
proxy_settings m_web_seed_proxy;
proxy_settings m_tracker_proxy;
#ifndef TORRENT_DISABLE_DHT
proxy_settings m_dht_proxy;
#endif
#ifndef TORRENT_DISABLE_DHT
entry m_dht_state;
#endif
// set to true when the session object
// is being destructed and the thread
// should exit
bool m_abort;
// is true if the session is paused
bool m_paused;
// the max number of unchoked peers as set by the user
int m_max_uploads;
// the number of unchoked peers as set by the auto-unchoker
// this should always be >= m_max_uploads
int m_allowed_upload_slots;
// the max number of connections, as set by the user
int m_max_connections;
// the number of unchoked peers
int m_num_unchoked;
// this is initialized to the unchoke_interval
// session_setting and decreased every second.
// when it reaches zero, it is reset to the
// unchoke_interval and the unchoke set is
// recomputed.
int m_unchoke_time_scaler;
// this is used to decide when to recalculate which
// torrents to keep queued and which to activate
int m_auto_manage_time_scaler;
// works like unchoke_time_scaler but it
// is only decresed when the unchoke set
// is recomputed, and when it reaches zero,
// the optimistic unchoke is moved to another peer.
int m_optimistic_unchoke_time_scaler;
// works like unchoke_time_scaler. Each time
// it reaches 0, and all the connections are
// used, the worst connection will be disconnected
// from the torrent with the most peers
int m_disconnect_time_scaler;
// when this scaler reaches zero, it will
// scrape one of the auto managed, paused,
// torrents.
int m_auto_scrape_time_scaler;
// statistics gathered from all torrents.
stat m_stat;
// is false by default and set to true when
// the first incoming connection is established
// this is used to know if the client is behind
// NAT or not.
bool m_incoming_connection;
void on_disk_queue();
void on_tick(error_code const& e);
int auto_manage_torrents(std::vector<torrent*>& list
, int hard_limit, int type_limit);
void recalculate_auto_managed_torrents();
void recalculate_unchoke_slots(int congested_torrents
, int uncongested_torrents);
void recalculate_optimistic_unchoke_slot();
ptime m_created;
int session_time() const { return total_seconds(time_now() - m_created); }
ptime m_last_tick;
ptime m_last_second_tick;
// the last time we went through the peers
// to decide which ones to choke/unchoke
ptime m_last_choke;
// when outgoing_ports is configured, this is the
// port we'll bind the next outgoing socket to
int m_next_port;
#ifndef TORRENT_DISABLE_DHT
boost::intrusive_ptr<dht::dht_tracker> m_dht;
dht_settings m_dht_settings;
// if this is set to true, the dht listen port
// will be set to the same as the tcp listen port
// and will be synchronlized with it as it changes
// it defaults to true
bool m_dht_same_port;
// see m_external_listen_port. This is the same
// but for the udp port used by the DHT.
int m_external_udp_port;
rate_limited_udp_socket m_dht_socket;
// these are used when starting the DHT
// (and bootstrapping it), and then erased
std::list<udp::endpoint> m_dht_router_nodes;
void on_receive_udp(error_code const& e
, udp::endpoint const& ep, char const* buf, int len);
#endif
#ifndef TORRENT_DISABLE_ENCRYPTION
pe_settings m_pe_settings;
#endif
boost::intrusive_ptr<natpmp> m_natpmp;
boost::intrusive_ptr<upnp> m_upnp;
boost::intrusive_ptr<lsd> m_lsd;
// 0 is natpmp 1 is upnp
int m_tcp_mapping[2];
int m_udp_mapping[2];
// the timer used to fire the tick
deadline_timer m_timer;
// torrents are announced on the local network in a
// round-robin fashion. All torrents are cycled through
// within the LSD announce interval (which defaults to
// 5 minutes)
torrent_map::iterator m_next_lsd_torrent;
// this announce timer is used
// by Local service discovery
deadline_timer m_lsd_announce_timer;
// the index of the torrent that will be offered to
// connect to a peer next time on_tick is called.
// This implements a round robin.
torrent_map::iterator m_next_connect_torrent;
#ifdef TORRENT_DEBUG
void check_invariant() const;
#endif
#if defined TORRENT_STATS && defined TORRENT_DISK_STATS
void log_buffer_usage();
#endif
#if defined TORRENT_STATS
// logger used to write bandwidth usage statistics
std::ofstream m_stats_logger;
int m_second_counter;
// used to log send buffer usage statistics
std::ofstream m_buffer_usage_logger;
// the number of send buffers that are allocated
int m_buffer_allocations;
#endif
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
boost::shared_ptr<logger> create_log(std::string const& name
, int instance, bool append = true);
// this list of tracker loggers serves as tracker_callbacks when
// shutting down. This list is just here to keep them alive during
// whe shutting down process
std::list<boost::shared_ptr<tracker_logger> > m_tracker_loggers;
fs::path m_logpath;
public:
boost::shared_ptr<logger> m_logger;
private:
#endif
#ifdef TORRENT_UPNP_LOGGING
std::ofstream m_upnp_log;
#endif
address m_external_address;
#ifndef TORRENT_DISABLE_EXTENSIONS
typedef std::list<boost::function<boost::shared_ptr<
torrent_plugin>(torrent*, void*)> > extension_list_t;
extension_list_t m_extensions;
#endif
#ifndef TORRENT_DISABLE_GEO_IP
GeoIP* m_asnum_db;
GeoIP* m_country_db;
// maps AS number to the peak download rate
// we've seen from it. Entries are never removed
// from this map. Pointers to its elements
// are kept in the policy::peer structures.
std::map<int, int> m_as_peak;
#endif
// total redundant and failed bytes
size_type m_total_failed_bytes;
size_type m_total_redundant_bytes;
// the main working thread
boost::scoped_ptr<boost::thread> m_thread;
};
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING || defined TORRENT_ERROR_LOGGING
struct tracker_logger : request_callback
{
tracker_logger(session_impl& ses): m_ses(ses) {}
void tracker_warning(tracker_request const& req
, std::string const& str)
{
debug_log("*** tracker warning: " + str);
}
void tracker_response(tracker_request const&
, libtorrent::address const& tracker_ip
, std::list<address> const& ip_list
, std::vector<peer_entry>& peers
, int interval
, int min_interval
, int complete
, int incomplete
, address const& external_ip)
{
std::string s;
s = "TRACKER RESPONSE:\n";
char tmp[200];
snprintf(tmp, 200, "interval: %d\nmin_interval: %d\npeers:\n", interval, min_interval);
s += tmp;
for (std::vector<peer_entry>::const_iterator i = peers.begin();
i != peers.end(); ++i)
{
char pid[41];
to_hex((const char*)&i->pid[0], 20, pid);
if (i->pid.is_all_zeros()) pid[0] = 0;
snprintf(tmp, 200, " %-16s %-5d %s\n", i->ip.c_str(), i->port, pid);
s += tmp;
}
snprintf(tmp, 200, "external ip: %s\n", print_address(external_ip).c_str());
s += tmp;
debug_log(s);
}
void tracker_request_timed_out(
tracker_request const&)
{
debug_log("*** tracker timed out");
}
void tracker_request_error(
tracker_request const&
, int response_code
, const std::string& str
, int retry_interval)
{
char msg[256];
snprintf(msg, sizeof(msg), "*** tracker error: %d: %s", response_code, str.c_str());
debug_log(msg);
}
void debug_log(const std::string& line)
{
(*m_ses.m_logger) << time_now_string() << " " << line << "\n";
}
session_impl& m_ses;
};
#endif
}
}
#endif
|
[STATEMENT]
lemma (in project) lang_dual_pnCoPlus[simp]: "\<lbrakk>wf_dual n r; wf_dual n s\<rbrakk> \<Longrightarrow>
lang_dual n (pnCoPlus b r s) = lang_dual n (CoPlus b r s)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>wf_dual n r; wf_dual n s\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b r s) = lang_dual n (CoPlus b r s)
[PROOF STEP]
proof (induct b r s rule: pnCoPlus.induct)
[PROOF STATE]
proof (state)
goal (43 subgoals):
1. \<And>b1 b2 r. \<lbrakk>wf_dual n (CoZero b2); wf_dual n r\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoZero b2) r) = lang_dual n (CoPlus b1 (CoZero b2) r)
2. \<And>b1 v b2. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoZero b2)) = lang_dual n (CoPlus b1 (CoOne v) (CoZero b2))
3. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoZero b2))
4. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
5. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
6. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
7. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
8. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
9. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
10. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
A total of 43 subgoals...
[PROOF STEP]
case 1
[PROOF STATE]
proof (state)
this:
wf_dual n (CoZero b2_)
wf_dual n r_
goal (43 subgoals):
1. \<And>b1 b2 r. \<lbrakk>wf_dual n (CoZero b2); wf_dual n r\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoZero b2) r) = lang_dual n (CoPlus b1 (CoZero b2) r)
2. \<And>b1 v b2. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoZero b2)) = lang_dual n (CoPlus b1 (CoOne v) (CoZero b2))
3. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoZero b2))
4. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
5. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
6. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
7. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
8. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
9. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
10. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
A total of 43 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoZero b2_)
wf_dual n r_
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoZero b2_) r_) = lang_dual n (CoPlus b1_ (CoZero b2_) r_)
[PROOF STEP]
by (auto dest: lang_dual_subset_lists)
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoZero b2_) r_) = lang_dual n (CoPlus b1_ (CoZero b2_) r_)
goal (42 subgoals):
1. \<And>b1 v b2. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoZero b2)) = lang_dual n (CoPlus b1 (CoOne v) (CoZero b2))
2. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoZero b2))
3. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
4. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
5. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
6. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
7. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
8. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
9. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
10. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
A total of 42 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (42 subgoals):
1. \<And>b1 v b2. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoZero b2)) = lang_dual n (CoPlus b1 (CoOne v) (CoZero b2))
2. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoZero b2))
3. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
4. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
5. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
6. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
7. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
8. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
9. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
10. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
A total of 42 subgoals...
[PROOF STEP]
case "2_1"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoOne v_)
wf_dual n (CoZero b2_)
goal (42 subgoals):
1. \<And>b1 v b2. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoZero b2)) = lang_dual n (CoPlus b1 (CoOne v) (CoZero b2))
2. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoZero b2))
3. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
4. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
5. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
6. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
7. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
8. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
9. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
10. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
A total of 42 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoOne v_)
wf_dual n (CoZero b2_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoOne v_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoOne v_) (CoZero b2_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoOne v_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoOne v_) (CoZero b2_))
goal (41 subgoals):
1. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoZero b2))
2. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
3. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
4. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
5. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
6. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
7. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
8. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
9. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
10. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
A total of 41 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (41 subgoals):
1. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoZero b2))
2. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
3. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
4. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
5. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
6. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
7. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
8. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
9. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
10. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
A total of 41 subgoals...
[PROOF STEP]
case "2_2"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoZero b2_)
goal (41 subgoals):
1. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoZero b2))
2. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
3. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
4. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
5. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
6. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
7. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
8. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
9. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
10. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
A total of 41 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoZero b2_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoAtom v_ va_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoAtom v_ va_) (CoZero b2_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoAtom v_ va_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoAtom v_ va_) (CoZero b2_))
goal (40 subgoals):
1. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
2. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
3. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
4. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
5. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
6. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
7. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
8. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
9. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
10. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
A total of 40 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (40 subgoals):
1. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
2. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
3. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
4. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
5. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
6. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
7. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
8. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
9. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
10. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
A total of 40 subgoals...
[PROOF STEP]
case "2_3"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoPlus v_ va_ vb_)
wf_dual n (CoZero b2_)
goal (40 subgoals):
1. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoPlus v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPlus v va vb) (CoZero b2))
2. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
3. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
4. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
5. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
6. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
7. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
8. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
9. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
10. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
A total of 40 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoPlus v_ va_ vb_)
wf_dual n (CoZero b2_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoPlus v_ va_ vb_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoPlus v_ va_ vb_) (CoZero b2_))
[PROOF STEP]
by (auto dest: lang_dual_subset_lists)
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoPlus v_ va_ vb_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoPlus v_ va_ vb_) (CoZero b2_))
goal (39 subgoals):
1. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
2. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
3. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
4. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
5. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
6. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
7. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
8. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
9. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
10. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
A total of 39 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (39 subgoals):
1. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
2. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
3. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
4. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
5. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
6. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
7. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
8. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
9. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
10. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
A total of 39 subgoals...
[PROOF STEP]
case "2_4"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoZero b2_)
goal (39 subgoals):
1. \<And>b1 v va vb b2. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoZero b2)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoZero b2))
2. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
3. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
4. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
5. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
6. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
7. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
8. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
9. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
10. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
A total of 39 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoZero b2_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoTimes v_ va_ vb_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoTimes v_ va_ vb_) (CoZero b2_))
[PROOF STEP]
by (auto dest!: lang_dual_subset_lists dest:
subsetD[OF conc_subset_lists, unfolded in_lists_conv_set, rotated -1])
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoTimes v_ va_ vb_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoTimes v_ va_ vb_) (CoZero b2_))
goal (38 subgoals):
1. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
2. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
3. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
4. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
5. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
6. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
7. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
8. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
9. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
10. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
A total of 38 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (38 subgoals):
1. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
2. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
3. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
4. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
5. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
6. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
7. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
8. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
9. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
10. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
A total of 38 subgoals...
[PROOF STEP]
case "2_5"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoZero b2_)
goal (38 subgoals):
1. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoStar v va) (CoZero b2))
2. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
3. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
4. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
5. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
6. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
7. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
8. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
9. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
10. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
A total of 38 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoZero b2_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoStar v_ va_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoStar v_ va_) (CoZero b2_))
[PROOF STEP]
by (auto dest!: lang_dual_subset_lists dest:
subsetD[OF star_subset_lists, unfolded in_lists_conv_set, rotated -1])
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoStar v_ va_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoStar v_ va_) (CoZero b2_))
goal (37 subgoals):
1. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
2. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
3. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
4. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
5. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
6. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
7. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
8. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
9. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
10. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
A total of 37 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (37 subgoals):
1. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
2. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
3. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
4. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
5. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
6. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
7. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
8. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
9. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
10. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
A total of 37 subgoals...
[PROOF STEP]
case "2_6"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoZero b2_)
goal (37 subgoals):
1. \<And>b1 v va b2. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoZero b2)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoZero b2)) = lang_dual n (CoPlus b1 (CoPr v va) (CoZero b2))
2. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
3. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
4. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
5. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
6. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
7. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
8. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
9. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
10. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
A total of 37 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoZero b2_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoPr v_ va_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoPr v_ va_) (CoZero b2_))
[PROOF STEP]
by (auto 4 4 dest!: lang_dual_subset_lists intro: project)
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoPr v_ va_) (CoZero b2_)) = lang_dual n (CoPlus b1_ (CoPr v_ va_) (CoZero b2_))
goal (36 subgoals):
1. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
2. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
3. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
4. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
5. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
6. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
7. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
8. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
9. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
10. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
A total of 36 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (36 subgoals):
1. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
2. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
3. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
4. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
5. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
6. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
7. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
8. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
9. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
10. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
A total of 36 subgoals...
[PROOF STEP]
case "3_1"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoOne v_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoOne v_)) = lang_dual n (CoPlus b2_ s_ (CoOne v_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoOne v_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoOne v_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoOne v_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoOne v_)
goal (36 subgoals):
1. \<And>b1 b2 r s v. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoOne v)) = lang_dual n (CoPlus b2 s (CoOne v)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoOne v))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoOne v))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoOne v))); wf_dual n (CoPlus b2 r s); wf_dual n (CoOne v)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoOne v)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoOne v))
2. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
3. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
4. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
5. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
6. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
7. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
8. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
9. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
10. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
A total of 36 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoOne v_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoOne v_)) = lang_dual n (CoPlus b2_ s_ (CoOne v_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoOne v_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoOne v_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoOne v_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoOne v_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoOne v_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoOne v_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoOne v_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoOne v_))
goal (35 subgoals):
1. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
2. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
3. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
4. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
5. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
6. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
7. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
8. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
9. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
10. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
A total of 35 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (35 subgoals):
1. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
2. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
3. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
4. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
5. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
6. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
7. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
8. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
9. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
10. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
A total of 35 subgoals...
[PROOF STEP]
case "3_2"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoAtom v_ va_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoAtom v_ va_)) = lang_dual n (CoPlus b2_ s_ (CoAtom v_ va_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoAtom v_ va_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoAtom v_ va_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoAtom v_ va_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoAtom v_ va_)
goal (35 subgoals):
1. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoAtom v va)) = lang_dual n (CoPlus b2 s (CoAtom v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoAtom v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoAtom v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoAtom v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoAtom v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoAtom v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoAtom v va))
2. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
3. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
4. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
5. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
6. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
7. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
8. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
9. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
10. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
A total of 35 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoAtom v_ va_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoAtom v_ va_)) = lang_dual n (CoPlus b2_ s_ (CoAtom v_ va_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoAtom v_ va_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoAtom v_ va_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoAtom v_ va_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoAtom v_ va_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoAtom v_ va_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoAtom v_ va_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoAtom v_ va_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoAtom v_ va_))
goal (34 subgoals):
1. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
2. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
3. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
4. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
5. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
6. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
7. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
8. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
9. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
10. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
A total of 34 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (34 subgoals):
1. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
2. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
3. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
4. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
5. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
6. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
7. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
8. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
9. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
10. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
A total of 34 subgoals...
[PROOF STEP]
case "3_3"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoPlus v_ va_ vb_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoPlus v_ va_ vb_)) = lang_dual n (CoPlus b2_ s_ (CoPlus v_ va_ vb_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoPlus v_ va_ vb_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoPlus v_ va_ vb_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoPlus v_ va_ vb_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoPlus v_ va_ vb_)
goal (34 subgoals):
1. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPlus v va vb)) = lang_dual n (CoPlus b2 s (CoPlus v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPlus v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPlus v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPlus v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPlus v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPlus v va vb))
2. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
3. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
4. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
5. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
6. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
7. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
8. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
9. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
10. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
A total of 34 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoPlus v_ va_ vb_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoPlus v_ va_ vb_)) = lang_dual n (CoPlus b2_ s_ (CoPlus v_ va_ vb_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoPlus v_ va_ vb_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoPlus v_ va_ vb_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoPlus v_ va_ vb_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoPlus v_ va_ vb_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoPlus v_ va_ vb_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoPlus v_ va_ vb_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoPlus v_ va_ vb_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoPlus v_ va_ vb_))
goal (33 subgoals):
1. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
2. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
3. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
4. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
5. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
6. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
7. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
8. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
9. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
A total of 33 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (33 subgoals):
1. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
2. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
3. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
4. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
5. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
6. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
7. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
8. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
9. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
A total of 33 subgoals...
[PROOF STEP]
case "3_4"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoTimes v_ va_ vb_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoTimes v_ va_ vb_)) = lang_dual n (CoPlus b2_ s_ (CoTimes v_ va_ vb_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoTimes v_ va_ vb_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoTimes v_ va_ vb_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoTimes v_ va_ vb_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoTimes v_ va_ vb_)
goal (33 subgoals):
1. \<And>b1 b2 r s v va vb. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoTimes v va vb)) = lang_dual n (CoPlus b2 s (CoTimes v va vb)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoTimes v va vb))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoTimes v va vb))); wf_dual n (CoPlus b2 r s); wf_dual n (CoTimes v va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoTimes v va vb)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoTimes v va vb))
2. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
3. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
4. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
5. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
6. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
7. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
8. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
9. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
A total of 33 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoTimes v_ va_ vb_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoTimes v_ va_ vb_)) = lang_dual n (CoPlus b2_ s_ (CoTimes v_ va_ vb_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoTimes v_ va_ vb_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoTimes v_ va_ vb_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoTimes v_ va_ vb_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoTimes v_ va_ vb_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoTimes v_ va_ vb_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoTimes v_ va_ vb_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoTimes v_ va_ vb_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoTimes v_ va_ vb_))
goal (32 subgoals):
1. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
2. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
3. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
4. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
5. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
6. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
7. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
8. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
A total of 32 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (32 subgoals):
1. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
2. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
3. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
4. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
5. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
6. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
7. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
8. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
A total of 32 subgoals...
[PROOF STEP]
case "3_5"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoStar v_ va_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoStar v_ va_)) = lang_dual n (CoPlus b2_ s_ (CoStar v_ va_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoStar v_ va_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoStar v_ va_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoStar v_ va_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoStar v_ va_)
goal (32 subgoals):
1. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoStar v va)) = lang_dual n (CoPlus b2 s (CoStar v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoStar v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoStar v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoStar v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoStar v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoStar v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoStar v va))
2. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
3. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
4. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
5. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
6. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
7. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
8. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
A total of 32 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoStar v_ va_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoStar v_ va_)) = lang_dual n (CoPlus b2_ s_ (CoStar v_ va_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoStar v_ va_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoStar v_ va_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoStar v_ va_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoStar v_ va_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoStar v_ va_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoStar v_ va_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoStar v_ va_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoStar v_ va_))
goal (31 subgoals):
1. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
2. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
3. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
4. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
5. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
6. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
7. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
A total of 31 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (31 subgoals):
1. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
2. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
3. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
4. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
5. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
6. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
7. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
A total of 31 subgoals...
[PROOF STEP]
case "3_6"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoPr v_ va_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoPr v_ va_)) = lang_dual n (CoPlus b2_ s_ (CoPr v_ va_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoPr v_ va_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoPr v_ va_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoPr v_ va_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoPr v_ va_)
goal (31 subgoals):
1. \<And>b1 b2 r s v va. \<lbrakk>\<lbrakk>b1 = b2; wf_dual n s; wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 s (CoPr v va)) = lang_dual n (CoPlus b2 s (CoPr v va)); \<lbrakk>b1 = b2; wf_dual n r; wf_dual n (pnCoPlus b2 s (CoPr v va))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 r (pnCoPlus b2 s (CoPr v va))) = lang_dual n (CoPlus b2 r (pnCoPlus b2 s (CoPr v va))); wf_dual n (CoPlus b2 r s); wf_dual n (CoPr v va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPlus b2 r s) (CoPr v va)) = lang_dual n (CoPlus b1 (CoPlus b2 r s) (CoPr v va))
2. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
3. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
4. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
5. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
6. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
7. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
A total of 31 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; wf_dual n s_; wf_dual n (CoPr v_ va_)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ s_ (CoPr v_ va_)) = lang_dual n (CoPlus b2_ s_ (CoPr v_ va_))
\<lbrakk>b1_ = b2_; wf_dual n r_; wf_dual n (pnCoPlus b2_ s_ (CoPr v_ va_))\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ r_ (pnCoPlus b2_ s_ (CoPr v_ va_))) = lang_dual n (CoPlus b2_ r_ (pnCoPlus b2_ s_ (CoPr v_ va_)))
wf_dual n (CoPlus b2_ r_ s_)
wf_dual n (CoPr v_ va_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoPr v_ va_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoPr v_ va_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoPlus b2_ r_ s_) (CoPr v_ va_)) = lang_dual n (CoPlus b1_ (CoPlus b2_ r_ s_) (CoPr v_ va_))
goal (30 subgoals):
1. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
2. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
3. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
4. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
5. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
6. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
A total of 30 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (30 subgoals):
1. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
2. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
3. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
4. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
5. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
6. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
A total of 30 subgoals...
[PROOF STEP]
case "4_1"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; CoOne v_ \<noteq> s_; \<not> CoOne v_ \<le> s_; wf_dual n (CoOne v_); wf_dual n t_\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ (CoOne v_) t_) = lang_dual n (CoPlus b2_ (CoOne v_) t_)
wf_dual n (CoOne v_)
wf_dual n (CoPlus b2_ s_ t_)
goal (30 subgoals):
1. \<And>b1 v b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoOne v \<noteq> s; \<not> CoOne v \<le> s; wf_dual n (CoOne v); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoOne v) t) = lang_dual n (CoPlus b2 (CoOne v) t); wf_dual n (CoOne v); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoOne v) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoOne v) (CoPlus b2 s t))
2. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
3. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
4. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
5. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
6. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
A total of 30 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; CoOne v_ \<noteq> s_; \<not> CoOne v_ \<le> s_; wf_dual n (CoOne v_); wf_dual n t_\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ (CoOne v_) t_) = lang_dual n (CoPlus b2_ (CoOne v_) t_)
wf_dual n (CoOne v_)
wf_dual n (CoPlus b2_ s_ t_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoOne v_) (CoPlus b2_ s_ t_)) = lang_dual n (CoPlus b1_ (CoOne v_) (CoPlus b2_ s_ t_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoOne v_) (CoPlus b2_ s_ t_)) = lang_dual n (CoPlus b1_ (CoOne v_) (CoPlus b2_ s_ t_))
goal (29 subgoals):
1. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
2. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
3. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
4. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
5. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
A total of 29 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (29 subgoals):
1. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
2. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
3. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
4. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
5. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
A total of 29 subgoals...
[PROOF STEP]
case "4_2"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; CoAtom v_ va_ \<noteq> s_; \<not> CoAtom v_ va_ \<le> s_; wf_dual n (CoAtom v_ va_); wf_dual n t_\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ (CoAtom v_ va_) t_) = lang_dual n (CoPlus b2_ (CoAtom v_ va_) t_)
wf_dual n (CoAtom v_ va_)
wf_dual n (CoPlus b2_ s_ t_)
goal (29 subgoals):
1. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoAtom v va \<noteq> s; \<not> CoAtom v va \<le> s; wf_dual n (CoAtom v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoAtom v va) t) = lang_dual n (CoPlus b2 (CoAtom v va) t); wf_dual n (CoAtom v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoAtom v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoAtom v va) (CoPlus b2 s t))
2. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
3. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
4. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
5. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
A total of 29 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; CoAtom v_ va_ \<noteq> s_; \<not> CoAtom v_ va_ \<le> s_; wf_dual n (CoAtom v_ va_); wf_dual n t_\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ (CoAtom v_ va_) t_) = lang_dual n (CoPlus b2_ (CoAtom v_ va_) t_)
wf_dual n (CoAtom v_ va_)
wf_dual n (CoPlus b2_ s_ t_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoAtom v_ va_) (CoPlus b2_ s_ t_)) = lang_dual n (CoPlus b1_ (CoAtom v_ va_) (CoPlus b2_ s_ t_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoAtom v_ va_) (CoPlus b2_ s_ t_)) = lang_dual n (CoPlus b1_ (CoAtom v_ va_) (CoPlus b2_ s_ t_))
goal (28 subgoals):
1. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
2. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
3. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
4. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
A total of 28 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (28 subgoals):
1. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
2. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
3. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
4. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
A total of 28 subgoals...
[PROOF STEP]
case "4_3"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; CoTimes v_ va_ vb_ \<noteq> s_; \<not> CoTimes v_ va_ vb_ \<le> s_; wf_dual n (CoTimes v_ va_ vb_); wf_dual n t_\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ (CoTimes v_ va_ vb_) t_) = lang_dual n (CoPlus b2_ (CoTimes v_ va_ vb_) t_)
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoPlus b2_ s_ t_)
goal (28 subgoals):
1. \<And>b1 v va vb b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoTimes v va vb \<noteq> s; \<not> CoTimes v va vb \<le> s; wf_dual n (CoTimes v va vb); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoTimes v va vb) t) = lang_dual n (CoPlus b2 (CoTimes v va vb) t); wf_dual n (CoTimes v va vb); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoTimes v va vb) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoTimes v va vb) (CoPlus b2 s t))
2. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
3. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
4. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
A total of 28 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; CoTimes v_ va_ vb_ \<noteq> s_; \<not> CoTimes v_ va_ vb_ \<le> s_; wf_dual n (CoTimes v_ va_ vb_); wf_dual n t_\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ (CoTimes v_ va_ vb_) t_) = lang_dual n (CoPlus b2_ (CoTimes v_ va_ vb_) t_)
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoPlus b2_ s_ t_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoTimes v_ va_ vb_) (CoPlus b2_ s_ t_)) = lang_dual n (CoPlus b1_ (CoTimes v_ va_ vb_) (CoPlus b2_ s_ t_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoTimes v_ va_ vb_) (CoPlus b2_ s_ t_)) = lang_dual n (CoPlus b1_ (CoTimes v_ va_ vb_) (CoPlus b2_ s_ t_))
goal (27 subgoals):
1. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
2. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
3. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
A total of 27 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (27 subgoals):
1. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
2. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
3. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
A total of 27 subgoals...
[PROOF STEP]
case "4_4"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; CoStar v_ va_ \<noteq> s_; \<not> CoStar v_ va_ \<le> s_; wf_dual n (CoStar v_ va_); wf_dual n t_\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ (CoStar v_ va_) t_) = lang_dual n (CoPlus b2_ (CoStar v_ va_) t_)
wf_dual n (CoStar v_ va_)
wf_dual n (CoPlus b2_ s_ t_)
goal (27 subgoals):
1. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoStar v va \<noteq> s; \<not> CoStar v va \<le> s; wf_dual n (CoStar v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoStar v va) t) = lang_dual n (CoPlus b2 (CoStar v va) t); wf_dual n (CoStar v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoStar v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoStar v va) (CoPlus b2 s t))
2. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
3. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
A total of 27 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; CoStar v_ va_ \<noteq> s_; \<not> CoStar v_ va_ \<le> s_; wf_dual n (CoStar v_ va_); wf_dual n t_\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ (CoStar v_ va_) t_) = lang_dual n (CoPlus b2_ (CoStar v_ va_) t_)
wf_dual n (CoStar v_ va_)
wf_dual n (CoPlus b2_ s_ t_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoStar v_ va_) (CoPlus b2_ s_ t_)) = lang_dual n (CoPlus b1_ (CoStar v_ va_) (CoPlus b2_ s_ t_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoStar v_ va_) (CoPlus b2_ s_ t_)) = lang_dual n (CoPlus b1_ (CoStar v_ va_) (CoPlus b2_ s_ t_))
goal (26 subgoals):
1. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
2. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
A total of 26 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (26 subgoals):
1. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
2. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
A total of 26 subgoals...
[PROOF STEP]
case "4_5"
[PROOF STATE]
proof (state)
this:
\<lbrakk>b1_ = b2_; CoPr v_ va_ \<noteq> s_; \<not> CoPr v_ va_ \<le> s_; wf_dual n (CoPr v_ va_); wf_dual n t_\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ (CoPr v_ va_) t_) = lang_dual n (CoPlus b2_ (CoPr v_ va_) t_)
wf_dual n (CoPr v_ va_)
wf_dual n (CoPlus b2_ s_ t_)
goal (26 subgoals):
1. \<And>b1 v va b2 s t. \<lbrakk>\<lbrakk>b1 = b2; CoPr v va \<noteq> s; \<not> CoPr v va \<le> s; wf_dual n (CoPr v va); wf_dual n t\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2 (CoPr v va) t) = lang_dual n (CoPlus b2 (CoPr v va) t); wf_dual n (CoPr v va); wf_dual n (CoPlus b2 s t)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b1 (CoPr v va) (CoPlus b2 s t)) = lang_dual n (CoPlus b1 (CoPr v va) (CoPlus b2 s t))
2. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
A total of 26 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
\<lbrakk>b1_ = b2_; CoPr v_ va_ \<noteq> s_; \<not> CoPr v_ va_ \<le> s_; wf_dual n (CoPr v_ va_); wf_dual n t_\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b2_ (CoPr v_ va_) t_) = lang_dual n (CoPlus b2_ (CoPr v_ va_) t_)
wf_dual n (CoPr v_ va_)
wf_dual n (CoPlus b2_ s_ t_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b1_ (CoPr v_ va_) (CoPlus b2_ s_ t_)) = lang_dual n (CoPlus b1_ (CoPr v_ va_) (CoPlus b2_ s_ t_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b1_ (CoPr v_ va_) (CoPlus b2_ s_ t_)) = lang_dual n (CoPlus b1_ (CoPr v_ va_) (CoPlus b2_ s_ t_))
goal (25 subgoals):
1. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
A total of 25 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (25 subgoals):
1. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
A total of 25 subgoals...
[PROOF STEP]
case "5_1"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoOne v_)
wf_dual n (CoOne va_)
goal (25 subgoals):
1. \<And>b v va. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoOne va)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoOne va)) = lang_dual n (CoPlus b (CoOne v) (CoOne va))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
A total of 25 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoOne v_)
wf_dual n (CoOne va_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoOne v_) (CoOne va_)) = lang_dual n (CoPlus b_ (CoOne v_) (CoOne va_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoOne v_) (CoOne va_)) = lang_dual n (CoPlus b_ (CoOne v_) (CoOne va_))
goal (24 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
A total of 24 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (24 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
A total of 24 subgoals...
[PROOF STEP]
case "5_2"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoOne v_)
wf_dual n (CoAtom va_ vb_)
goal (24 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoAtom va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoAtom va vb)) = lang_dual n (CoPlus b (CoOne v) (CoAtom va vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
A total of 24 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoOne v_)
wf_dual n (CoAtom va_ vb_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoOne v_) (CoAtom va_ vb_)) = lang_dual n (CoPlus b_ (CoOne v_) (CoAtom va_ vb_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoOne v_) (CoAtom va_ vb_)) = lang_dual n (CoPlus b_ (CoOne v_) (CoAtom va_ vb_))
goal (23 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
A total of 23 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (23 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
A total of 23 subgoals...
[PROOF STEP]
case "5_3"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoOne v_)
wf_dual n (CoTimes va_ vb_ vc_)
goal (23 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoTimes va vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoTimes va vb vc)) = lang_dual n (CoPlus b (CoOne v) (CoTimes va vb vc))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
A total of 23 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoOne v_)
wf_dual n (CoTimes va_ vb_ vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoOne v_) (CoTimes va_ vb_ vc_)) = lang_dual n (CoPlus b_ (CoOne v_) (CoTimes va_ vb_ vc_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoOne v_) (CoTimes va_ vb_ vc_)) = lang_dual n (CoPlus b_ (CoOne v_) (CoTimes va_ vb_ vc_))
goal (22 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
10. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
A total of 22 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (22 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
10. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
A total of 22 subgoals...
[PROOF STEP]
case "5_4"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoOne v_)
wf_dual n (CoStar va_ vb_)
goal (22 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoStar va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoStar va vb)) = lang_dual n (CoPlus b (CoOne v) (CoStar va vb))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
10. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
A total of 22 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoOne v_)
wf_dual n (CoStar va_ vb_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoOne v_) (CoStar va_ vb_)) = lang_dual n (CoPlus b_ (CoOne v_) (CoStar va_ vb_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoOne v_) (CoStar va_ vb_)) = lang_dual n (CoPlus b_ (CoOne v_) (CoStar va_ vb_))
goal (21 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
9. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
A total of 21 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (21 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
9. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
A total of 21 subgoals...
[PROOF STEP]
case "5_5"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoOne v_)
wf_dual n (CoPr va_ vb_)
goal (21 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoOne v); wf_dual n (CoPr va vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoOne v) (CoPr va vb)) = lang_dual n (CoPlus b (CoOne v) (CoPr va vb))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
9. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
A total of 21 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoOne v_)
wf_dual n (CoPr va_ vb_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoOne v_) (CoPr va_ vb_)) = lang_dual n (CoPlus b_ (CoOne v_) (CoPr va_ vb_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoOne v_) (CoPr va_ vb_)) = lang_dual n (CoPlus b_ (CoOne v_) (CoPr va_ vb_))
goal (20 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
8. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
A total of 20 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (20 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
8. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
A total of 20 subgoals...
[PROOF STEP]
case "5_6"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoOne vb_)
goal (20 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoOne vb)) = lang_dual n (CoPlus b (CoAtom v va) (CoOne vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
8. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
A total of 20 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoOne vb_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoAtom v_ va_) (CoOne vb_)) = lang_dual n (CoPlus b_ (CoAtom v_ va_) (CoOne vb_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoAtom v_ va_) (CoOne vb_)) = lang_dual n (CoPlus b_ (CoAtom v_ va_) (CoOne vb_))
goal (19 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
7. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
A total of 19 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (19 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
7. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
A total of 19 subgoals...
[PROOF STEP]
case "5_7"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoAtom vb_ vc_)
goal (19 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoAtom vb vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
7. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
A total of 19 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoAtom vb_ vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoAtom v_ va_) (CoAtom vb_ vc_)) = lang_dual n (CoPlus b_ (CoAtom v_ va_) (CoAtom vb_ vc_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoAtom v_ va_) (CoAtom vb_ vc_)) = lang_dual n (CoPlus b_ (CoAtom v_ va_) (CoAtom vb_ vc_))
goal (18 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
6. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
A total of 18 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (18 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
6. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
A total of 18 subgoals...
[PROOF STEP]
case "5_8"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoTimes vb_ vc_ vd_)
goal (18 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoAtom v va) (CoTimes vb vc vd))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
6. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
A total of 18 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoTimes vb_ vc_ vd_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoAtom v_ va_) (CoTimes vb_ vc_ vd_)) = lang_dual n (CoPlus b_ (CoAtom v_ va_) (CoTimes vb_ vc_ vd_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoAtom v_ va_) (CoTimes vb_ vc_ vd_)) = lang_dual n (CoPlus b_ (CoAtom v_ va_) (CoTimes vb_ vc_ vd_))
goal (17 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
5. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
A total of 17 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (17 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
5. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
A total of 17 subgoals...
[PROOF STEP]
case "5_9"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoStar vb_ vc_)
goal (17 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoStar vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
5. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
A total of 17 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoStar vb_ vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoAtom v_ va_) (CoStar vb_ vc_)) = lang_dual n (CoPlus b_ (CoAtom v_ va_) (CoStar vb_ vc_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoAtom v_ va_) (CoStar vb_ vc_)) = lang_dual n (CoPlus b_ (CoAtom v_ va_) (CoStar vb_ vc_))
goal (16 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
4. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
A total of 16 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (16 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
4. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
A total of 16 subgoals...
[PROOF STEP]
case "5_10"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoPr vb_ vc_)
goal (16 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoAtom v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoAtom v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoAtom v va) (CoPr vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
4. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
A total of 16 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoAtom v_ va_)
wf_dual n (CoPr vb_ vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoAtom v_ va_) (CoPr vb_ vc_)) = lang_dual n (CoPlus b_ (CoAtom v_ va_) (CoPr vb_ vc_))
[PROOF STEP]
by auto (metis (no_types, opaque_lifting) Cons_in_lists_iff Diff_iff imageI list.simps(8) list.simps(9) lists.Nil)+
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoAtom v_ va_) (CoPr vb_ vc_)) = lang_dual n (CoPlus b_ (CoAtom v_ va_) (CoPr vb_ vc_))
goal (15 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
3. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
A total of 15 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (15 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
3. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
A total of 15 subgoals...
[PROOF STEP]
case "5_11"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoOne vc_)
goal (15 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoOne vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoOne vc)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoOne vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
3. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
A total of 15 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoOne vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoTimes v_ va_ vb_) (CoOne vc_)) = lang_dual n (CoPlus b_ (CoTimes v_ va_ vb_) (CoOne vc_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoTimes v_ va_ vb_) (CoOne vc_)) = lang_dual n (CoPlus b_ (CoTimes v_ va_ vb_) (CoOne vc_))
goal (14 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
2. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
A total of 14 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (14 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
2. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
A total of 14 subgoals...
[PROOF STEP]
case "5_12"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoAtom vc_ vd_)
goal (14 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoAtom vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoAtom vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoAtom vc vd))
2. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
10. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
A total of 14 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoAtom vc_ vd_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoTimes v_ va_ vb_) (CoAtom vc_ vd_)) = lang_dual n (CoPlus b_ (CoTimes v_ va_ vb_) (CoAtom vc_ vd_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoTimes v_ va_ vb_) (CoAtom vc_ vd_)) = lang_dual n (CoPlus b_ (CoTimes v_ va_ vb_) (CoAtom vc_ vd_))
goal (13 subgoals):
1. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
A total of 13 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (13 subgoals):
1. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
A total of 13 subgoals...
[PROOF STEP]
case "5_13"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoTimes vc_ vd_ ve_)
goal (13 subgoals):
1. \<And>b v va vb vc vd ve. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoTimes vc vd ve)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoTimes vc vd ve)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoTimes vc vd ve))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
9. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
A total of 13 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoTimes vc_ vd_ ve_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoTimes v_ va_ vb_) (CoTimes vc_ vd_ ve_)) = lang_dual n (CoPlus b_ (CoTimes v_ va_ vb_) (CoTimes vc_ vd_ ve_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoTimes v_ va_ vb_) (CoTimes vc_ vd_ ve_)) = lang_dual n (CoPlus b_ (CoTimes v_ va_ vb_) (CoTimes vc_ vd_ ve_))
goal (12 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
A total of 12 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (12 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
A total of 12 subgoals...
[PROOF STEP]
case "5_14"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoStar vc_ vd_)
goal (12 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoStar vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoStar vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoStar vc vd))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
8. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
10. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
A total of 12 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoStar vc_ vd_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoTimes v_ va_ vb_) (CoStar vc_ vd_)) = lang_dual n (CoPlus b_ (CoTimes v_ va_ vb_) (CoStar vc_ vd_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoTimes v_ va_ vb_) (CoStar vc_ vd_)) = lang_dual n (CoPlus b_ (CoTimes v_ va_ vb_) (CoStar vc_ vd_))
goal (11 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
A total of 11 subgoals...
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (11 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
A total of 11 subgoals...
[PROOF STEP]
case "5_15"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoPr vc_ vd_)
goal (11 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoTimes v va vb); wf_dual n (CoPr vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoTimes v va vb) (CoPr vc vd)) = lang_dual n (CoPlus b (CoTimes v va vb) (CoPr vc vd))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
7. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
9. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
A total of 11 subgoals...
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoTimes v_ va_ vb_)
wf_dual n (CoPr vc_ vd_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoTimes v_ va_ vb_) (CoPr vc_ vd_)) = lang_dual n (CoPlus b_ (CoTimes v_ va_ vb_) (CoPr vc_ vd_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoTimes v_ va_ vb_) (CoPr vc_ vd_)) = lang_dual n (CoPlus b_ (CoTimes v_ va_ vb_) (CoPr vc_ vd_))
goal (10 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (10 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
case "5_16"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoOne vb_)
goal (10 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoOne vb)) = lang_dual n (CoPlus b (CoStar v va) (CoOne vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
6. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
8. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
10. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoOne vb_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoStar v_ va_) (CoOne vb_)) = lang_dual n (CoPlus b_ (CoStar v_ va_) (CoOne vb_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoStar v_ va_) (CoOne vb_)) = lang_dual n (CoPlus b_ (CoStar v_ va_) (CoOne vb_))
goal (9 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (9 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
case "5_17"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoAtom vb_ vc_)
goal (9 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoAtom vb vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
5. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
7. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
9. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoAtom vb_ vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoStar v_ va_) (CoAtom vb_ vc_)) = lang_dual n (CoPlus b_ (CoStar v_ va_) (CoAtom vb_ vc_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoStar v_ va_) (CoAtom vb_ vc_)) = lang_dual n (CoPlus b_ (CoStar v_ va_) (CoAtom vb_ vc_))
goal (8 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (8 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
case "5_18"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoTimes vb_ vc_ vd_)
goal (8 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoStar v va) (CoTimes vb vc vd))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
4. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
6. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
8. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoTimes vb_ vc_ vd_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoStar v_ va_) (CoTimes vb_ vc_ vd_)) = lang_dual n (CoPlus b_ (CoStar v_ va_) (CoTimes vb_ vc_ vd_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoStar v_ va_) (CoTimes vb_ vc_ vd_)) = lang_dual n (CoPlus b_ (CoStar v_ va_) (CoTimes vb_ vc_ vd_))
goal (7 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (7 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
case "5_19"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoStar vb_ vc_)
goal (7 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoStar vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
3. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
5. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
7. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoStar vb_ vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoStar v_ va_) (CoStar vb_ vc_)) = lang_dual n (CoPlus b_ (CoStar v_ va_) (CoStar vb_ vc_))
[PROOF STEP]
by (auto dest!: lang_dual_subset_lists dest:
subsetD[OF star_subset_lists, unfolded in_lists_conv_set, rotated -1])
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoStar v_ va_) (CoStar vb_ vc_)) = lang_dual n (CoPlus b_ (CoStar v_ va_) (CoStar vb_ vc_))
goal (6 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (6 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
case "5_20"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoPr vb_ vc_)
goal (6 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoStar v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoStar v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoStar v va) (CoPr vb vc))
2. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
4. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
6. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoStar v_ va_)
wf_dual n (CoPr vb_ vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoStar v_ va_) (CoPr vb_ vc_)) = lang_dual n (CoPlus b_ (CoStar v_ va_) (CoPr vb_ vc_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoStar v_ va_) (CoPr vb_ vc_)) = lang_dual n (CoPlus b_ (CoStar v_ va_) (CoPr vb_ vc_))
goal (5 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (5 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
case "5_21"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoOne vb_)
goal (5 subgoals):
1. \<And>b v va vb. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoOne vb)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoOne vb)) = lang_dual n (CoPlus b (CoPr v va) (CoOne vb))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
3. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
5. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoOne vb_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoPr v_ va_) (CoOne vb_)) = lang_dual n (CoPlus b_ (CoPr v_ va_) (CoOne vb_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoPr v_ va_) (CoOne vb_)) = lang_dual n (CoPlus b_ (CoPr v_ va_) (CoOne vb_))
goal (4 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (4 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
case "5_22"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoAtom vb_ vc_)
goal (4 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoAtom vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoAtom vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoAtom vb vc))
2. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
4. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoAtom vb_ vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoPr v_ va_) (CoAtom vb_ vc_)) = lang_dual n (CoPlus b_ (CoPr v_ va_) (CoAtom vb_ vc_))
[PROOF STEP]
by auto (metis (no_types, opaque_lifting) Cons_in_lists_iff Diff_iff imageI list.simps(8) list.simps(9) lists.Nil)+
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoPr v_ va_) (CoAtom vb_ vc_)) = lang_dual n (CoPlus b_ (CoPr v_ va_) (CoAtom vb_ vc_))
goal (3 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (3 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
case "5_23"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoTimes vb_ vc_ vd_)
goal (3 subgoals):
1. \<And>b v va vb vc vd. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoTimes vb vc vd)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoTimes vb vc vd)) = lang_dual n (CoPlus b (CoPr v va) (CoTimes vb vc vd))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
3. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoTimes vb_ vc_ vd_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoPr v_ va_) (CoTimes vb_ vc_ vd_)) = lang_dual n (CoPlus b_ (CoPr v_ va_) (CoTimes vb_ vc_ vd_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoPr v_ va_) (CoTimes vb_ vc_ vd_)) = lang_dual n (CoPlus b_ (CoPr v_ va_) (CoTimes vb_ vc_ vd_))
goal (2 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
case "5_24"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoStar vb_ vc_)
goal (2 subgoals):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoStar vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoStar vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoStar vb vc))
2. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoStar vb_ vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoPr v_ va_) (CoStar vb_ vc_)) = lang_dual n (CoPlus b_ (CoPr v_ va_) (CoStar vb_ vc_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoPr v_ va_) (CoStar vb_ vc_)) = lang_dual n (CoPlus b_ (CoPr v_ va_) (CoStar vb_ vc_))
goal (1 subgoal):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
next
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
case "5_25"
[PROOF STATE]
proof (state)
this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoPr vb_ vc_)
goal (1 subgoal):
1. \<And>b v va vb vc. \<lbrakk>wf_dual n (CoPr v va); wf_dual n (CoPr vb vc)\<rbrakk> \<Longrightarrow> lang_dual n (pnCoPlus b (CoPr v va) (CoPr vb vc)) = lang_dual n (CoPlus b (CoPr v va) (CoPr vb vc))
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
wf_dual n (CoPr v_ va_)
wf_dual n (CoPr vb_ vc_)
goal (1 subgoal):
1. lang_dual n (pnCoPlus b_ (CoPr v_ va_) (CoPr vb_ vc_)) = lang_dual n (CoPlus b_ (CoPr v_ va_) (CoPr vb_ vc_))
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
lang_dual n (pnCoPlus b_ (CoPr v_ va_) (CoPr vb_ vc_)) = lang_dual n (CoPlus b_ (CoPr v_ va_) (CoPr vb_ vc_))
goal:
No subgoals!
[PROOF STEP]
qed
|
[STATEMENT]
lemma nat_to_sch_6: "c_fst n mod 7 = 6 \<Longrightarrow> nat_to_sch n = Rec_op (nat_to_sch (c_fst (c_snd n))) (nat_to_sch (c_snd (c_snd n)))"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. c_fst n mod 7 = 6 \<Longrightarrow> nat_to_sch n = Rec_op (nat_to_sch (c_fst (c_snd n))) (nat_to_sch (c_snd (c_snd n)))
[PROOF STEP]
proof -
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. c_fst n mod 7 = 6 \<Longrightarrow> nat_to_sch n = Rec_op (nat_to_sch (c_fst (c_snd n))) (nat_to_sch (c_snd (c_snd n)))
[PROOF STEP]
assume A1: "c_fst n mod 7 = 6"
[PROOF STATE]
proof (state)
this:
c_fst n mod 7 = 6
goal (1 subgoal):
1. c_fst n mod 7 = 6 \<Longrightarrow> nat_to_sch n = Rec_op (nat_to_sch (c_fst (c_snd n))) (nat_to_sch (c_snd (c_snd n)))
[PROOF STEP]
then
[PROOF STATE]
proof (chain)
picking this:
c_fst n mod 7 = 6
[PROOF STEP]
have "nat_to_sch n = (let u=(c_fst n) mod 7; v=c_snd n; v1=c_fst v; v2 = c_snd v; sch1=nat_to_sch v1; sch2=nat_to_sch v2 in loc_f u sch1 sch2)"
[PROOF STATE]
proof (prove)
using this:
c_fst n mod 7 = 6
goal (1 subgoal):
1. nat_to_sch n = (let u = c_fst n mod 7; v = c_snd n; v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1))
[PROOF STEP]
by (simp add: loc_lm_2)
[PROOF STATE]
proof (state)
this:
nat_to_sch n = (let u = c_fst n mod 7; v = c_snd n; v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1))
goal (1 subgoal):
1. c_fst n mod 7 = 6 \<Longrightarrow> nat_to_sch n = Rec_op (nat_to_sch (c_fst (c_snd n))) (nat_to_sch (c_snd (c_snd n)))
[PROOF STEP]
with A1
[PROOF STATE]
proof (chain)
picking this:
c_fst n mod 7 = 6
nat_to_sch n = (let u = c_fst n mod 7; v = c_snd n; v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1))
[PROOF STEP]
show "nat_to_sch n = Rec_op (nat_to_sch (c_fst (c_snd n))) (nat_to_sch (c_snd (c_snd n)))"
[PROOF STATE]
proof (prove)
using this:
c_fst n mod 7 = 6
nat_to_sch n = (let u = c_fst n mod 7; v = c_snd n; v1 = c_fst v; v2 = c_snd v; sch1 = nat_to_sch v1 in Let (nat_to_sch v2) (loc_f u sch1))
goal (1 subgoal):
1. nat_to_sch n = Rec_op (nat_to_sch (c_fst (c_snd n))) (nat_to_sch (c_snd (c_snd n)))
[PROOF STEP]
by (simp add: Let_def loc_f_def)
[PROOF STATE]
proof (state)
this:
nat_to_sch n = Rec_op (nat_to_sch (c_fst (c_snd n))) (nat_to_sch (c_snd (c_snd n)))
goal:
No subgoals!
[PROOF STEP]
qed
|
# Copyright (c) 2018-2021, Carnegie Mellon University
# See LICENSE for details
Declare(DFT_Rader, DFT_GoodThomas);
_accurate_dft := vec -> List(TransposedMat(MatSPL(transforms.DFT(Length(vec)))*TransposedMat([vec]))[1], ComplexCyc);
Class(fdft, FuncExp, rec(
computeType := self >> self.args[1].t
));
Class(fDFT, DiagFunc, rec(
abbrevs := [ func -> Checked(IsFunction(func), [func]) ],
range := self >> TComplex,
domain := self >> self.params[1].domain(),
lambda := self >> fdft(self.params[1].lambda()),
tolist := self >> let(
elts := List(self.params[1].tolist(), x->Complex(EvalScalar(x))),
ComplexFFT(elts))
));
NewRulesFor(DFT, rec(
#F DFT_Base: DFT_2 = F_2
#F
DFT_Base := rec(
info := "DFT_2 -> F_2",
forTransposition := false,
applicable := nt -> nt.params[1] = 2 and not nt.hasTags(),
apply := (nt, C, cnt) -> F(2)
),
DFT_Base1 := rec(
info := "DFT_1 -> I(1)",
forTransposition := false,
applicable := nt -> nt.params[1] = 1 and not nt.hasTags(),
apply := (nt, C, cnt) -> I(1)
),
#F DFT_Canonize: DFT_n_k = perm * DFT_n
#F
DFT_Canonize := rec(
switch := false,
info := "DFT_n_k -> perm * DFT_n",
forTransposition := false,
applicable := nt -> nt.params[1] > 2 and nt.params[2] <> 1 and not nt.hasTags(),
children := nt -> [[ DFT(nt.params[1], 1) ]],
apply := (nt, C, cnt) -> OddStride(nt.params[1], nt.params[2]) * C[1]
),
#F DFT_CT: 1965
#F General Cooley-Tukey Rule
#F DFT_n = (DFT_n/d tensor I_d) * diag * (I_n/d tensor F_d) * perm
#F
#F Cooley/Tukey:
#F An Algorithm for the Machine Calculation of Complex Fourier Series.
#F Mathematics of Computation, Vol. 19, 1965, pp. 297--301.
#F
DFT_CT := rec(
info := "DFT(mn,k) -> DFT(m, k%m), DFT(n, k%n)",
maxSize := false,
forcePrimeFactor := false,
applicable := (self, nt) >> nt.params[1] > 2
and not nt.hasTags()
and (self.maxSize=false or nt.params[1] <= self.maxSize)
and not IsPrime(nt.params[1])
and When(self.forcePrimeFactor, not DFT_GoodThomas.applicable(nt), true),
children := nt -> Map2(DivisorPairs(nt.params[1]),
(m,n) -> [ DFT(m, nt.params[2] mod m), DFT(n, nt.params[2] mod n) ]
),
apply := (nt, C, cnt) -> let(mn := nt.params[1], m := Rows(C[1]), n := Rows(C[2]),
Tensor(C[1], I(n)) *
Diag(fPrecompute(Tw1(mn, n, nt.params[2]))) *
Tensor(I(m), C[2]) *
L(mn, m)
)
),
DFT_CT_Mincost := rec(
maxSize := false,
applicable := (self, nt) >> let(N := nt.params[1],
N > 2 and not nt.hasTags() and IsEvenInt(N) and
(self.maxSize = false or nt.params[1] <= self.maxSize)),
children := nt -> let(N := nt.params[1], k := nt.params[2], Map2(
Filtered(DivisorPairs(N), divpair -> IsEvenInt(divpair[2])),
(m,n) -> [ DFT(m, k mod m), DFT3(m, k mod (2*m)), DFT(n, k mod n) ])),
apply := (nt, C, cnt) -> let(
N := nt.params[1], m := Rows(C[1]), n := Rows(C[3]), k := nt.params[2],
hf := (n-2)/2, i := Ind(hf), j := Ind(hf),
SUM( _hhi(N, m, 0, n, C[1]), # first iteration has no twiddles
When(hf=0, [],
ISum(i, _hhi(N, m, i+1, n, C[1] * Diag(fPrecompute(Twid(N,m,k,0,0,i+1)))))),
_hhi(N, m, hf+1, n, C[2]), # middle is a DFT3
When(hf=0, [],
ISum(j, _hhi(N, m, j+hf+2, n, C[1] * Diag(fPrecompute(Twid(N,m,k,0,0,j+2+hf))))))
) *
Tensor(I(m), C[3]) *
Tr(n, m)
)
),
#F DFT_CosSinSplit:
#F
#F DFT_n = CosDFT_n + i * SinDFT_n
#F
#F This rule has been restricted in applicability to small size
#F (see config.g), Connects to Vetterli rules for CosDFT/SinDFT.
#F
DFT_CosSinSplit := rec(
info := "DFT_n -> CosDFT_n, SinDFT_n",
forTransposition := false,
maxSize := 64,
applicable := (self, nt) >> let(N:=nt.params[1], rot:=nt.params[2],
N > 2 and N <= self.maxSize and Is2Power(N) and AbsInt(rot)=1
and not nt.hasTags()),
children := nt -> [[ CosDFT(nt.params[1]), SinDFT(nt.params[1]) ]],
apply := (nt, C, cnt) -> let(N := nt.params[1], rot := nt.params[2],
Tensor(Mat([[1,1]]), I(N)) *
VStack(C[1], (E(4)^rot) * C[2])
)
),
#F DFT_Rader: Rader's Algorithm for Prime size DFT
#F
#F DFT(p) -> P(g)' * (1 dirsum DFT(p-1)) * Tp * (1 dirsum DFT(p-1)) * P(g)",
#F P(g) = perm
#F Tp = [[1,1],[1,-1/(p-1)]] dirsum diag
#F
DFT_Rader := rec(
info := "DFT(p) -> P(g)' * DFT(p-1) * Tp ",
forTransposition := false,
minSize := 3,
maxSize := 64,
accurate := true,
raderDiag := (self, N, k, root) >> let(
dft := When(self.accurate, _accurate_dft, vec->ComplexFFT(List(vec,ComplexCyc))),
SubList(dft(List([0..N-2], x -> E(N)^(k*root^x mod N))), 2) / (N-1)),
raderMid := (self, N, k, root) >>
DirectSum(Mat([[1, 1], [1, -1/(N-1)]]),
Diag(FData(self.raderDiag(N, k, root)))),
applicable := (self, nt) >> let(n:=nt.params[1],
n >= self.minSize and n <= self.maxSize and IsPrime(EvalScalar(n))
and not nt.hasTags()),
children := nt -> [[ DFT(nt.params[1]-1, -1), DFT(nt.params[1]-1, -1) ]],
apply := (self, nt, C, cnt) >> let(
N := EvalScalar(nt.params[1]), k := EvalScalar(nt.params[2]), root := PrimitiveRootMod(N),
RR(N, 1, root).transpose() *
DirectSum(I(1), C[1]) *
self.raderMid(N,k,root) *
DirectSum(I(1), C[2]) *
RR(N, 1, root)
)
),
DFT_RealRader := CopyFields(~.DFT_Rader, rec(
children := nt -> [[ PRDFT1(nt.params[1]-1).transpose(), PRDFT1(nt.params[1]-1) ]],
realRaderDiag := (self, N, k, root) >> let(cdiag := self.raderDiag(N, k, root),
# cdiag is of length N-2.
# cdiag = sublist( DFT_{N-1} * omega_vector, [2..N-1])
# now we want to obtain
# rdiag = sublist( RDFT_N * omega_vector, [2..N-1]), we can do this using
# the property RDFT = (1 dirsum (I tensor [[1, 1], [-j, j]]) dirsum 1) * LIJ * DFT
# which means that rdiag = (1 dirsum (I tensor [[1, 1], [-j, j]]) dirsum 1) * LIJ * cdiag
# the code below does this ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ plus pads a zero (for PRDFT)
# and also the following trick.
# The expected rdiag steady state is [[a, b], [b, -a]], we convert this to rotations (=RCDiag)
# by applying J(2), ie we get [[b, -a], [a, b]], which would be a rotation by b + E(4)*a,
# but in this case both a and b are complex, so its not. We still use RCDiag though.
#
Concatenation(
ConcatList([1..(N-3)/2], i -> Reversed([cdiag[i]+cdiag[N-1-i], -E(4)*(cdiag[i]-cdiag[N-1-i])])), # DFT->RDFT
[0, cdiag[(N-3)/2+1]])),
raderMid := (self, N, k, root) >>
DirectSum(Mat([[1, 1, 0], [1, -1/(N-1), 0], [0, 0, 0]]), # zero padding for PRDFT
Tensor(I((N-1)/2), J(2))*
RCDiag(FData(self.realRaderDiag(N, k, root))).toloop()),
# RCDiag with complex entries, max weird :) !
# .toloop() is used because in vector code RCDiag is
# converted to VRCDiag which is confused by complex entries AFAIK
apply := (self,nt,C,cnt) >> let(
N := EvalScalar(nt.params[1]), k := EvalScalar(nt.params[2]), root := PrimitiveRootMod(N),
RR(N, 1, root).transpose() *
DirectSum(I(1), C[1]) *
self.raderMid(N,k,root) *
DirectSum(I(1), C[2]) *
RR(N, 1, root))
)),
#F DFT_Bluestein : Convert FFT to Toeplitz matrix, then embed in a larger Circulant
#F
#F DFT_n -> diag * Toeplitz * diag
#F
# DFT on inputs, some of which are 0:
#
DFT_Bluestein := rec(
info := "DFT_n -> diag * Toeplitz * diag",
forTransposition := false,
minSize := 3,
maxSize := false,
switch := false,
# Applicable only for non-powers of 2 to prevent cycles
applicable := (self, nt) >> let(N := nt.params[1],
IsSymbolic(N) or
(N >= self.minSize and When(IsInt(self.maxSize), N <= self.maxSize, true) and not Is2Power(N)
and not nt.hasTags())),
# NOTE: extend this to be a true degree of freedom
freedoms := t -> let(min := 2*t.params[1]+1,
[ integersBetween(min, 4 * pow(2, floor(log(t.params[1])/log(2)))) ]),
child := (t, fr) -> let(
N := t.params[1], Ncirc := fr[1],
[ DFT(Ncirc, -1).withTags(t.getTags()), DFT(Ncirc, 1).withTags(t.getTags()) ]),
diag := (N, k) -> let(i:=Ind(N), Lambda(i, omegapi(fdiv(i^2 * k, N)))),
circ := (N, k, circsize) -> let(
j1 := Ind(N),
j2 := Ind(N-1),
diagDirsum(
Lambda(j1, fdiv(omegapi(fdiv(-j1^2*k, N)), circsize)),
fConst(TReal, circsize-2*N+1, 0),
Lambda(j2, fdiv(omegapi(fdiv(-(N-j2-1)^2*k, N)), circsize)))),
apply := (self, nt, C, cnt) >> let(
N := nt.params[1],
k := nt.params[2],
Ncirc := Rows(C[1]),
diag := fPrecompute(self.diag(N,k)),
pad := spiral.paradigms.common.TRDiag(Ncirc, N, diag).withTags(nt.getTags()),
#Diag(diag) * Gath(fCompose(fAdd(Ncirc, N, 0))).toloop(1) *
pad.transpose() *
Inplace(Grp(C[1] * Diag(fPrecompute(fDFT(self.circ(N, k, Ncirc)))))) *
Inplace(C[2]) *
pad
#Scat(fAdd(Ncirc, N, 0)).toloop(1) * Diag(diag) ##, O(Ncirc-N, N))
)
),
#F DFT_GoodThomas : Prime Factor FFT
#F
#F DFT_n*k -> perm * (DFT_n_a tensor DFT_k_b) * perm
#F when gcd(n,k) = 1
#F
DFT_GoodThomas := rec(
info := "DFT_n*k -> perm * (DFT_n_a tensor DFT_k_b) * perm",
forTransposition := false,
applicable := (self, nt) >> let(N := nt.params[1],
N > 2 and DivisorPairsRP(N) <> [] and N <= self.maxSize and
not nt.hasTags()),
maxSize := 64,
children := nt -> let(mn := nt.params[1], k:= nt.params[2], Map2(DivisorPairsRP(mn),
(m,n) -> [ DFT(m, k*n mod m), DFT(n, k*m mod n) ])),
apply := (nt, C, cnt) -> let(
r := Rows(C[1]),
s := Rows(C[2]),
alpha := 1 / s mod r,
beta := 1 / r mod s,
CRT(r,s,1,1).transpose() * Tensor(C[1], C[2]) * CRT(r,s,1,1)
)
),
#F DFT_PFA_SUMS : Prime Factor FFT using Sigma-SPL and cyclic shifts
#F
#F DFT_n*k -> perm * (DFT_n_a tensor DFT_k_b) * perm
#F when gcd(n,k) = 1
#F
DFT_PFA_SUMS := CopyFields(~.DFT_GoodThomas, rec(
apply := (nt, C, cnt) -> let(
r := Rows(C[1]), s := Rows(C[2]),
j := Ind(s), k := Ind(r),
alpha := (1/s) mod r, beta := (1/r) mod s,
ISum(j,
Scat(fTensor(fId(r), fBase(j))) *
(C[1] ^ Z(r, -alpha*j)) *
Gath(fTensor(fId(r), fBase(j)))) *
ISum(k,
Scat(fTensor(fId(s), fBase(k))) *
(C[2] ^ Z(s, -beta*k)) *
Gath(fTensor(fId(s), fBase(k))))
)
)),
DFT_PFA_RaderComb := rec(
forTransposition := false,
applicable := nt -> let(N := nt.params[1], divs := DivisorPairsRP(N),
N > 2 and Length(divs)=2 and N mod 2 = 1 and
IsPrime(divs[1][1]) and IsPrime(divs[1][2])
and not nt.hasTags()),
children := nt -> let(
N:=nt.params[1], k:=nt.params[2], divs := DivisorPairsRP(nt.params[1]),
r := divs[1][1], s := divs[1][2],
[ [DFT(r-1,-1), DFT(r-1,-1), DFT(s-1,-1), DFT(s-1,-1)],
[DFT(s-1,-1), DFT(s-1,-1), DFT(r-1,-1), DFT(r-1,-1)] ]),
apply := (nt, C, cnt) -> let(
r := Rows(C[1])+1,
s := Rows(C[3])+1,
er := ChineseRem([r,s], [1,0]),
es := ChineseRem([r,s], [0,1]),
dr := DFT_Rader.raderMid(r, nt.params[2]*s), # * er/s mod r),
ds := DFT_Rader.raderMid(s, nt.params[2]*r), # * es/r mod s),
CRT(r,s,1,1).transpose() *
Tensor(RR(r).transpose(), RR(s).transpose()) *
Tensor(
DirectSum(I(1), C[1]) * dr * DirectSum(I(1), C[2]),
DirectSum(I(1), C[3]) * ds * DirectSum(I(1), C[4])
) *
Tensor(RR(r), RR(s)) *
CRT(r,s,1,1)
)
),
#F DFT_SplitRadix: 1984
#F
#F DFT_n = B * (DFT_n/2 dirsum DFT_n/4 dirsum DFT_n/4) * perm
#F
#F B = (DFT_2 tensor I_n/2) * S * diag
#F S = (I_n/2 dirsum (diag([1,E(4)] tensor I_n/4))
#F
#F Duhamel, Pierre:
#F Split Radix FFT Algorithm, Electronics Letters, Vol. 20, No. 1,
#F pp. 14--16, 1984
#F
DFT_SplitRadix := rec(
info := "DFT_n -> DFT_n/2, DFT_n/4, DFT_n/4",
forTransposition := true,
maxSize := 64,
applicable := (self, nt) >> let(N := nt.params[1],
N >= 8 and N mod 4 = 0 and N <= self.maxSize and not nt.hasTags()
),
children := nt -> let(N := nt.params[1], w := nt.params[2],
[[ DFT(N/2, w), DFT(N/4, w) ]]
),
apply := (nt, C, cnt) -> let(N := nt.params[1], w := nt.params[2],
Tensor(F(2), I(N/2)) *
DirectSum(
C[1],
Tensor(Diag([1, E(4)^w]) * F(2), I(N/4)) *
Diag(fPrecompute(fCompose(Tw3(N/2, 2, w), L(N/2, 2)))) *
Tensor(I(2), C[2])*L(N/2,2)
) *
L(N, 2)
)
),
#F DFT_DCT1andDST1: 1984
#F
#F DFT_n = blocks * (DCT1_(n/2+1) dirsum DST1_(n/2-1)) * blocks
#F
#F Wang:
#F Fast Algorithms for the Discrete W Transform and the
#F Discrete Fourier Transform.
#F IEEE Trans. on ASSP, 1984, pp. 803--814
#F Britanak/Rao:
#F The fast generalized discrete Fourier transforms: A unified
#F approach to the discrete sinusoidal transforms computation.
#F Signal Processing 79, 1999, pp. 135--150
#F
DFT_DCT1andDST1 := rec(
info := "DFT_n -> DCT1_(n/2+1), DST1_(n/2-1)",
maxSize := 64,
applicable := (self, nt) >> let(N:=nt.params[1], k:=nt.params[2],
N > 2 and N <= self.maxSize and Is2Power(N) and AbsInt(k)=1) and not nt.hasTags(),
children := nt ->
[[ DCT1( nt.params[1]/2 + 1 ), DST1( nt.params[1]/2 - 1 ) ]],
apply := (nt, C, cnt) -> let(N:=nt.params[1], w:=nt.params[2],
DirectSum(I(1), blocks4(N - 1, w)) *
DirectSum(C[1], C[2] ^ J(N/2 - 1)) *
DirectSum(I(1), blocks1(N - 1))
)
)
));
|
/-
Copyright (c) 2019 Neil Strickland. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Neil Strickland
This file sets up the theory of affine spaces. One approach
would be to say that an affine space consists of a commutative
additive group A together with a type V and a free transitive
action of A on V. From this point of view, we could define a
parallelogram to be a list of the form
[v, v + a, v + b, v + a + b] for some v in V and a,b in A.
Here, however, we proceed in a slightly different way: we assume
that we are given an inhabited type V and a set of parallelograms
subject to some axioms. From these we construct A as a quotient
of V × V, and then construct a free transitive action of A on V.
-/
import algebra.group
class affine_space (V : Type*) :=
(is_parallelogram : V → V → V → V → Prop)
(flip : ∀ {a b c d}, is_parallelogram a b c d → is_parallelogram c d a b)
(flip' : ∀ {a b c d}, is_parallelogram a b c d → is_parallelogram a c b d)
(glue : ∀ {a b c d e f}, is_parallelogram a b c d →
is_parallelogram c d e f → is_parallelogram a b e f)
(thin : ∀ a b, is_parallelogram a b a b)
(fill : V → V → V → V)
(fill_iff : ∀ {a b c d}, is_parallelogram a b c d ↔ d = fill a b c)
namespace affine_space
variables (V : Type*) [affine_space V] [inhabited V]
variables a b c d e f a' b' c' d' : V
instance translation_setoid : setoid (V × V) :=
{ r := λ st uv , is_parallelogram st.1 st.2 uv.1 uv.2,
iseqv := by {
split,
{intro st, exact thin st.1 st.2},
split,
{intros st uv h, exact flip h},
{intros st uv xy h k, exact glue h k} } }
variable {V}
lemma flip_iff : is_parallelogram a b c d ↔ is_parallelogram c d a b :=
⟨flip, flip⟩
lemma flip'_iff : is_parallelogram a b c d ↔ is_parallelogram a c b d :=
⟨flip', flip'⟩
lemma fill_prop : is_parallelogram a b c (fill a b c) :=
(@fill_iff V _ _ _ _ _).mpr (rfl : fill a b c = fill a b c)
lemma fill_symm : fill a b c = fill a c b :=
(@fill_iff V _ _ _ _ _).mp (flip' (fill_prop a b c))
variables {a b c d a' b' c' d'}
lemma inj_d : is_parallelogram a b c d →
is_parallelogram a b c d' → d = d' :=
by { rw [fill_iff, fill_iff], intros h h', exact h.trans h'.symm }
lemma inj_c : is_parallelogram a b c d →
is_parallelogram a b c' d → c = c' :=
by { intros h h', rw [flip'_iff, flip_iff] at h h', exact inj_d h h' }
lemma inj_b : is_parallelogram a b c d →
is_parallelogram a b' c d → b = b' :=
by { intros h h', rw [flip'_iff] at h h', exact inj_c h h' }
lemma inj_a : is_parallelogram a b c d →
is_parallelogram a' b c d → a = a' :=
by { intros h h', rw [flip_iff] at h h', exact inj_c h h' }
lemma fill_zero (a b : V) : fill a a b = b :=
by { symmetry, rw [← fill_iff], apply flip', apply thin}
variable (V)
def translations : Type* := quotient (by apply_instance : setoid (V × V))
namespace translations
variable {V}
variables (t u : translations V)
def gap (a b : V) : translations V := quotient.mk ⟨a,b⟩
lemma gap_eq_iff : gap a b = gap c d ↔ is_parallelogram a b c d :=
⟨ @quotient.exact (V × V) _ ⟨a,b⟩ ⟨c,d⟩, @quotient.sound (V × V) _ ⟨a,b⟩ ⟨c,d⟩⟩
def add' : translations V → V → V :=
quotient.lift (λ (ab : V × V) (x : V), fill ab.1 ab.2 x)
(λ ⟨a₁,b₁⟩ ⟨a₂,b₂⟩ h, by {funext x,
simp only [],rw[← fill_iff],
change is_parallelogram a₁ b₁ a₂ b₂ at h,
exact glue (flip h) (fill_prop a₁ b₁ x) })
theorem is_parallelogram_add' (a b : V) (t : translations V) :
is_parallelogram a b (add' t a) (add' t b) :=
begin
rcases t with ⟨⟨x,y⟩⟩,
change is_parallelogram a b (fill x y a) (fill x y b),
have ha : is_parallelogram x y a (fill x y a) := fill_prop x y a,
have hb : is_parallelogram x y b (fill x y b) := fill_prop x y b,
exact flip' (glue (flip ha) hb),
end
theorem gap_add' : add' (gap a b) c = fill a b c := rfl
theorem gap_add'' : add' (gap a b) a = b :=
by { change fill a b a = b, symmetry, rw[← fill_iff], exact thin a b }
theorem add'_gap (a : V) (t : translations V) : gap a (add' t a) = t :=
by { rcases t with ⟨⟨x,y⟩⟩, change gap a (fill x y a) = gap x y,
rw [gap_eq_iff, flip_iff], apply fill_prop }
def zero : translations V := gap default default
lemma gap_eq_zero_iff (a b : V) : gap a b = zero ↔ a = b :=
begin
dsimp [zero], rw [gap_eq_iff, flip_iff, fill_iff, fill_zero],
split; intro h; exact h.symm
end
def neg : translations V → translations V :=
quotient.lift (λ (ab : V × V), gap ab.2 ab.1)
(λ ⟨a,b⟩ ⟨c,d⟩ h, gap_eq_iff.mpr (flip' (flip (flip' h))))
theorem neg_gap : neg (gap a b) = gap b a := rfl
def add : translations V → translations V → translations V :=
λ t, quotient.lift (λ cd : V × V, gap cd.1 (add' t cd.2))
(λ ⟨c₁,d₁⟩ ⟨c₂,d₂⟩ h, by {
change is_parallelogram c₁ d₁ c₂ d₂ at h,
change gap c₁ (add' t d₁) = gap c₂ (add' t d₂),
rw [gap_eq_iff, flip'_iff],
exact glue (flip' h) (is_parallelogram_add' d₁ d₂ t) })
theorem add_gap : add (gap a b) (gap c d) = gap c (fill a b d) := rfl
theorem add_gap' : add (gap a b) (gap b c) = gap a c :=
by { rw [add_gap, gap_eq_iff, flip_iff, flip'_iff],
exact fill_prop a b c }
theorem zero_add (t : translations V) : add zero t = t :=
begin
rcases t with ⟨a,b⟩,
change _ = gap a b,
change gap a (fill default default b) = gap a b,
rw [gap_eq_iff, fill_zero],
apply thin
end
theorem zero_neg (t : translations V) : add t (neg t) = zero :=
begin
rcases t with ⟨a,b⟩,
change add (gap a b) (gap b a) = zero,
rw [add_gap, gap_eq_zero_iff, ← fill_iff],
apply thin,
end
theorem add_comm (t u : translations V) : add t u = add u t :=
begin
rcases t with ⟨a,b⟩,
change add (gap a b) u = add u (gap a b),
let c := add' u b,
have : u = gap b c := (add'_gap b u).symm,
rw [this, add_gap', add_gap, gap_eq_iff, flip'_iff, fill_symm,
fill_zero, flip'_iff],
apply thin
end
theorem add_assoc (t u v : translations V) :
add (add t u) v = add t (add u v) :=
begin
rcases t with ⟨a,b⟩,
let c := add' u b,
have : u = gap b c := (add'_gap b u).symm, rw [this],
let d := add' v c,
have : v = gap c d := (add'_gap c v).symm, rw [this],
change add (add (gap a b) (gap b c)) (gap c d) =
add (gap a b) (add (gap b c) (gap c d)),
simp only [add_gap'],
end
end translations
end affine_space
|
David <unk> as Assassin in Bedroom : one of Osato 's henchmen , who kills Aki .
|
\section{\texorpdfstring{Introduction}{Introduction}}
\vspace{5mm}
\large
\subsection{Course overview}
\begin{itemize}
\item Finite graphs
\item Existence theorems
\item Algorithms, NP-completeness
\item Graph drawing
\end{itemize}
How much information do we need to store the drawing?
Upward drawing: each edge directed upwards.
Most of the time we talk about \textbf{Intersection graphs}.
\subsection{Intersection graphs}
\begin{definition}[Intersection graph]
Let $\A$ be a family of sets.
Then \textbf{the} intersection graph is
\[ IG(\A) = (\A, \{ ab: a\ne b, a \cap b \ne \emptyset, a, b \in \A \}) \]
Let $\M$ be a large family of sets, then G is \textbf{an} intersection graph of $\M$ if
\[ \exists A \subseteq \M: G \simeq IG(A) \]
Note that in a family an element can be repeated several times.
\end{definition}
\begin{observation}
IF $\M$ contains nonempty set, then $\forall$ complete graphs is in $\IG(\M)$.
\end{observation}
\begin{proof}
\begin{gather*}
A \in \M, A \ne \emptyset \\
V(K_n) = \{ u_1, u_2, \ldots, u_m \} \\
\end{gather*}
Every vertex $u$ is represented by $A$.
\end{proof}
\begin{observation}
\[ G \in \IG(\M) \iff \exists f:V(G) \to \M: \forall u \ne v \in V(G): uv \in E(G) \iff f(n) \cap f(v) \ne \emptyset \]
\end{observation}
\begin{observation}
$\forall \M: \IG(M)$ is \textbf{hereditary} if
\[ \forall G \in \IG(\M) \ \forall H \leq G: H \in IG(\M) \]
Induced subgraph is just deleting some edges, which in sets case means forgetting edges that represent sets.
\end{observation}
\begin{definition}[Interval graph]
% TODO Picture
Are intersection graphs of intervals on connected subsets of 1 dimensional Euclidian space.
\end{definition}
We are interested in \emph{arc connected} sets of the plain.
\begin{definition}[Arc connected]
% TODO
Is different from topological connected.
\end{definition}
\begin{definition}[Circle graphs (CA)]
Arcs on a circle.
\end{definition}
\begin{definition}[Circular arc graphs (CIR)]
Chords on a circle.
\end{definition}
\begin{definition}[Polygon circle graphs (PC)]
Polygons that can be inscribed in a circle.
\end{definition}
\begin{definition}[Permutation graphs (PER)]
Segments connecting two parallel lines.
Formally:
\begin{gather*}
V(G) = \{ u_1, u_2, \ldots, u_m \} \\
\exists \pi \in Sym(m): u,v \in E \iff i < j \land \pi(i) > \pi (j)
\end{gather*}
% TODO check
\end{definition}
\begin{definition}[Function graphs (FUN)]
Curves connecting two parallel lines.
\end{definition}
\begin{definition}[Segments graphs (SEG)]
Straight-line segments in the plane.
\end{definition}
\begin{definition}[String graphs (STRING)]
Curves in the plane.
\end{definition}
% TODO finish, statement
For each 2 sets, take a point that lies in the intersection of these sets.
Then connect unused dots by branching curve.
Problems we want to solve:
\begin{enumerate}
\item Given a graph, does it belong to the class.
\item How can we describe a representation. What size?
\item Given a graph and a representation, can we find max independent set, clique and so on.
Such questions that are NP-complete in general.
\end{enumerate}
Q: TODO is graph class recognition decidable?\\
A: Yes, but not polynomial in all cases.
INT, CA, CIR, PC, PER, FUN can be polynomially recognized.
SEG, CONN are considered NP-hard.
STRING is NP-complete.
\[ \forall n \exists G_N \in SEG\]
but in $\forall SEG$ segment representation there is a coordinate that is at least double exponential $2^{2^n}$, so even in bits is exponential.
Representation of STRING graph: make each intersection as a vertex.
All curves between intersection are edges.
Then graph becomes planar.
Planarity can be checked in Polynomial time.
But also $\forall n \exists G_n \in $ STRING $\forall$ representation requires $\geq 2^{cn}$ crossing points.
|
"""
Defining the Element class that is used to hold all needed data for one element/isotope.
"""
import os
from numpy import array, load
from .masses import ATOMIC_WEIGHTS, ELEMENT_CHARGES, ELEMENT_FULLNAMES
from .nabs_geant4 import DATA_DIR as NABS_DATA_DIR
from .nabs_geant4 import NEUTRON_ABSORPTIONS
from .nlengths_pt import NEUTRON_SCATTERING_LENGTHS
from .xray_nist import XRAY_SCATTERING_FACTORS
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
ELEMENT_NAMES = dict([(value, key) for key, value in ELEMENT_CHARGES.items()])
ELEMENT_FULLNAMES["D"] = "deuterium"
ELEMENT_FULLNAMES["Hx"] = "exchangeable hydrogen"
for data in [ATOMIC_WEIGHTS, NEUTRON_SCATTERING_LENGTHS]:
data["D"] = data[(1, 2)]
data["Hx"] = data[(1, 1)]
for data in [ELEMENT_CHARGES, XRAY_SCATTERING_FACTORS]:
data["Hx"] = data["H"]
class Element:
N = None
def __init__(self, symbol=None, Z=None):
# get element from database
N = None
self.symbol = symbol
if Z is None and symbol is None:
raise ValueError("Provide either Symbol or Z")
elif Z is None:
if "[" in symbol:
self.symbol, N = symbol.rstrip("]").split("[", 1)
N = int(N)
key = (ELEMENT_CHARGES[self.symbol], N)
else:
key = symbol
self.Z = ELEMENT_CHARGES[self.symbol]
else:
self.Z = Z
self.symbol = ELEMENT_NAMES[Z]
key = self.symbol
self.N = N
self.name = ELEMENT_FULLNAMES[self.symbol]
self.mass = ATOMIC_WEIGHTS[key]
try:
self.b = NEUTRON_SCATTERING_LENGTHS[key]
except KeyError:
raise ValueError(f"No neutorn scattering data for {key}")
if key in NEUTRON_ABSORPTIONS:
self._ndata = load(os.path.join(BASE_PATH, NABS_DATA_DIR, NEUTRON_ABSORPTIONS[key]))["arr_0"]
else:
self._ndata = None
try:
self._xdata = array(XRAY_SCATTERING_FACTORS[self.symbol])
except KeyError:
self._xdata = None
def f_of_E(self, Ei):
if self._xdata is None:
return float("nan")
E, fp, fpp = self._xdata
fltr = E >= Ei
if not fltr.any():
return 0.0 - 0j
else:
# linear interpolation between two nearest points
E1 = E[fltr][0]
try:
E2 = E[fltr][1]
except IndexError:
return fp[fltr][0] - 1j * fpp[fltr][0]
else:
f1 = fp[fltr][0] - 1j * fpp[fltr][0]
f2 = fp[fltr][1] - 1j * fpp[fltr][1]
return ((E2 - Ei) * f1 + (Ei - E1) * f2) / (E2 - E1)
def b_of_L(self, Li):
if self._ndata is None:
return self.b
L, b_abs = self._ndata
if Li > L[-1]:
return self.b.real - 1j * b_abs[-1]
if Li < L[0]:
return self.b.real - 1j * b_abs[0]
fltr = L >= Li
# linear interpolation between two nearest points
L1 = L[fltr][0]
try:
L2 = L[fltr][1]
except IndexError:
return self.b.real - 1j * b_abs[fltr][0]
else:
b_abs1 = b_abs[fltr][0]
b_abs2 = b_abs[fltr][1]
return self.b.real - 1j * ((L2 - Li) * b_abs1 + (Li - L1) * b_abs2) / (L2 - L1)
@property
def E(self):
return self._xdata[0]
@property
def f(self):
return self._xdata[1] - 1j * self._xdata[2]
@property
def fp(self):
return self._xdata[1]
@property
def fpp(self):
return self._xdata[2]
@property
def has_ndata(self):
return self._ndata is not None
@property
def Lamda(self):
# return neutron wavelength values for energy dependant absorption
if self.has_ndata:
return self._ndata[0]
else:
return array([0.05, 50.0])
@property
def b_abs(self):
return self._ndata[1]
@property
def b_lambda(self):
if self.has_ndata:
return self.b.real - 1j * self._ndata[1]
else:
return array([self.b, self.b])
def __str__(self):
if self.N is None:
return self.symbol
else:
return "%s[%s]" % (self.symbol, self.N)
def __repr__(self):
if self.N is None:
symb = self.symbol
else:
symb = "%s[%s]" % (self.symbol, self.N)
return 'Element(symbol="%s")' % symb
def __eq__(self, other):
if type(self) == type(other):
return self.N == other.N and self.Z == other.Z and self.symbol == other.symbol
else:
return object.__eq__(self, other)
def __hash__(self):
return hash((self.N, self.Z, self.symbol))
|
Columbia Records released " Crazy in Love " on May 18 , 2003 , as the lead single from Dangerously in Love . It was a number @-@ one hit in the United States and United Kingdom , and achieved top @-@ ten peaks on several other countries ' record charts . With global sales of over 8 @.@ 5 million , including 2 million from the U.S. , it is one of the best @-@ selling singles of all time . Music critics praised " Crazy in Love " ' s hook , Jay Z 's contribution , and Beyoncé 's assertive delivery of the lyrics . VH1 declared it the greatest song of the 2000s decade , while Rolling Stone ranked it as the 118th best song of all time in 2010 . At the 46th Grammy Awards , " Crazy in Love " won Best R & B Song and Best Rap / Sung Collaboration .
|
fib : Integer -> Integer
fib 0 = 0
fib 1 = 1
fib n = fib (n - 1) + fib (n - 2)
main : IO ()
main = do
value <- getLine
printLn (fib (cast value))
|
"""
Cubic spline approximation class.
Last Modified 9/9/97 by Johann Hibschman <[email protected]>
Updated to numpy 11/16/06 by Lisa Tauxe
To create a default ("natural") spline, simply use sp = Spline(x,y).
To specify the slope of the function at either of the endpoints,
use the "low_slope" and "high_slope" keywords.
Example usage:
>>> x = arange(10, typecode=Float) * 0.3
>>> y = cos(x)
>>> sp = Spline(x, y)
>>> print sp(0.5), cos(0.5)
0.878364380585 0.87758256189
Uses "searchsorted" from the Numeric module, aka "binarysearch" in older
versions.
"""
from __future__ import division
from __future__ import absolute_import
from builtins import range
from past.utils import old_div
from . import func
#from Numeric import *
import numpy
BadInput = "Bad xa input to routine splint."
class Spline(func.FuncOps):
def __init__(self, x_array, y_array, low_slope=None, high_slope=None):
self.x_vals = x_array
self.y_vals = y_array
self.low_slope = low_slope
self.high_slope = high_slope
# must be careful, so that a slope of 0 still works...
if low_slope is not None:
self.use_low_slope = 1
else:
self.use_low_slope = 0 # i.e. false
if high_slope is not None:
self.use_high_slope = 1
else:
self.use_high_slope = 0
self.calc_ypp()
def calc_ypp(self):
x_vals = self.x_vals
y_vals = self.y_vals
n = len(x_vals)
y2_vals = numpy.zeros(n, 'f')
u = numpy.zeros(n-1, 'f')
if self.use_low_slope:
u[0] = (old_div(3.0,(x_vals[1]-x_vals[0]))) * \
(old_div((y_vals[1]-y_vals[0]),
(x_vals[1]-x_vals[0]))-self.low_slope)
y2_vals[0] = -0.5
else:
u[0] = 0.0
y2_vals[0] = 0.0 # natural spline
for i in range(1, n-1):
sig = old_div((x_vals[i]-x_vals[i-1]), \
(x_vals[i+1]-x_vals[i-1]))
p = sig*y2_vals[i-1]+2.0
y2_vals[i] = old_div((sig-1.0),p)
u[i] = old_div((y_vals[i+1]-y_vals[i]), \
(x_vals[i+1]-x_vals[i])) - \
old_div((y_vals[i]-y_vals[i-1]), \
(x_vals[i]-x_vals[i-1]))
u[i] = old_div((6.0*u[i]/(x_vals[i+1]-x_vals[i-1]) -
sig*u[i-1]), p)
if self.use_high_slope:
qn = 0.5
un = (old_div(3.0,(x_vals[n-1]-x_vals[n-2]))) * \
(self.high_slope - old_div((y_vals[n-1]-y_vals[n-2]),
(x_vals[n-1]-x_vals[n-2])))
else:
qn = 0.0
un = 0.0 # natural spline
y2_vals[n-1] = old_div((un-qn*u[n-2]),(qn*y2_vals[n-1]+1.0))
rng = list(range(n-1))
rng.reverse()
for k in rng: # backsubstitution step
y2_vals[k] = y2_vals[k]*y2_vals[k+1]+u[k]
self.y2_vals = y2_vals
# compute approximation
def __call__(self, arg):
"""
Simulate a ufunc; handle being called on an array.
"""
if type(arg) == func.ArrayType:
return func.array_map(self.call, arg)
else:
return self.call(arg)
def call(self, x):
"""
Evaluate the spline, assuming x is a scalar.
"""
# if out of range, return endpoint
if x <= self.x_vals[0]:
return self.y_vals[0]
if x >= self.x_vals[-1]:
return self.y_vals[-1]
pos = numpy.searchsorted(self.x_vals, x)
h = self.x_vals[pos]-self.x_vals[pos-1]
if h == 0.0:
raise BadInput
a = old_div((self.x_vals[pos] - x), h)
b = old_div((x - self.x_vals[pos-1]), h)
return (a*self.y_vals[pos-1] + b*self.y_vals[pos] + \
((a*a*a - a)*self.y2_vals[pos-1] + \
(b*b*b - b)*self.y2_vals[pos]) * h*h/6.0)
class LinInt(func.FuncOps):
def __init__(self, x_array, y_array):
self.x_vals = x_array
self.y_vals = y_array
# compute approximation
def __call__(self, arg):
"""
Simulate a ufunc; handle being called on an array.
"""
if type(arg) == func.ArrayType:
return func.array_map(self.call, arg)
else:
return self.call(arg)
def call(self, x):
"""
Evaluate the interpolant, assuming x is a scalar.
"""
# if out of range, return endpoint
if x <= self.x_vals[0]:
return self.y_vals[0]
if x >= self.x_vals[-1]:
return self.y_vals[-1]
pos = numpy.searchsorted(self.x_vals, x)
h = self.x_vals[pos]-self.x_vals[pos-1]
if h == 0.0:
raise BadInput
a = old_div((self.x_vals[pos] - x), h)
b = old_div((x - self.x_vals[pos-1]), h)
return a*self.y_vals[pos-1] + b*self.y_vals[pos]
def spline_interpolate(x1, y1, x2):
"""
Given a function at a set of points (x1, y1), interpolate to
evaluate it at points x2.
"""
sp = Spline(x1, y1)
return sp(x2)
def logspline_interpolate(x1, y1, x2):
"""
Given a function at a set of points (x1, y1), interpolate to
evaluate it at points x2.
"""
sp = Spline(log(x1), log(y1))
return exp(sp(log(x2)))
def linear_interpolate(x1, y1, x2):
"""
Given a function at a set of points (x1, y1), interpolate to
evaluate it at points x2.
"""
li = LinInt(x1, y1)
return li(x2)
|
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2019 Beijing Institute of Technology
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: <[email protected]>
*/
#ifndef CONTROLLER_APP_H_
#define CONTROLLER_APP_H_
#include "ns3/ndnSIM-module.h"
#include "ns3/integer.h"
#include "ns3/double.h"
#include "ns3/string.h"
#include "ns3/random-variable-stream.h"
#include "ns3/nstime.h"
#include "ns3/application.h"
#include "ns3/ptr.h"
#include "ns3/callback.h"
#include "ns3/traced-callback.h"
#include "ns3/boolean.h"
#include "ns3/names.h"
#include "apps/ndn-app.hpp"
#include "NFD/rib/rib-manager.hpp"
#include "ns3/ndnSIM/helper/ndn-strategy-choice-helper.hpp"
#include "ns3/ndnSIM/model/ndn-common.hpp"
#include "ns3/ndnSIM/utils/ndn-rtt-estimator.hpp"
#include "ns3/nstime.h"
#include "ns3/data-rate.h"
#include <set>
#include <map>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/tag.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/member.hpp>
namespace ns3 {
namespace ndn {
class ControllerApp : public ndn::App {
public:
static TypeId
GetTypeId();
ControllerApp();
protected:
// inherited from Application base class.
virtual void
StartApplication();
virtual void
StopApplication();
virtual void
OnInterest(shared_ptr<const Interest> interest);
virtual void
OnData(shared_ptr<const Data> data);
private:
Name m_postfix;
uint32_t m_signature;
Name m_keyLocator;
Name m_prefix;
uint32_t m_virtualPayloadSize;
Time m_freshness;
uint32_t m_seq;
};
} //namespace ndn
} // namespace ns3
#endif //CONTROLLER_APP_H_
|
######################################################################
# Binary operations on finite sets
`is_element/binops` := (A::set,B::set,C::set) -> proc(p)
local AB,dom,cod,a,b;
global reason;
if not(type(p,table)) then
reason := [convert(procname,string),"not table"];
return false;
fi;
AB := {seq(seq([a,b],b in B),a in A)};
if {indices(p)} <> AB then
reason := [convert(procname,string),"wrong domain",{indices(p)},AB];
return false;
fi;
cod := map(op,{entries(p)});
if cod minus C <> {} then
reason := [convert(procname,string),"wrong codomain",cod,C];
return false;
fi;
return true;
end;
`is_equal/binops` := (A::set,B::set,C::set) -> proc(p,q)
local a,b;
global reason;
for a in A do
for b in B do
if p[a,b] <> q[a,b] then
reason := [convert(procname,string),"different value",a,b,p[a,b],q[a,b]];
return false;
fi;
od;
od;
return true;
end;
`is_leq/binops` := NULL;
`random_element/binops` := (A::set,B::set,C::set) -> proc()
local p,n,r,a,b;
p := table();
if B = {} then
if A = {} then
return eval(p);
else
return FAIL;
fi;
fi;
n := nops(C);
r := rand(1..n);
for a in A do
for b in B do
p[a,b] := C[r()];
od;
od;
return eval(p);
end;
`list_elements/binops` := proc(A::set,B::set,C::set)
local nA,nB,nC,J,L,i,j,k,u;
nA := nops(A);
nB := nops(B);
nC := nops(C);
J := [seq(seq([A[i],B[j]],j=1..nB),i=1..nA)];
L := [[]];
for i from 1 to nA*nB do
L := [seq(seq([op(u),j],j=1..nC),u in L)];
od:
L := map(u -> table([seq(op(J[k])=C[u[k]],k=1..nA*nB)]),L);
return L;
end;
`count_elements/binops` := (A::set,B::set,C::set) -> nops(C) ^ (nops(A)*nops(B));
`is_associative/binops` := (A::set) -> proc(m)
local a,b,c;
for a in A do
for b in A do
for c in A do
if m[a,m[b,c]] <> m[m[a,b],c] then
return false;
fi;
od;
od;
od;
return true;
end:
`is_commutative/binops` := (A::set) -> proc(m)
local a,b;
for a in A do
for b in A do
if m[a,b] <> m[b,a] then
return false;
fi;
od;
od;
return true;
end:
`is_left_proj/binops` := (A::set) -> proc(m)
local a,b;
for a in A do
for b in A do
if m[a,b] <> a then
return false;
fi;
od;
od;
return true;
end:
`is_right_proj/binops` := (A::set) -> proc(m)
local a,b;
for a in A do
for b in A do
if m[a,b] <> b then
return false;
fi;
od;
od;
return true;
end:
`is_idempotent/binops` := (A::set) -> proc(m)
local a;
for a in A do
if m[a,a] <> a then
return false;
fi;
od;
return true;
end:
`is_left_neutral/binops` := (A::set) -> proc(m,e)
local a;
if not(member(e,A)) then return false; fi;
for a in A do
if m[e,a] <> a then return false; fi;
od:
return true;
end:
`is_right_neutral/binops` := (A::set) -> proc(m,e)
local a;
if not(member(e,A)) then return false; fi;
for a in A do
if m[a,e] <> a then return false; fi;
od:
return true;
end:
`is_neutral/binops` := (A::set) -> proc(m,e)
return `is_left_neutral/binops`(A)(m,e) and
`is_right_neutral/binops`(A)(m,e);
end:
`has_left_neutral/binops` := (A::set) -> proc(m)
local e;
for e in A do
if `is_left_neutral/binops`(A)(m,e) then
return true;
fi;
od:
return false;
end:
`has_right_neutral/binops` := (A::set) -> proc(m)
local e;
for e in A do
if `is_right_neutral/binops`(A)(m,e) then
return true;
fi;
od:
return false;
end:
`has_neutral/binops` := (A::set) -> proc(m)
local e;
for e in A do
if `is_neutral/binops`(A)(m,e) then
return true;
fi;
od:
return false;
end:
`is_left_absorbing/binops` := (A::set) -> proc(m,e)
local a;
if not(member(e,A)) then return false; fi;
for a in A do
if m[e,a] <> e then return false; fi;
od:
return true;
end:
`is_right_absorbing/binops` := (A::set) -> proc(m,e)
local a;
if not(member(e,A)) then return false; fi;
for a in A do
if m[a,e] <> e then return false; fi;
od:
return true;
end:
`is_absorbing/binops` := (A::set) -> proc(m,e)
return `is_left_absorbing/binops`(A)(m,e) and
`is_right_absorbing/binops`(A)(m,e);
end:
`has_left_absorbing/binops` := (A::set) -> proc(m)
local e;
for e in A do
if `is_left_absorbing/binops`(A)(m,e) then
return true;
fi;
od:
return false;
end:
`has_right_absorbing/binops` := (A::set) -> proc(m)
local e;
for e in A do
if `is_right_absorbing/binops`(A)(m,e) then
return true;
fi;
od:
return false;
end:
`has_absorbing/binops` := (A::set) -> proc(m)
local e;
for e in A do
if `is_absorbing/binops`(A)(m,e) then
return true;
fi;
od:
return false;
end:
|
{-# OPTIONS --without-K #-}
module sets.finite where
open import sets.finite.core public
|
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ ContDiffOn 𝕜 ⊤
(fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) (range ↑I))
(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source
[PROOFSTEP]
have h : ((i.1.extend I).symm ≫ j.1.extend I).source ⊆ range I := by rw [i.1.extend_coord_change_source];
apply image_subset_range
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ (LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source ⊆ range ↑I
[PROOFSTEP]
rw [i.1.extend_coord_change_source]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ ↑I '' (LocalHomeomorph.symm ↑i ≫ₕ ↑j).toLocalEquiv.source ⊆ range ↑I
[PROOFSTEP]
apply image_subset_range
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
h : (LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source ⊆ range ↑I
⊢ ContDiffOn 𝕜 ⊤
(fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) (range ↑I))
(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source
[PROOFSTEP]
intro x hx
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
h : (LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source ⊆ range ↑I
x : E
hx : x ∈ (LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source
⊢ ContDiffWithinAt 𝕜 ⊤
(fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) (range ↑I))
(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source x
[PROOFSTEP]
refine' (ContDiffWithinAt.fderivWithin_right _ I.unique_diff le_top <| h hx).mono h
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
h : (LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source ⊆ range ↑I
x : E
hx : x ∈ (LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source
⊢ ContDiffWithinAt 𝕜 ⊤ (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(range ↑I) x
[PROOFSTEP]
refine'
(LocalHomeomorph.contDiffOn_extend_coord_change I (subset_maximalAtlas I j.2) (subset_maximalAtlas I i.2) x
hx).mono_of_mem
_
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
h : (LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source ⊆ range ↑I
x : E
hx : x ∈ (LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source
⊢ (LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source ∈ 𝓝[range ↑I] x
[PROOFSTEP]
exact i.1.extend_coord_change_source_mem_nhdsWithin j.1 I hx
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i : ↑(atlas H M)
x : M
hx : x ∈ (fun i => (↑i).source) i
v : E
⊢ ↑((fun i j x =>
fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(range ↑I) (↑(LocalHomeomorph.extend (↑i) I) x))
i i x)
v =
v
[PROOFSTEP]
simp only
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i : ↑(atlas H M)
x : M
hx : x ∈ (fun i => (↑i).source) i
v : E
⊢ ↑(fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑i) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) (range ↑I)
(↑(LocalHomeomorph.extend (↑i) I) x))
v =
v
[PROOFSTEP]
rw [Filter.EventuallyEq.fderivWithin_eq, fderivWithin_id', ContinuousLinearMap.id_apply]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i : ↑(atlas H M)
x : M
hx : x ∈ (fun i => (↑i).source) i
v : E
⊢ UniqueDiffWithinAt 𝕜 (range ↑I) (↑(LocalHomeomorph.extend (↑i) I) x)
[PROOFSTEP]
exact I.unique_diff_at_image
[GOAL]
case hs
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i : ↑(atlas H M)
x : M
hx : x ∈ (fun i => (↑i).source) i
v : E
⊢ ↑(LocalHomeomorph.extend (↑i) I) ∘
↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)) =ᶠ[𝓝[range ↑I] ↑(LocalHomeomorph.extend (↑i) I) x]
fun x => x
[PROOFSTEP]
filter_upwards [i.1.extend_target_mem_nhdsWithin I hx] with y hy
[GOAL]
case h
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i : ↑(atlas H M)
x : M
hx : x ∈ (fun i => (↑i).source) i
v y : E
hy : y ∈ (LocalHomeomorph.extend (↑i) I).target
⊢ (↑(LocalHomeomorph.extend (↑i) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) y = y
[PROOFSTEP]
exact (i.1.extend I).right_inv hy
[GOAL]
case hx
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i : ↑(atlas H M)
x : M
hx : x ∈ (fun i => (↑i).source) i
v : E
⊢ (↑(LocalHomeomorph.extend (↑i) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(↑(LocalHomeomorph.extend (↑i) I) x) =
↑(LocalHomeomorph.extend (↑i) I) x
[PROOFSTEP]
simp_rw [Function.comp_apply, i.1.extend_left_inv I hx]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ ContinuousOn
((fun i j x =>
fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(range ↑I) (↑(LocalHomeomorph.extend (↑i) I) x))
i j)
((fun i => (↑i).source) i ∩ (fun i => (↑i).source) j)
[PROOFSTEP]
refine' (contDiffOn_fderiv_coord_change I i j).continuousOn.comp ((i.1.continuousOn_extend I).mono _) _
[GOAL]
case refine'_1
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ (fun i => (↑i).source) i ∩ (fun i => (↑i).source) j ⊆ (LocalHomeomorph.extend (↑i) I).source
[PROOFSTEP]
rw [i.1.extend_source]
[GOAL]
case refine'_1
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ (fun i => (↑i).source) i ∩ (fun i => (↑i).source) j ⊆ (↑i).source
[PROOFSTEP]
exact inter_subset_left _ _
[GOAL]
case refine'_2
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ MapsTo (fun x => ↑(LocalHomeomorph.extend (↑i) I) x) ((fun i => (↑i).source) i ∩ (fun i => (↑i).source) j)
(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source
[PROOFSTEP]
simp_rw [← i.1.extend_image_source_inter, mapsTo_image]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
⊢ ∀ (i j k : ↑(atlas H M)) (x : M),
x ∈ (fun i => (↑i).source) i ∩ (fun i => (↑i).source) j ∩ (fun i => (↑i).source) k →
∀ (v : E),
↑((fun i j x =>
fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(range ↑I) (↑(LocalHomeomorph.extend (↑i) I) x))
j k x)
(↑((fun i j x =>
fderivWithin 𝕜
(↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) (range ↑I)
(↑(LocalHomeomorph.extend (↑i) I) x))
i j x)
v) =
↑((fun i j x =>
fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(range ↑I) (↑(LocalHomeomorph.extend (↑i) I) x))
i k x)
v
[PROOFSTEP]
rintro i j k x ⟨⟨hxi, hxj⟩, hxk⟩ v
[GOAL]
case intro.intro
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x : M
hxk : x ∈ (fun i => (↑i).source) k
hxi : x ∈ (fun i => (↑i).source) i
hxj : x ∈ (fun i => (↑i).source) j
v : E
⊢ ↑((fun i j x =>
fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(range ↑I) (↑(LocalHomeomorph.extend (↑i) I) x))
j k x)
(↑((fun i j x =>
fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(range ↑I) (↑(LocalHomeomorph.extend (↑i) I) x))
i j x)
v) =
↑((fun i j x =>
fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(range ↑I) (↑(LocalHomeomorph.extend (↑i) I) x))
i k x)
v
[PROOFSTEP]
rw [fderivWithin_fderivWithin, Filter.EventuallyEq.fderivWithin_eq]
[GOAL]
case intro.intro.hs
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x : M
hxk : x ∈ (fun i => (↑i).source) k
hxi : x ∈ (fun i => (↑i).source) i
hxj : x ∈ (fun i => (↑i).source) j
v : E
⊢ (↑(LocalHomeomorph.extend (↑k) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑j) I))) ∘
↑(LocalHomeomorph.extend (↑j) I) ∘
↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)) =ᶠ[𝓝[range ↑I] ↑(LocalHomeomorph.extend (↑i) I) x]
↑(LocalHomeomorph.extend (↑k) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))
[PROOFSTEP]
have := i.1.extend_preimage_mem_nhds I hxi (j.1.extend_source_mem_nhds I hxj)
[GOAL]
case intro.intro.hs
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x : M
hxk : x ∈ (fun i => (↑i).source) k
hxi : x ∈ (fun i => (↑i).source) i
hxj : x ∈ (fun i => (↑i).source) j
v : E
this :
↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)) ⁻¹' (LocalHomeomorph.extend (↑j) I).source ∈
𝓝 (↑(LocalHomeomorph.extend (↑i) I) x)
⊢ (↑(LocalHomeomorph.extend (↑k) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑j) I))) ∘
↑(LocalHomeomorph.extend (↑j) I) ∘
↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)) =ᶠ[𝓝[range ↑I] ↑(LocalHomeomorph.extend (↑i) I) x]
↑(LocalHomeomorph.extend (↑k) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))
[PROOFSTEP]
filter_upwards [nhdsWithin_le_nhds this] with y hy
[GOAL]
case h
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x : M
hxk : x ∈ (fun i => (↑i).source) k
hxi : x ∈ (fun i => (↑i).source) i
hxj : x ∈ (fun i => (↑i).source) j
v : E
this :
↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)) ⁻¹' (LocalHomeomorph.extend (↑j) I).source ∈
𝓝 (↑(LocalHomeomorph.extend (↑i) I) x)
y : E
hy : y ∈ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)) ⁻¹' (LocalHomeomorph.extend (↑j) I).source
⊢ ((↑(LocalHomeomorph.extend (↑k) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑j) I))) ∘
↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
y =
(↑(LocalHomeomorph.extend (↑k) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) y
[PROOFSTEP]
simp_rw [Function.comp_apply, (j.1.extend I).left_inv hy]
[GOAL]
case intro.intro.hx
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x : M
hxk : x ∈ (fun i => (↑i).source) k
hxi : x ∈ (fun i => (↑i).source) i
hxj : x ∈ (fun i => (↑i).source) j
v : E
⊢ ((↑(LocalHomeomorph.extend (↑k) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑j) I))) ∘
↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(↑(LocalHomeomorph.extend (↑i) I) x) =
(↑(LocalHomeomorph.extend (↑k) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(↑(LocalHomeomorph.extend (↑i) I) x)
[PROOFSTEP]
simp_rw [Function.comp_apply, i.1.extend_left_inv I hxi, j.1.extend_left_inv I hxj]
[GOAL]
case intro.intro.hg
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x : M
hxk : x ∈ (fun i => (↑i).source) k
hxi : x ∈ (fun i => (↑i).source) i
hxj : x ∈ (fun i => (↑i).source) j
v : E
⊢ DifferentiableWithinAt 𝕜 (↑(LocalHomeomorph.extend (↑k) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑j) I)))
(range ↑I) (↑(LocalHomeomorph.extend (↑j) I) x)
[PROOFSTEP]
exact
(contDiffWithinAt_extend_coord_change' I (subset_maximalAtlas I k.2) (subset_maximalAtlas I j.2) hxk
hxj).differentiableWithinAt
le_top
[GOAL]
case intro.intro.hf
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x : M
hxk : x ∈ (fun i => (↑i).source) k
hxi : x ∈ (fun i => (↑i).source) i
hxj : x ∈ (fun i => (↑i).source) j
v : E
⊢ DifferentiableWithinAt 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(range ↑I) (↑(LocalHomeomorph.extend (↑i) I) x)
[PROOFSTEP]
exact
(contDiffWithinAt_extend_coord_change' I (subset_maximalAtlas I j.2) (subset_maximalAtlas I i.2) hxj
hxi).differentiableWithinAt
le_top
[GOAL]
case intro.intro.h
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x : M
hxk : x ∈ (fun i => (↑i).source) k
hxi : x ∈ (fun i => (↑i).source) i
hxj : x ∈ (fun i => (↑i).source) j
v : E
⊢ MapsTo (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) (range ↑I) (range ↑I)
[PROOFSTEP]
intro x _
[GOAL]
case intro.intro.h
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x✝ : M
hxk : x✝ ∈ (fun i => (↑i).source) k
hxi : x✝ ∈ (fun i => (↑i).source) i
hxj : x✝ ∈ (fun i => (↑i).source) j
v x : E
a✝ : x ∈ range ↑I
⊢ (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) x ∈ range ↑I
[PROOFSTEP]
exact mem_range_self _
[GOAL]
case intro.intro.hxs
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x : M
hxk : x ∈ (fun i => (↑i).source) k
hxi : x ∈ (fun i => (↑i).source) i
hxj : x ∈ (fun i => (↑i).source) j
v : E
⊢ UniqueDiffWithinAt 𝕜 (range ↑I) (↑(LocalHomeomorph.extend (↑i) I) x)
[PROOFSTEP]
exact I.unique_diff_at_image
[GOAL]
case intro.intro.hy
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j k : ↑(atlas H M)
x : M
hxk : x ∈ (fun i => (↑i).source) k
hxi : x ∈ (fun i => (↑i).source) i
hxj : x ∈ (fun i => (↑i).source) j
v : E
⊢ (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(↑(LocalHomeomorph.extend (↑i) I) x) =
↑(LocalHomeomorph.extend (↑j) I) x
[PROOFSTEP]
rw [Function.comp_apply, i.1.extend_left_inv I hxi]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p q : TM
⊢ p ∈ (chartAt (ModelProd H E) q).toLocalEquiv.source ↔ p.proj ∈ (chartAt H q.proj).toLocalEquiv.source
[PROOFSTEP]
simp only [FiberBundle.chartedSpace_chartAt, mfld_simps]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : H × E
q : TM
⊢ p ∈ (chartAt (ModelProd H E) q).toLocalEquiv.target ↔ p.fst ∈ (chartAt H q.proj).toLocalEquiv.target
[PROOFSTEP]
simp only [FiberBundle.chartedSpace_chartAt, mfld_simps]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : H × E
q : TM
⊢ p.fst ∈ (chartAt H q.proj).toLocalEquiv.target ∧
(↑(LocalEquiv.symm (LocalEquiv.prod (chartAt H q.proj).toLocalEquiv (LocalEquiv.refl E))) p).fst ∈
(chartAt H q.proj).toLocalEquiv.source ↔
p.fst ∈ (chartAt H q.proj).toLocalEquiv.target
[PROOFSTEP]
rw [LocalEquiv.prod_symm]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : H × E
q : TM
⊢ p.fst ∈ (chartAt H q.proj).toLocalEquiv.target ∧
(↑(LocalEquiv.prod (LocalEquiv.symm (chartAt H q.proj).toLocalEquiv) (LocalEquiv.symm (LocalEquiv.refl E)))
p).fst ∈
(chartAt H q.proj).toLocalEquiv.source ↔
p.fst ∈ (chartAt H q.proj).toLocalEquiv.target
[PROOFSTEP]
simp (config := { contextual := true }) only [and_iff_left_iff_imp, mfld_simps]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
b b' x : F
⊢ VectorBundleCore.coordChange (tangentBundleCore 𝓘(𝕜, F) F) (achart F b) (achart F b') x = 1
[PROOFSTEP]
simpa only [tangentBundleCore_coordChange, mfld_simps] using fderivWithin_id uniqueDiffWithinAt_univ
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
b b' : F
⊢ Trivialization.symmL 𝕜 (trivializationAt F (TangentSpace 𝓘(𝕜, F)) b) b' = 1
[PROOFSTEP]
rw [TangentBundle.trivializationAt_symmL, coordChange_model_space]
[GOAL]
case hb
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
b b' : F
⊢ b' ∈ (trivializationAt F (TangentSpace 𝓘(𝕜, F)) b).baseSet
[PROOFSTEP]
apply mem_univ
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
b b' : F
⊢ Trivialization.continuousLinearMapAt 𝕜 (trivializationAt F (TangentSpace 𝓘(𝕜, F)) b) b' = 1
[PROOFSTEP]
rw [TangentBundle.trivializationAt_continuousLinearMapAt, coordChange_model_space]
[GOAL]
case hb
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
b b' : F
⊢ b' ∈ (trivializationAt F (TangentSpace 𝓘(𝕜, F)) b).baseSet
[PROOFSTEP]
apply mem_univ
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
⊢ VectorBundleCore.IsSmooth (tangentBundleCore I M) I
[PROOFSTEP]
refine' ⟨fun i j => _⟩
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ SmoothOn I 𝓘(𝕜, E →L[𝕜] E) (VectorBundleCore.coordChange (tangentBundleCore I M) i j)
(VectorBundleCore.baseSet (tangentBundleCore I M) i ∩ VectorBundleCore.baseSet (tangentBundleCore I M) j)
[PROOFSTEP]
rw [SmoothOn, contMDiffOn_iff_source_of_mem_maximalAtlas (subset_maximalAtlas I i.2), contMDiffOn_iff_contDiffOn]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ ContDiffOn 𝕜 ⊤
(VectorBundleCore.coordChange (tangentBundleCore I M) i j ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)))
(↑(LocalHomeomorph.extend (↑i) I) ''
(VectorBundleCore.baseSet (tangentBundleCore I M) i ∩ VectorBundleCore.baseSet (tangentBundleCore I M) j))
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ VectorBundleCore.baseSet (tangentBundleCore I M) i ∩ VectorBundleCore.baseSet (tangentBundleCore I M) j ⊆ (↑i).source
[PROOFSTEP]
refine' ((contDiffOn_fderiv_coord_change I i j).congr fun x hx => _).mono _
[GOAL]
case refine'_1
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
x : E
hx : x ∈ (LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source
⊢ (VectorBundleCore.coordChange (tangentBundleCore I M) i j ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) x =
fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) (range ↑I) x
[PROOFSTEP]
rw [LocalEquiv.trans_source'] at hx
[GOAL]
case refine'_1
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
x : E
hx :
x ∈
(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)).source ∩
↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)) ⁻¹'
((LocalEquiv.symm (LocalHomeomorph.extend (↑i) I)).target ∩ (LocalHomeomorph.extend (↑j) I).source)
⊢ (VectorBundleCore.coordChange (tangentBundleCore I M) i j ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) x =
fderivWithin 𝕜 (↑(LocalHomeomorph.extend (↑j) I) ∘ ↑(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I))) (range ↑I) x
[PROOFSTEP]
simp_rw [Function.comp_apply, tangentBundleCore_coordChange, (i.1.extend I).right_inv hx.1]
[GOAL]
case refine'_2
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ ↑(LocalHomeomorph.extend (↑i) I) ''
(VectorBundleCore.baseSet (tangentBundleCore I M) i ∩ VectorBundleCore.baseSet (tangentBundleCore I M) j) ⊆
(LocalEquiv.symm (LocalHomeomorph.extend (↑i) I) ≫ LocalHomeomorph.extend (↑j) I).source
[PROOFSTEP]
exact (i.1.extend_image_source_inter j.1 I).subset
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
i j : ↑(atlas H M)
⊢ VectorBundleCore.baseSet (tangentBundleCore I M) i ∩ VectorBundleCore.baseSet (tangentBundleCore I M) j ⊆ (↑i).source
[PROOFSTEP]
apply inter_subset_left
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : TangentBundle I H
⊢ (chartAt (ModelProd H E) p).toLocalEquiv = Equiv.toLocalEquiv (TotalSpace.toProd H E)
[PROOFSTEP]
ext x : 1
[GOAL]
case h
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p x : TangentBundle I H
⊢ ↑(chartAt (ModelProd H E) p).toLocalEquiv x = ↑(Equiv.toLocalEquiv (TotalSpace.toProd H E)) x
[PROOFSTEP]
ext
[GOAL]
case h.h₁
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p x : TangentBundle I H
⊢ (↑(chartAt (ModelProd H E) p).toLocalEquiv x).fst = (↑(Equiv.toLocalEquiv (TotalSpace.toProd H E)) x).fst
[PROOFSTEP]
rfl
[GOAL]
case h.h₂
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p x : TangentBundle I H
⊢ (↑(chartAt (ModelProd H E) p).toLocalEquiv x).snd = (↑(Equiv.toLocalEquiv (TotalSpace.toProd H E)) x).snd
[PROOFSTEP]
exact (tangentBundleCore I H).coordChange_self (achart _ x.1) x.1 (mem_achart_source H x.1) x.2
[GOAL]
case hsymm
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : TangentBundle I H
x : ModelProd H E
⊢ ↑(LocalEquiv.symm (chartAt (ModelProd H E) p).toLocalEquiv) x =
↑(LocalEquiv.symm (Equiv.toLocalEquiv (TotalSpace.toProd H E))) x
[PROOFSTEP]
refine congr_arg (TotalSpace.mk _) ?_
[GOAL]
case hsymm
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : TangentBundle I H
x : ModelProd H E
⊢ FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p.proj)
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(↑(LocalEquiv.symm
(LocalHomeomorph.restrOpen (chartAt (ModelProd H E) (↑(chartAt (H × E) p) p))
(chartAt (H × E) p).toLocalEquiv.target
(_ : IsOpen (chartAt (H × E) p).toLocalEquiv.target)).toLocalEquiv)
x).fst)
(↑(LocalEquiv.symm
(LocalHomeomorph.restrOpen (chartAt (ModelProd H E) (↑(chartAt (H × E) p) p))
(chartAt (H × E) p).toLocalEquiv.target
(_ : IsOpen (chartAt (H × E) p).toLocalEquiv.target)).toLocalEquiv)
x).fst
(↑(LocalEquiv.symm
(LocalHomeomorph.restrOpen (chartAt (ModelProd H E) (↑(chartAt (H × E) p) p))
(chartAt (H × E) p).toLocalEquiv.target
(_ : IsOpen (chartAt (H × E) p).toLocalEquiv.target)).toLocalEquiv)
x).snd =
x.snd
[PROOFSTEP]
exact (tangentBundleCore I H).coordChange_self (achart _ x.1) x.1 (mem_achart_source H x.1) x.2
[GOAL]
case hs
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : TangentBundle I H
⊢ (chartAt (ModelProd H E) p).toLocalEquiv.source = (Equiv.toLocalEquiv (TotalSpace.toProd H E)).source
[PROOFSTEP]
simp_rw [TangentBundle.chartAt, FiberBundleCore.localTriv, FiberBundleCore.localTrivAsLocalEquiv,
VectorBundleCore.toFiberBundleCore_baseSet, tangentBundleCore_baseSet]
[GOAL]
case hs
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : TangentBundle I H
⊢ ({
toLocalEquiv :=
{
toFun := fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd),
invFun := fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd },
source :=
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source,
target := (↑(achart H p.proj)).source ×ˢ univ,
map_source' :=
(_ :
∀ ⦃x : FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x ∈
(↑(achart H p.proj)).source ×ˢ univ),
map_target' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source),
left_inv' :=
(_ :
∀ ⦃x : FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
((fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x) =
x),
right_inv' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
((fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x) =
x) },
open_source :=
(_ :
IsOpen
{
toFun := fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.proj)
(achart H p.proj) p_1.proj p_1.snd),
invFun := fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.fst)
p_1.fst p_1.snd },
source :=
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source,
target := (↑(achart H p.proj)).source ×ˢ univ,
map_source' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x ∈
(↑(achart H p.proj)).source ×ˢ univ),
map_target' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source),
left_inv' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
((fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x) =
x),
right_inv' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
((fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x) =
x) }.source),
open_target :=
(_ :
IsOpen
{
toFun := fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.proj)
(achart H p.proj) p_1.proj p_1.snd),
invFun := fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.fst)
p_1.fst p_1.snd },
source :=
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source,
target := (↑(achart H p.proj)).source ×ˢ univ,
map_source' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x ∈
(↑(achart H p.proj)).source ×ˢ univ),
map_target' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source),
left_inv' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
((fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x) =
x),
right_inv' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
((fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x) =
x) }.target),
continuous_toFun :=
(_ :
ContinuousOn
↑{
toFun := fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.proj)
(achart H p.proj) p_1.proj p_1.snd),
invFun := fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.fst)
p_1.fst p_1.snd },
source :=
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source,
target := (↑(achart H p.proj)).source ×ˢ univ,
map_source' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x ∈
(↑(achart H p.proj)).source ×ˢ univ),
map_target' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source),
left_inv' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
((fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x) =
x),
right_inv' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
((fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x) =
x) }
{
toFun := fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.proj)
(achart H p.proj) p_1.proj p_1.snd),
invFun := fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.fst)
p_1.fst p_1.snd },
source :=
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source,
target := (↑(achart H p.proj)).source ×ˢ univ,
map_source' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x ∈
(↑(achart H p.proj)).source ×ˢ univ),
map_target' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source),
left_inv' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
((fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x) =
x),
right_inv' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
((fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x) =
x) }.source),
continuous_invFun :=
(_ :
ContinuousOn
{
toFun := fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.proj)
(achart H p.proj) p_1.proj p_1.snd),
invFun := fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.fst)
p_1.fst p_1.snd },
source :=
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source,
target := (↑(achart H p.proj)).source ×ˢ univ,
map_source' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x ∈
(↑(achart H p.proj)).source ×ˢ univ),
map_target' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source),
left_inv' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
((fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x) =
x),
right_inv' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
((fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x) =
x) }.invFun
{
toFun := fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.proj)
(achart H p.proj) p_1.proj p_1.snd),
invFun := fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
p_1.fst)
p_1.fst p_1.snd },
source :=
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source,
target := (↑(achart H p.proj)).source ×ˢ univ,
map_source' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x ∈
(↑(achart H p.proj)).source ×ˢ univ),
map_target' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source),
left_inv' :=
(_ :
∀
⦃x :
FiberBundleCore.TotalSpace (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))⦄,
x ∈
FiberBundleCore.proj (VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) ⁻¹'
(↑(achart H p.proj)).source →
(fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) (achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
((fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
x) =
x),
right_inv' :=
(_ :
∀ ⦃x : H × E⦄,
x ∈ (↑(achart H p.proj)).source ×ˢ univ →
(fun p_1 =>
(p_1.proj,
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.proj)
(achart H p.proj) p_1.proj p_1.snd))
((fun p_1 =>
{ proj := p_1.fst,
snd :=
FiberBundleCore.coordChange
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H))
(achart H p.proj)
(FiberBundleCore.indexAt
(VectorBundleCore.toFiberBundleCore (tangentBundleCore I H)) p_1.fst)
p_1.fst p_1.snd })
x) =
x) }.target) } ≫ₕ
LocalHomeomorph.prod (chartAt H p.proj) (LocalHomeomorph.refl E)).toLocalEquiv.source =
(Equiv.toLocalEquiv (TotalSpace.toProd H E)).source
[PROOFSTEP]
simp only [mfld_simps]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : TangentBundle I H
⊢ ↑(chartAt (ModelProd H E) p) = ↑(TotalSpace.toProd H E)
[PROOFSTEP]
rw [← LocalHomeomorph.coe_coe, tangentBundle_model_space_chartAt]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : TangentBundle I H
⊢ ↑(Equiv.toLocalEquiv (TotalSpace.toProd H E)) = ↑(TotalSpace.toProd H E)
[PROOFSTEP]
rfl
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : TangentBundle I H
⊢ ↑(LocalHomeomorph.symm (chartAt (ModelProd H E) p)) = ↑(TotalSpace.toProd H E).symm
[PROOFSTEP]
rw [← LocalHomeomorph.coe_coe, LocalHomeomorph.symm_toLocalEquiv, tangentBundle_model_space_chartAt]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
p : TangentBundle I H
⊢ ↑(LocalEquiv.symm (Equiv.toLocalEquiv (TotalSpace.toProd H E))) = ↑(TotalSpace.toProd H E).symm
[PROOFSTEP]
rfl
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
x x' z : H
⊢ VectorBundleCore.coordChange (tangentBundleCore I H) (achart H x) (achart H x') z = ContinuousLinearMap.id 𝕜 E
[PROOFSTEP]
ext v
[GOAL]
case h
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
x x' z : H
v : E
⊢ ↑(VectorBundleCore.coordChange (tangentBundleCore I H) (achart H x) (achart H x') z) v =
↑(ContinuousLinearMap.id 𝕜 E) v
[PROOFSTEP]
exact (tangentBundleCore I H).coordChange_self (achart _ z) z (mem_univ _) v
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
⊢ Continuous
{ toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }.toFun
[PROOFSTEP]
let p : TangentBundle I H := ⟨I.symm (0 : E), (0 : E)⟩
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
p : TangentBundle I H := { proj := ↑(ModelWithCorners.symm I) 0, snd := 0 }
⊢ Continuous
{ toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }.toFun
[PROOFSTEP]
have : Continuous (chartAt (ModelProd H E) p) :=
by
rw [continuous_iff_continuousOn_univ]
convert (chartAt (ModelProd H E) p).continuousOn
simp only [TangentSpace.fiberBundle, mfld_simps]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
p : TangentBundle I H := { proj := ↑(ModelWithCorners.symm I) 0, snd := 0 }
⊢ Continuous ↑(chartAt (ModelProd H E) p)
[PROOFSTEP]
rw [continuous_iff_continuousOn_univ]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
p : TangentBundle I H := { proj := ↑(ModelWithCorners.symm I) 0, snd := 0 }
⊢ ContinuousOn (↑(chartAt (ModelProd H E) p)) univ
[PROOFSTEP]
convert (chartAt (ModelProd H E) p).continuousOn
[GOAL]
case h.e'_6
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
p : TangentBundle I H := { proj := ↑(ModelWithCorners.symm I) 0, snd := 0 }
⊢ univ = (chartAt (ModelProd H E) p).toLocalEquiv.source
[PROOFSTEP]
simp only [TangentSpace.fiberBundle, mfld_simps]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
p : TangentBundle I H := { proj := ↑(ModelWithCorners.symm I) 0, snd := 0 }
this : Continuous ↑(chartAt (ModelProd H E) p)
⊢ Continuous
{ toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }.toFun
[PROOFSTEP]
simpa only [mfld_simps] using this
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
⊢ Continuous
{ toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }.invFun
[PROOFSTEP]
let p : TangentBundle I H := ⟨I.symm (0 : E), (0 : E)⟩
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
p : TangentBundle I H := { proj := ↑(ModelWithCorners.symm I) 0, snd := 0 }
⊢ Continuous
{ toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }.invFun
[PROOFSTEP]
have : Continuous (chartAt (ModelProd H E) p).symm :=
by
rw [continuous_iff_continuousOn_univ]
convert (chartAt (ModelProd H E) p).symm.continuousOn
simp only [mfld_simps]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
p : TangentBundle I H := { proj := ↑(ModelWithCorners.symm I) 0, snd := 0 }
⊢ Continuous ↑(LocalHomeomorph.symm (chartAt (ModelProd H E) p))
[PROOFSTEP]
rw [continuous_iff_continuousOn_univ]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
p : TangentBundle I H := { proj := ↑(ModelWithCorners.symm I) 0, snd := 0 }
⊢ ContinuousOn (↑(LocalHomeomorph.symm (chartAt (ModelProd H E) p))) univ
[PROOFSTEP]
convert (chartAt (ModelProd H E) p).symm.continuousOn
[GOAL]
case h.e'_6
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
p : TangentBundle I H := { proj := ↑(ModelWithCorners.symm I) 0, snd := 0 }
⊢ univ = (LocalHomeomorph.symm (chartAt (ModelProd H E) p)).toLocalEquiv.source
[PROOFSTEP]
simp only [mfld_simps]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
src✝ : (TotalSpace E fun x => E) ≃ H × E := TotalSpace.toProd H E
p : TangentBundle I H := { proj := ↑(ModelWithCorners.symm I) 0, snd := 0 }
this : Continuous ↑(LocalHomeomorph.symm (chartAt (ModelProd H E) p))
⊢ Continuous
{ toFun := src✝.toFun, invFun := src✝.invFun, left_inv := (_ : Function.LeftInverse src✝.invFun src✝.toFun),
right_inv := (_ : Function.RightInverse src✝.invFun src✝.toFun) }.invFun
[PROOFSTEP]
simpa only [mfld_simps] using this
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
N : Type u_9
x₀ x : H
y₀ y : H'
ϕ : E →L[𝕜] E'
⊢ inCoordinates E (TangentSpace I) E' (TangentSpace I') x₀ x y₀ y ϕ = ϕ
[PROOFSTEP]
erw [VectorBundleCore.inCoordinates_eq]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
N : Type u_9
x₀ x : H
y₀ y : H'
ϕ : E →L[𝕜] E'
⊢ comp
(VectorBundleCore.coordChange (tangentBundleCore I' H') (VectorBundleCore.indexAt (tangentBundleCore I' H') y)
(VectorBundleCore.indexAt (tangentBundleCore I' H') y₀) y)
(comp ϕ
(VectorBundleCore.coordChange (tangentBundleCore I H) (VectorBundleCore.indexAt (tangentBundleCore I H) x₀)
(VectorBundleCore.indexAt (tangentBundleCore I H) x) x)) =
ϕ
[PROOFSTEP]
try trivial
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
N : Type u_9
x₀ x : H
y₀ y : H'
ϕ : E →L[𝕜] E'
⊢ comp
(VectorBundleCore.coordChange (tangentBundleCore I' H') (VectorBundleCore.indexAt (tangentBundleCore I' H') y)
(VectorBundleCore.indexAt (tangentBundleCore I' H') y₀) y)
(comp ϕ
(VectorBundleCore.coordChange (tangentBundleCore I H) (VectorBundleCore.indexAt (tangentBundleCore I H) x₀)
(VectorBundleCore.indexAt (tangentBundleCore I H) x) x)) =
ϕ
[PROOFSTEP]
trivial
[GOAL]
case hx
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
N : Type u_9
x₀ x : H
y₀ y : H'
ϕ : E →L[𝕜] E'
⊢ x ∈ VectorBundleCore.baseSet (tangentBundleCore I H) (VectorBundleCore.indexAt (tangentBundleCore I H) x₀)
[PROOFSTEP]
try trivial
[GOAL]
case hx
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
N : Type u_9
x₀ x : H
y₀ y : H'
ϕ : E →L[𝕜] E'
⊢ x ∈ VectorBundleCore.baseSet (tangentBundleCore I H) (VectorBundleCore.indexAt (tangentBundleCore I H) x₀)
[PROOFSTEP]
trivial
[GOAL]
case hy
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
N : Type u_9
x₀ x : H
y₀ y : H'
ϕ : E →L[𝕜] E'
⊢ y ∈ VectorBundleCore.baseSet (tangentBundleCore I' H') (VectorBundleCore.indexAt (tangentBundleCore I' H') y₀)
[PROOFSTEP]
try trivial
[GOAL]
case hy
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
N : Type u_9
x₀ x : H
y₀ y : H'
ϕ : E →L[𝕜] E'
⊢ y ∈ VectorBundleCore.baseSet (tangentBundleCore I' H') (VectorBundleCore.indexAt (tangentBundleCore I' H') y₀)
[PROOFSTEP]
trivial
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
N : Type u_9
x₀ x : H
y₀ y : H'
ϕ : E →L[𝕜] E'
⊢ comp
(VectorBundleCore.coordChange (tangentBundleCore I' H') (VectorBundleCore.indexAt (tangentBundleCore I' H') y)
(VectorBundleCore.indexAt (tangentBundleCore I' H') y₀) y)
(comp ϕ
(VectorBundleCore.coordChange (tangentBundleCore I H) (VectorBundleCore.indexAt (tangentBundleCore I H) x₀)
(VectorBundleCore.indexAt (tangentBundleCore I H) x) x)) =
ϕ
[PROOFSTEP]
simp_rw [tangentBundleCore_indexAt, tangentBundleCore_coordChange_model_space, ContinuousLinearMap.id_comp,
ContinuousLinearMap.comp_id]
[GOAL]
𝕜 : Type u_1
inst✝¹⁴ : NontriviallyNormedField 𝕜
E : Type u_2
inst✝¹³ : NormedAddCommGroup E
inst✝¹² : NormedSpace 𝕜 E
E' : Type u_3
inst✝¹¹ : NormedAddCommGroup E'
inst✝¹⁰ : NormedSpace 𝕜 E'
H : Type u_4
inst✝⁹ : TopologicalSpace H
I : ModelWithCorners 𝕜 E H
H' : Type u_5
inst✝⁸ : TopologicalSpace H'
I' : ModelWithCorners 𝕜 E' H'
M : Type u_6
inst✝⁷ : TopologicalSpace M
inst✝⁶ : ChartedSpace H M
inst✝⁵ : SmoothManifoldWithCorners I M
M' : Type u_7
inst✝⁴ : TopologicalSpace M'
inst✝³ : ChartedSpace H' M'
inst✝² : SmoothManifoldWithCorners I' M'
F : Type u_8
inst✝¹ : NormedAddCommGroup F
inst✝ : NormedSpace 𝕜 F
N : Type u_9
f : N → H
g : N → H'
ϕ : N → E →L[𝕜] E'
x₀ : N
⊢ inTangentCoordinates I I' f g ϕ x₀ = ϕ
[PROOFSTEP]
simp_rw [inTangentCoordinates, inCoordinates_tangent_bundle_core_model_space]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
H : Type u_2
inst✝³ : TopologicalSpace H
I : ModelWithCorners ℝ E H
M : Type u_3
inst✝² : TopologicalSpace M
inst✝¹ : ChartedSpace H M
inst✝ : SmoothManifoldWithCorners I M
x : M
⊢ PathConnectedSpace (TangentSpace I x)
[PROOFSTEP]
unfold TangentSpace
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
H : Type u_2
inst✝³ : TopologicalSpace H
I : ModelWithCorners ℝ E H
M : Type u_3
inst✝² : TopologicalSpace M
inst✝¹ : ChartedSpace H M
inst✝ : SmoothManifoldWithCorners I M
x : M
⊢ PathConnectedSpace E
[PROOFSTEP]
infer_instance
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.