Datasets:
AI4M
/

text
stringlengths
0
3.34M
% !TEX root=/home/tavant/these/manuscript/src/manuscript.tex \section{Sheath model with electron emission} \label{sec-sheath} The floating sheath is the plasma response to the presence of an absorbing boundary. The light electrons are quickly absorbed by the material. Hence, in order to balance the particles fluxes, a non-neutral region appears between the plasma and the boundary. The sheath model featuring SEE processes has been historically studied by \citet{hobbs1967}, but is still an active research topic nowadays \citep{ahedo2005}. The sheath is often considered to be collisionless and isothermal, while the plasma is composed of hot Maxwellian electrons and cold ions. A third population of electron-induced secondary electrons is also present in the sheath, and the re-emission rate $\rate$ is assumed to be constant. The sheath must ensure the charge balance, hence \begin{equation} \label{eq-sheath_SEE} \Gamma_i = ( 1 - \rate) \Gamma_e \end{equation} with $\Gamma_i$ and $\Gamma_e$ the ion and electron particle flux to the wall, respectively. \nomenclature[Q]{\ensuremath{ \Gamma_s}}{Particle flux of the species $s$} The SEE process modifies the potential drop in the sheath as \citep{hobbs1967} \begin{equation} \label{eq-sheathhobbs} \dphisheath = \Te \ln \lp (1 - \rate) \sqrt{\frac{m_i}{2 \pi m_e}} \rp. \end{equation} Adding a pre-sheath drop of $\Te/2$ \citep{ahedo2002}, the total potential drop to the wall becomes \begin{equation} \label{eq-total_drop} \dphi = \dphisheath + \frac{\Te}{2} = \Te \lp \frac{1}{2} + \ln \lb (1 - \rate) \sqrt{\frac{m_i}{2 \pi m_e}} \rb \rp \end{equation} We can see that \cref{eq-sheathhobbs} becomes negative for a critical value of the emission rate \begin{equation} \label{eq-ratecrone} \rate_{\rm max} = 1 - \sqrt{\frac{2 \pi m_e}{m_i}} \simeq 0.985 \text{ for xenon.} \end{equation} However, before that $\rate$ reaches $\rate_{\rm max}$, the model of \citet{hobbs1967} presents another behavior against the hypotheses of \cref{eq-sheathhobbs}, as the sheath becomes \ac{SCL}. In the \ac{SCL} conditions, the electron emission is so large that the electric field at the wall becomes zero \begin{equation} \label{eq-scl_Er} \deriv{\phi}{r} \at{\rm wall}= 0 \end{equation} In this case, the plasma potential drop to the wall for any ion mass is \citep{hobbs1967} \begin{equation} \label{eq-dphi_scl} \dphiscl \simeq 1.02 \Te \simeq \Te, \end{equation} and the limit emission rate is \begin{equation} \label{eq-ratecr} \ratecr \simeq 1 - 8.3 \sqrt{\frac{m_e}{m_i}} \end{equation} For xenon, \cref{eq-ratecr} gives $\ratecr = 0.983$ \citep{goebel2008}. \Cref{fig-potential_profile} illustrates the sheath model of \citet{hobbs1967} by showing the plasma potential profile in the sheath for different values of electron emission rate for a xenon plasma. \cref{fig-potential_profile}.{\bf a} gives the potential $\phi$ normalized by $\dphisheath$ from \cref{eq-sheathhobbs}, and \cref{fig-potential_profile}.{\bf b} gives $\phi$ normalized by $\Te$. We can see in \cref{fig-potential_profile} that for $\rate < \ratecr$, the plasma potential reached $\dphisheath$. However, for $\rate > \ratecr$, the plasma potential does not reach $\dphisheath$, resulting in a non-zero current to the wall. Indeed, the sheath is not monotonic in this case, hence the hypotheses needed to develop \cref{eq-sheathhobbs} are not fulfilled. We see in \cref{fig-potential_profile}.{\bf a} that \cref{eq-sheathhobbs} is correct even for $\rate=0.984 > \ratecr$. This is because the value $\ratecr = 0.983$ is obtained after several approximations, as \cref{eq-scl_Er}, some of which should not allow to use three significant digits. In \cref{fig-potential_profile}.{\bf b}, we can see that at $\rate \simeq \ratecr$, the plasma potential tends towards $\Te$, as mentioned by \cref{eq-dphi_scl}. \begin{figure}[hbt] \centering \begin{tabular}{@{} c c} \subfigure{plasma_profile_normed}{a}{25,70} & \subfigure{plasma_profile}{b}{25,20} \end{tabular} \caption{Evolution of the plasma potential in the sheath for different values of electron emission rate $\rate$ for a xenon plasma, ({\bf a}) normalized by the total potential drop $\dphisheath$ from \cref{eq-sheathhobbs}, and ({\bf b}) normalized by the electron temperature, but $\dphisheath/\Te$ is noted with the black dotted line. } \label{fig-potential_profile} \end{figure}
-- Andreas, 2012-06-01, issue reported by fredrik.forsberg module Issue661 where import Common.Level data Top : Set where tt : Top mutual data Ctxt : Set1 where [] : Ctxt cons : (G : Ctxt) -> (Env G -> Set) -> Ctxt Env : Ctxt -> Set --only important that Env x doesn't reduce for x neutral Env [] = Top Env (cons G A) = Top module M (dummy : Set1) where data Uni (G : Ctxt) : Set1 where empty : Uni G sig : (A : Env G -> Set) -> Uni (cons G A) -> Uni G open M Set -- This example needs special constructor application checking -- which propagates the parameters in. c : Uni [] c = sig (\ _ -> Top) (sig (\ { tt -> Top}) empty) -- Types: -- empty : Uni _18 -- sig : (A : Env _15 → Set) → Uni (cons _15 A) → Uni _15 -- c = sig (\ _ → Top) ?2 with ?2 : Uni (cons [] (λ _ → Top)) -- ?2 := sig ?3 ?4 with -- ?3 : Env (cons [] (λ _ → Top)) → Set -- ?4 : Uni (cons (cons [] (λ _ → Top)) ?3) -- Error was: -- Type mismatch -- when checking that the pattern tt has type Env _14
import numpy as np import torch import torch.optim as optim import torch.nn.functional as F from network import MADDPGNet from OUNoise import OUNoise # pylint: disable=E1101 class MADDPGAgent(): """Interacts with and learns from the environment.""" def __init__(self, num_agents, state_size, action_size, actor_units, critic_units, memory, batch_size, device='cpu', lr_actor=1e-4, lr_critic=1e-4, weight_decay=0, gamma=0.99, tau=1e-3, update_every = 10): """Initialize an Agent object. Params ====== num_agents (int): number of agents state_size (int): dimension of each state action_size (int): dimension of each action actor_units (list int): configuration of layers for Actor nets critic_units (list list int): configuration of layers for Critic nets memory (ReplayBuffer): pre-created and loaded memory buffer to use batch_size (int): the size of the sampling from the replay buffer device (str): the hardware where the computation will happen lr_actor (float): learning rate for actor network lr_critic (float): learning rate for critic network weight_decay (float): weight decay for the critic optimizer gamma (float): discount factor for return tau (float): factor for soft update of target networks update_every (int): after how many steps we perform a training """ self.num_agents = num_agents self.state_size = state_size self.action_size = action_size self.actor_units = actor_units self.critic_units = critic_units self.lr_actor = lr_actor self.lr_critic = lr_critic self.gamma = gamma self.tau = tau self.steps = 0 self.update_every = update_every # setup the nets: one for each agent self.net = MADDPGNet(num_agents=num_agents, obs_size=state_size, action_size=action_size, actor_fc_units=actor_units, critic_fc_units=critic_units).to(device) actor_for_opt = torch.nn.ModuleList([actor.local for actor in self.net.actors]) self.actor_optimizer = optim.Adam(actor_for_opt.parameters(), lr=lr_actor) self.critic_optimizer = optim.Adam(self.net.critic.local.parameters(), lr=lr_critic, weight_decay=weight_decay) # Noise process self.noise = OUNoise(action_size) # Replay memory self.memory = memory self.batch_size = batch_size self.device = device def step(self, obs, actions, rewards, next_obs, dones): """Save experience in replay memory, and use random sample from buffer to learn.""" self.memory.push(obs, actions, rewards, next_obs, dones) # Learn, if enough samples are available in memory self.steps += 1 if len(self.memory) > self.batch_size and self.steps % self.update_every == 0: self.learn() def act(self, obs, eps, add_noise=True): """Returns actions for given state as per current policy for each agent. eps (float): a decay factor for application of noise """ actions = [] for agent in range(self.num_agents): ag_obs = torch.from_numpy(obs[agent]).float().to(self.device) curr_actor = self.net.actors_local()[agent] curr_actor.eval() with torch.no_grad(): action = curr_actor(ag_obs).cpu().data.numpy() curr_actor.train() if add_noise: action += eps * self.noise() action = np.clip(action, -1, 1) actions.append(action) return np.array(actions) def reset(self): self.noise.reset() def learn(self): """Update policy and value parameters using given batch of experience tuples. Q_targets = r + γ * critic_target(next_state, actor_target(next_state)) where: actor_target(state) -> action critic_target(state, action) -> Q-value """ # draw samples experiences = self.memory.sample(self.batch_size, self.device) # unpack experience obs, actions, rewards, next_obs, dones = experiences # remember these are provided: samples x agents x data dimension n_samples = obs.size()[0] # ---------------------------- update critic ---------------------------- # # Get predicted next-state actions and Q values from target models next_obs_t = torch.transpose(next_obs, 0, 1) actions_next = [self.net.actors_target()[agent](next_obs_t[agent]) \ for agent in range(self.num_agents)] actions_next = torch.stack(actions_next) actions_next = torch.transpose(actions_next, 0, 1) actions_next= torch.reshape(actions_next, (n_samples, -1)) next_obs_2d = torch.reshape(next_obs, (n_samples, -1)) Q_targets_next = self.net.critic.target(next_obs_2d, actions_next) # Compute Q targets for current states (y_i) Q_targets = rewards + (self.gamma * Q_targets_next * (1 - dones)) # Compute critic loss obs_2d = torch.reshape(obs, (n_samples, -1)) actions_2d = torch.reshape(actions, (n_samples, -1)) Q_expected = self.net.critic.local(obs_2d, actions_2d) critic_loss = F.mse_loss(Q_expected, Q_targets) # Minimize the loss self.critic_optimizer.zero_grad() critic_loss.backward() torch.nn.utils.clip_grad_norm_(self.net.critic.local.parameters(), 1) self.critic_optimizer.step() # ---------------------------- update actor ---------------------------- # # Compute actor loss obs_t = torch.transpose(obs, 0, 1) actions_pred = [self.net.actors_local()[agent](obs_t[agent]) \ for agent in range(self.num_agents)] actions_pred = torch.stack(actions_pred) actions_pred = torch.transpose(actions_pred, 0, 1) actions_pred= torch.reshape(actions_pred, (n_samples, -1)) actor_loss = - self.net.critic.local(obs_2d, actions_pred).mean() # Minimize the loss self.actor_optimizer.zero_grad() actor_loss.backward() self.actor_optimizer.step() # ----------------------- update target networks ----------------------- # self.net.soft_update(self.tau) def save(self, filename): """Save the model parameters. Params ====== filename (str): file name including path The method will save the weights of all networks in the specified directory """ torch.save(self.net.state_dict(), filename) def load(self, filename): """ Loads the model parameters. All agents will be initialized to the same paramters as read from the file. Params ====== filename (str): file name including path The method will save the weights of all networks in the specified directory """ self.net.load_state_dict(torch.load(filename)) # pylint: enable=E1101
structure Something (i: Nat) where n1: Nat := 1 n2: Nat := 1 + i def s : Something 10 := {} example : s.n2 = 11 := rfl
[STATEMENT] lemma NonceCCA_secrecy: "[|Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent(CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr|] ==> Nonce NonceCCA \<notin> analz (knows Spy evs)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr\<rbrakk> \<Longrightarrow> Nonce NonceCCA \<notin> analz (knows Spy evs) [PROOF STEP] apply (frule Gets_certificate_valid, assumption) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr; EKi = pubEK (CA i) \<and> SKi = pubSK (CA i)\<rbrakk> \<Longrightarrow> Nonce NonceCCA \<notin> analz (knows Spy evs) [PROOF STEP] apply (subgoal_tac "Key KC2 \<notin> analz (knows Spy evs) ") [PROOF STATE] proof (prove) goal (2 subgoals): 1. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr; EKi = pubEK (CA i) \<and> SKi = pubSK (CA i); Key KC2 \<notin> analz (knows Spy evs)\<rbrakk> \<Longrightarrow> Nonce NonceCCA \<notin> analz (knows Spy evs) 2. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr; EKi = pubEK (CA i) \<and> SKi = pubSK (CA i)\<rbrakk> \<Longrightarrow> Key KC2 \<notin> analz (knows Spy evs) [PROOF STEP] apply (blast dest: NonceCCA_secrecy_lemma) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr; EKi = pubEK (CA i) \<and> SKi = pubSK (CA i)\<rbrakk> \<Longrightarrow> Key KC2 \<notin> analz (knows Spy evs) [PROOF STEP] apply (rule symKey_secrecy) [PROOF STATE] proof (prove) goal (6 subgoals): 1. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr; EKi = pubEK (CA i) \<and> SKi = pubSK (CA i)\<rbrakk> \<Longrightarrow> CA ?i53 \<notin> bad 2. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr; EKi = pubEK (CA i) \<and> SKi = pubSK (CA i)\<rbrakk> \<Longrightarrow> KC2 \<in> symKeys 3. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr; EKi = pubEK (CA i) \<and> SKi = pubSK (CA i)\<rbrakk> \<Longrightarrow> evs \<in> set_cr 4. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr; EKi = pubEK (CA i) \<and> SKi = pubSK (CA i)\<rbrakk> \<Longrightarrow> Says (Cardholder ?c53) (CA ?i53) ?X53 \<in> set evs 5. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr; EKi = pubEK (CA i) \<and> SKi = pubSK (CA i)\<rbrakk> \<Longrightarrow> Key KC2 \<in> parts {?X53} 6. \<lbrakk>Cardholder k \<notin> bad; CA i \<notin> bad; Gets (Cardholder k) (Crypt KC2 \<lbrace>sign (priSK (CA i)) \<lbrace>Agent C, Nonce N, Agent (CA i), Nonce NonceCCA\<rbrace>, X, Y\<rbrace>) \<in> set evs; Says (Cardholder k) (CA i) \<lbrace>Crypt KC3 \<lbrace>Agent C, Nonce NC3, Key KC2, X'\<rbrace>, Y'\<rbrace> \<in> set evs; Gets A \<lbrace>Z, cert (CA i) EKi onlyEnc (priSK RCA), cert (CA i) SKi onlySig (priSK RCA)\<rbrace> \<in> set evs; KC2 \<in> symKeys; evs \<in> set_cr; EKi = pubEK (CA i) \<and> SKi = pubSK (CA i)\<rbrakk> \<Longrightarrow> Cardholder ?c53 \<notin> bad [PROOF STEP] apply (auto simp add: parts_insert2) [PROOF STATE] proof (prove) goal: No subgoals! [PROOF STEP] done
On 12 June 2006 , with his contract expired , Stansfield decided to remain in the Conference , joining Exeter City . He told local radio that his aim was not to achieve promotion or reach a certain tally of goals , but to influence the club 's younger players .
/////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <[email protected]> // // See accompanying file COPYING.TXT file for licensing details. // /////////////////////////////////////////////////////////////////////////////// #define CPPCMS_SOURCE #include <cppcms/urandom.h> #include <cppcms/cppcms_error.h> #ifdef CPPCMS_WIN_NATIVE #include <sstream> #include <booster/thread.h> #ifndef NOMINMAX #define NOMINMAX #endif #include "windows.h" #include "wincrypt.h" namespace cppcms { class urandom_device_impl { public: urandom_device_impl() { if(CryptAcquireContext(&provider_,0,0,PROV_RSA_FULL,CRYPT_VERIFYCONTEXT)) return; if(GetLastError() == (DWORD)(NTE_BAD_KEYSET)) { if(CryptAcquireContext(&provider_,0,0,PROV_RSA_FULL,CRYPT_NEWKEYSET)) return; } std::ostringstream ss; ss<<"CryptAcquireContext failed with code 0x"<<std::hex<<GetLastError(); throw cppcms_error(ss.str()); } ~urandom_device_impl() { CryptReleaseContext(provider_,0); } void generate(void *ptr,unsigned len) { if(CryptGenRandom(provider_,len,static_cast<BYTE *>(ptr))) return; std::ostringstream ss; ss<<"CryptGenRandom failed with code 0x"<<std::hex<<GetLastError(); throw cppcms_error(ss.str()); } private: HCRYPTPROV provider_; }; booster::thread_specific_ptr<urandom_device_impl> urandom_device_impl_ptr; struct urandom_device::_data {}; urandom_device::urandom_device() { } urandom_device::~urandom_device() { } void urandom_device::generate(void *ptr,unsigned len) { if(!urandom_device_impl_ptr.get()) urandom_device_impl_ptr.reset(new urandom_device_impl()); urandom_device_impl_ptr->generate(ptr,len); } } // cppcms #else #ifndef CPPCMS_WIN32 #include "daemonize.h" #endif #include <sys/types.h> #include <sys/stat.h> #include <errno.h> #include <fcntl.h> #include <unistd.h> namespace cppcms { struct urandom_device::_data {}; urandom_device::urandom_device() { } urandom_device::~urandom_device() { } void urandom_device::generate(void *ptr,unsigned len) { if(len == 0) return; int n = 0; #ifndef CPPCMS_WIN32 if(impl::daemonizer::global_urandom_fd!=-1) { n = read(impl::daemonizer::global_urandom_fd,ptr,len); } else #endif { int fd = open("/dev/urandom",O_RDONLY); if(!fd) throw cppcms_error("Failed to open /dev/urandom"); while(len > 0) { n = read(fd,ptr,len); if(n < 0 && errno == EINTR) continue; if(n <= 0) break; ptr = static_cast<char *>(ptr) + n; len -= n; } close(fd); } if(len > 0) { throw cppcms_error("Failed to read /dev/urandom"); } } } #endif
#ifndef HERMIT_DELAYED_HPP #define HERMIT_DELAYED_HPP #include <boost/config.hpp> #ifdef BOOST_NO_0X_HDR_MUTEX #include <boost/thread/mutex.hpp> #else #include <mutex> #endif #ifdef BOOST_NO_0X_HDR_FUTURE #include <boost/thread/future.hpp> #else #include <future> #endif #include <boost/tr1/memory.hpp> #include <boost/tr1/functional.hpp> #include <boost/variant.hpp> namespace hermit { template< typename T > class delayed_internal { public: typedef #ifdef BOOST_NO_0X_HDR_FUTURE boost::promise< T > #else std::promise< T > #endif promise; typedef #ifdef BOOST_NO_0X_HDR_FUTURE boost::unique_future< T > #else std::future< T > #endif future; typedef #ifdef BOOST_NO_0X_HDR_MUTEX boost::mutex #else std::mutex #endif mutex; delayed_internal( std::shared_ptr< promise > value_ ) : value( value_ ) { dereference = std::bind( &delayed_internal<T>::initial_access, this ); } const T &operator*() const { return dereference(); } operator T() const { return dereference(); } private: const T &initial_access() { #ifdef BOOST_NO_0X_HDR_MUTEX boost::mutex::scoped_lock lock( guard ); #else std::lock_guard< std::mutex > lock( guard ); #endif if( value.which() == 0 ) { value = boost::get< std::shared_ptr< promise > >( value )->get_future().get(); dereference = std::bind( &delayed_internal<T>::cached_access, this ); } return boost::get< T >( value ); } const T &cached_access() { return boost::get< T >( value ); } mutable std::function< const T&() > dereference; boost::variant< std::shared_ptr< promise >, T > value; mutex guard; }; template< typename T > class delayed { public: typedef #ifdef BOOST_NO_0X_HDR_FUTURE boost::promise< T > #else std::promise< T > #endif promise; delayed( std::shared_ptr< promise > value_ ) : internal( new delayed_internal< T >( value_ ) ) { } const T &operator*() const { return **internal; } operator T() const { return **internal; } private: std::shared_ptr< delayed_internal< T > > internal; }; } #endif
[STATEMENT] lemma hypnat_diff_add_inverse2 [simp]: "\<And>m n::hypnat. m + n - n = m" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>m n. m + n - n = m [PROOF STEP] by transfer (rule diff_add_inverse2)
\chapter{Deciding on Features} When I tackled the task of deciding on which features to implement, I started by concentrating for about five minutes and write down all the features that I thought I would like to see on the app. When I first started thinking about this project, I also wanted the app to be able to remind the users to input their expenses and to encourage users to keep on tracking their expenses by using notifications to congratulate them on how much they have been saving so far, but, unfortunately, due to time constraints, I had to give up on that idea. However, that idea also inspired me to get some more original ideas of features for the application and it probably wouldn't be the same as what it is now if I didn't have the idea of trying to encourage the user to use the app as much as possible. These are the features that I came up with on my brainstorm session: \begin{itemize} \item Set automatic budget based on income \item Allow management and customization of budget \item Separate expenses into different categories \item Allow input of expenses \item Allow modification and removal of entered expenses (categories and retification of amounts) \item Calculate daily expenses based on budget \item Track daily expenses \item Remind users to enter their expenses (at opportunate times) \item Tell users how much they have been saving \item Alert users when daily budget is about to be reached \item Allow separation of expenses that count towards daily expenses or not \item Allow users to enter their income in a way that accomodates the different ways of getting paid (per hour or annual salary) and when they get paid (weekly, fortnightly or monthly) \end{itemize} After the brainstorm session, I separated all the features that I thought about into two types: the ones that would provide the basic functionality of the app and the ones that were optional for the implementation of a budget planner. When I first did this separation, I was still planning on getting the application to motivate the user through notifications. \section{Basic Features} \begin{enumerate} \item Management and customization of budget \item Allow input of expenses \item Allow input of income \item Remind users to enter their expenses \item Tell users how much they have been saving \end{enumerate} \section{Optional Features} \begin{enumerate} \item Set automatic budget based on income \item Separate expenses into different categories \item Allow modification and removal of entered expenses \item Calculate daily expenses based on budget \item Track daily expenses \item Alert users when daily budget is about to be reached \item Allow separation of expenses that count towards daily expenses or not \item Allow users to enter their income in a way that accomodates the different ways of getting paid (per hour or annual salary based) and when they get paid (weekly, fortnightly or monthly) \end{enumerate} When I separated all these expenses, I had to reduce my list of optional features to implement. For me it was pretty straight forward that all the basic features had to be implemented and that only a couple of the optional features would end up being implemented. At the time of writing this section of the report, I am now realising that I ended up implementing more optional features than what I had initially intended because of the way I designed the app and because it seemed like the application wouldn't be complete without them. \section{Final features} \begin{enumerate} \item Management and customization of budget \item Allow input of expenses \item Allow input of income \item Separate expenses into different categories \item Allow removal of entered expenses \item Calculate daily expenses based on budget \item Track daily expenses \item Tell users how much they have been saving \end{enumerate}
theory Ebackup imports Main (* Aqvist's System E: C. Benzmüller & X. Parent, 2019 *) begin nitpick_params [sat_solver = MiniSat_JNI] typedecl i (*Possible worlds.*) type_synonym \<sigma> = "(i\<Rightarrow>bool)" consts aw::i (*Actual world.*) abbreviation etrue :: "\<sigma>" ("\<^bold>\<top>") where "\<^bold>\<top> \<equiv> \<lambda>w. True" abbreviation efalse :: "\<sigma>" ("\<^bold>\<bottom>") where "\<^bold>\<bottom> \<equiv> \<lambda>w. False" abbreviation enot :: "\<sigma>\<Rightarrow>\<sigma>" ("\<^bold>\<not>_"[52]53) where "\<^bold>\<not>\<phi> \<equiv> \<lambda>w. \<not>\<phi>(w)" abbreviation eand :: "\<sigma>\<Rightarrow>\<sigma>\<Rightarrow>\<sigma>" (infixr"\<^bold>\<and>"51) where "\<phi>\<^bold>\<and>\<psi> \<equiv> \<lambda>w. \<phi>(w)\<and>\<psi>(w)" abbreviation eor :: "\<sigma>\<Rightarrow>\<sigma>\<Rightarrow>\<sigma>" (infixr"\<^bold>\<or>"50) where "\<phi>\<^bold>\<or>\<psi> \<equiv> \<lambda>w. \<phi>(w)\<or>\<psi>(w)" abbreviation eimp :: "\<sigma>\<Rightarrow>\<sigma>\<Rightarrow>\<sigma>" (infixr"\<^bold>\<rightarrow>"49) where "\<phi>\<^bold>\<rightarrow>\<psi> \<equiv> \<lambda>w. \<phi>(w)\<longrightarrow>\<psi>(w)" abbreviation eequ :: "\<sigma>\<Rightarrow>\<sigma>\<Rightarrow>\<sigma>" (infixr"\<^bold>\<leftrightarrow>"48) where "\<phi>\<^bold>\<leftrightarrow>\<psi> \<equiv> \<lambda>w. \<phi>(w)\<longleftrightarrow>\<psi>(w)" (*Possibilist--constant domain--quantification.*) abbreviation eforall ("\<^bold>\<forall>") where "\<^bold>\<forall>\<Phi> \<equiv> \<lambda>w.\<forall>x. (\<Phi> x w)" abbreviation eforallB (binder"\<^bold>\<forall>"[8]9) where "\<^bold>\<forall>x. \<phi>(x) \<equiv> \<^bold>\<forall>\<phi>" abbreviation eexists ("\<^bold>\<exists>") where "\<^bold>\<exists>\<Phi> \<equiv> \<lambda>w.\<exists>x. (\<Phi> x w)" abbreviation eexistsB (binder"\<^bold>\<exists>"[8]9) where "\<^bold>\<exists>x. \<phi>(x) \<equiv> \<^bold>\<exists>\<phi>" abbreviation ebox :: "\<sigma>\<Rightarrow>\<sigma>" ("\<box>") where "\<box> \<equiv> \<lambda>\<phi> w. \<forall>v. \<phi>(v)" consts R :: "i\<Rightarrow>\<sigma>" (infixr "R" 70) (*Betterness relation, cf. def. of \<circle><_|_>.*) abbreviation eopt :: "\<sigma>\<Rightarrow>\<sigma>" ("opt<_>") where "opt<\<phi>> \<equiv> (\<lambda>v. ( (\<phi>)(v) \<and> (\<forall>x. ((\<phi>)(x) \<longrightarrow> v R x) )) )" abbreviation esubset :: "\<sigma>\<Rightarrow>\<sigma>\<Rightarrow>bool" (infix "\<^bold>\<subseteq>" 53) where "\<phi> \<^bold>\<subseteq> \<psi> \<equiv> \<forall>x. \<phi> x \<longrightarrow> \<psi> x" abbreviation econd :: "\<sigma>\<Rightarrow>\<sigma>\<Rightarrow>\<sigma>" ("\<circle><_|_>") where "\<circle><\<psi>|\<phi>> \<equiv> \<lambda>w. opt<\<phi>> \<^bold>\<subseteq> \<psi>" abbreviation euncobl :: "\<sigma>\<Rightarrow>\<sigma>" ("\<^bold>\<circle><_>") where "\<^bold>\<circle><\<phi>> \<equiv> \<circle><\<phi>|\<^bold>\<top>>" abbreviation evalid :: "\<sigma>\<Rightarrow>bool" ("\<lfloor>_\<rfloor>"[8]109) (*Global validity.*) where "\<lfloor>p\<rfloor> \<equiv> \<forall>w. p w" abbreviation ecjactual :: "\<sigma>\<Rightarrow>bool" ("\<lfloor>_\<rfloor>\<^sub>l"[7]105) (*Local validity — in world aw.*) where "\<lfloor>p\<rfloor>\<^sub>l \<equiv> p(aw)" lemma True nitpick [satisfy,user_axioms,expect=genuine] oops (*Consistency conf.*) (*Correspondence theory.*) lemma assumes "\<forall>x y z. x R y \<and> y R z \<longrightarrow> x R z" shows "\<lfloor>((\<circle><\<psi>|\<phi>>) \<^bold>\<and> \<^bold>\<not>(\<circle><\<^bold>\<not>\<xi>|\<phi>>)) \<^bold>\<rightarrow> \<circle><\<psi>|\<phi>\<^bold>\<and>\<xi>>\<rfloor>" sledgehammer oops lemma assumes "\<lfloor>((\<circle><\<psi>|\<phi>>) \<^bold>\<and> \<^bold>\<not>(\<circle><\<^bold>\<not>\<xi>|\<phi>>)) \<^bold>\<rightarrow> \<circle><\<psi>|\<phi>\<^bold>\<and>\<xi>>\<rfloor>" shows "\<forall>x y z. x R y \<and> y R z \<longrightarrow> x R z" nitpick [show_all,format=2] (*Countermodel presented by Nitpick.*) end
[GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ : ℕ x✝ : ∃ p k, Prime p ∧ 0 < k ∧ p ^ k = n p : R k : ℕ hp : Prime p hk : 0 < k hn : p ^ k = n ⊢ p ^ (?m.60081 x✝ p k hp hk hn + 1) = n [PROOFSTEP] rwa [Nat.sub_add_cancel hk] [GOAL] R : Type u_1 inst✝¹ : CommMonoidWithZero R n p : R k : ℕ inst✝ : NoZeroDivisors R ⊢ ¬IsPrimePow 0 [PROOFSTEP] simp only [isPrimePow_def, not_exists, not_and', and_imp] [GOAL] R : Type u_1 inst✝¹ : CommMonoidWithZero R n p : R k : ℕ inst✝ : NoZeroDivisors R ⊢ ∀ (x : R) (x_1 : ℕ), 0 < x_1 → x ^ x_1 = 0 → ¬Prime x [PROOFSTEP] intro x n _hn hx [GOAL] R : Type u_1 inst✝¹ : CommMonoidWithZero R n✝ p : R k : ℕ inst✝ : NoZeroDivisors R x : R n : ℕ _hn : 0 < n hx : x ^ n = 0 ⊢ ¬Prime x [PROOFSTEP] rw [pow_eq_zero hx] [GOAL] R : Type u_1 inst✝¹ : CommMonoidWithZero R n✝ p : R k : ℕ inst✝ : NoZeroDivisors R x : R n : ℕ _hn : 0 < n hx : x ^ n = 0 ⊢ ¬Prime 0 [PROOFSTEP] simp [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k : ℕ p : R hp : Prime p ⊢ p ^ 1 = p [PROOFSTEP] simp [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n✝ p✝ : R k✝ : ℕ n : R hn✝ : IsPrimePow n k : ℕ hk : k ≠ 0 p : R k' : ℕ hp : Prime p hk' : 0 < k' hn : p ^ k' = n ⊢ p ^ (k * k') = n ^ k [PROOFSTEP] rw [pow_mul', hn] [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n✝ p : R k n : ℕ ⊢ IsPrimePow n ↔ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n [PROOFSTEP] simp only [isPrimePow_def, Nat.prime_iff] [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n✝ p : R k n : ℕ ⊢ IsPrimePow n ↔ ∃ p, p ≤ n ∧ ∃ k, k ≤ n ∧ Nat.Prime p ∧ 0 < k ∧ p ^ k = n [PROOFSTEP] rw [isPrimePow_nat_iff] [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n✝ p : R k n : ℕ ⊢ (∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n) ↔ ∃ p, p ≤ n ∧ ∃ k, k ≤ n ∧ Nat.Prime p ∧ 0 < k ∧ p ^ k = n [PROOFSTEP] refine' Iff.symm ⟨fun ⟨p, _, k, _, hp, hk, hn⟩ => ⟨p, k, hp, hk, hn⟩, _⟩ [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n✝ p : R k n : ℕ ⊢ (∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n) → ∃ p, p ≤ n ∧ ∃ k, k ≤ n ∧ Nat.Prime p ∧ 0 < k ∧ p ^ k = n [PROOFSTEP] rintro ⟨p, k, hp, hk, rfl⟩ [GOAL] case intro.intro.intro.intro R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p hk : 0 < k ⊢ ∃ p_1, p_1 ≤ p ^ k ∧ ∃ k_1, k_1 ≤ p ^ k ∧ Nat.Prime p_1 ∧ 0 < k_1 ∧ p_1 ^ k_1 = p ^ k [PROOFSTEP] refine' ⟨p, _, k, (Nat.lt_pow_self hp.one_lt _).le, hp, hk, rfl⟩ [GOAL] case intro.intro.intro.intro R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p hk : 0 < k ⊢ p ≤ p ^ k [PROOFSTEP] conv => {lhs; rw [← (pow_one p)]} [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p hk : 0 < k | p ≤ p ^ k [PROOFSTEP] {lhs; rw [← (pow_one p)]} [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p hk : 0 < k | p ≤ p ^ k [PROOFSTEP] {lhs; rw [← (pow_one p)]} [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p hk : 0 < k | p ≤ p ^ k [PROOFSTEP] lhs [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p hk : 0 < k | p [PROOFSTEP] rw [← (pow_one p)] [GOAL] case intro.intro.intro.intro R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p hk : 0 < k ⊢ p ^ 1 ≤ p ^ k [PROOFSTEP] exact (Nat.pow_le_iff_le_right hp.two_le).mpr hk [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n✝ p : R k n m : ℕ hn : IsPrimePow n hm : m ∣ n hm₁ : m ≠ 1 ⊢ IsPrimePow m [PROOFSTEP] rw [isPrimePow_nat_iff] at hn ⊢ [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n✝ p : R k n m : ℕ hn : ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = n hm : m ∣ n hm₁ : m ≠ 1 ⊢ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = m [PROOFSTEP] rcases hn with ⟨p, k, hp, _hk, rfl⟩ [GOAL] case intro.intro.intro.intro R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ m : ℕ hm₁ : m ≠ 1 p k : ℕ hp : Nat.Prime p _hk : 0 < k hm : m ∣ p ^ k ⊢ ∃ p k, Nat.Prime p ∧ 0 < k ∧ p ^ k = m [PROOFSTEP] obtain ⟨i, hik, rfl⟩ := (Nat.dvd_prime_pow hp).1 hm [GOAL] case intro.intro.intro.intro.intro.intro R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p _hk : 0 < k i : ℕ hik : i ≤ k hm₁ : p ^ i ≠ 1 hm : p ^ i ∣ p ^ k ⊢ ∃ p_1 k, Nat.Prime p_1 ∧ 0 < k ∧ p_1 ^ k = p ^ i [PROOFSTEP] refine' ⟨p, i, hp, _, rfl⟩ [GOAL] case intro.intro.intro.intro.intro.intro R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p _hk : 0 < k i : ℕ hik : i ≤ k hm₁ : p ^ i ≠ 1 hm : p ^ i ∣ p ^ k ⊢ 0 < i [PROOFSTEP] apply Nat.pos_of_ne_zero [GOAL] case intro.intro.intro.intro.intro.intro.a R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p _hk : 0 < k i : ℕ hik : i ≤ k hm₁ : p ^ i ≠ 1 hm : p ^ i ∣ p ^ k ⊢ i ≠ 0 [PROOFSTEP] rintro rfl [GOAL] case intro.intro.intro.intro.intro.intro.a R : Type u_1 inst✝ : CommMonoidWithZero R n p✝ : R k✝ p k : ℕ hp : Nat.Prime p _hk : 0 < k hik : 0 ≤ k hm₁ : p ^ 0 ≠ 1 hm : p ^ 0 ∣ p ^ k ⊢ False [PROOFSTEP] simp only [pow_zero, ne_eq] at hm₁ [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n p : R k a b : ℕ hab : coprime a b ⊢ Disjoint (Finset.filter IsPrimePow (divisors a)) (Finset.filter IsPrimePow (divisors b)) [PROOFSTEP] simp only [Finset.disjoint_left, Finset.mem_filter, and_imp, Nat.mem_divisors, not_and] [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n p : R k a b : ℕ hab : coprime a b ⊢ ∀ ⦃a_1 : ℕ⦄, a_1 ∣ a → a ≠ 0 → IsPrimePow a_1 → a_1 ∣ b → b ≠ 0 → ¬IsPrimePow a_1 [PROOFSTEP] rintro n han _ha hn hbn _hb - [GOAL] R : Type u_1 inst✝ : CommMonoidWithZero R n✝ p : R k a b : ℕ hab : coprime a b n : ℕ han : n ∣ a _ha : a ≠ 0 hn : IsPrimePow n hbn : n ∣ b _hb : b ≠ 0 ⊢ False [PROOFSTEP] exact hn.ne_one (Nat.eq_one_of_dvd_coprimes hab han hbn)
[STATEMENT] lemma rt_fresher_trans_rt_strictly_fresher' [elim, trans]: assumes "rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt2" and "rt2 \<sqsubset>\<^bsub>dip\<^esub> rt3" shows "rt1 \<sqsubset>\<^bsub>dip\<^esub> rt3" [PROOF STATE] proof (prove) goal (1 subgoal): 1. rt1 \<sqsubset>\<^bsub>dip\<^esub> rt3 [PROOF STEP] proof - [PROOF STATE] proof (state) goal (1 subgoal): 1. rt1 \<sqsubset>\<^bsub>dip\<^esub> rt3 [PROOF STEP] from \<open>rt2 \<sqsubset>\<^bsub>dip\<^esub> rt3\<close> [PROOF STATE] proof (chain) picking this: rt2 \<sqsubset>\<^bsub>dip\<^esub> rt3 [PROOF STEP] have "rt2 \<sqsubseteq>\<^bsub>dip\<^esub> rt3" and "\<not>(rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2)" [PROOF STATE] proof (prove) using this: rt2 \<sqsubset>\<^bsub>dip\<^esub> rt3 goal (1 subgoal): 1. rt2 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 &&& \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 [PROOF STEP] unfolding rt_strictly_fresher_def'' [PROOF STATE] proof (prove) using this: rt2 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 \<and> \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 goal (1 subgoal): 1. rt2 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 &&& \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 [PROOF STEP] by auto [PROOF STATE] proof (state) this: rt2 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 goal (1 subgoal): 1. rt1 \<sqsubset>\<^bsub>dip\<^esub> rt3 [PROOF STEP] from \<open>rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt2\<close> and this(1) [PROOF STATE] proof (chain) picking this: rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 rt2 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 [PROOF STEP] have "rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt3" [PROOF STATE] proof (prove) using this: rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 rt2 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 goal (1 subgoal): 1. rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 [PROOF STEP] .. [PROOF STATE] proof (state) this: rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 goal (1 subgoal): 1. rt1 \<sqsubset>\<^bsub>dip\<^esub> rt3 [PROOF STEP] moreover [PROOF STATE] proof (state) this: rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 goal (1 subgoal): 1. rt1 \<sqsubset>\<^bsub>dip\<^esub> rt3 [PROOF STEP] from \<open>\<not>(rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2)\<close> [PROOF STATE] proof (chain) picking this: \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 [PROOF STEP] have "\<not>(rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1)" [PROOF STATE] proof (prove) using this: \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 goal (1 subgoal): 1. \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 [PROOF STEP] proof (rule contrapos_nn) [PROOF STATE] proof (state) goal (1 subgoal): 1. rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 \<Longrightarrow> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 [PROOF STEP] assume "rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1" [PROOF STATE] proof (state) this: rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 goal (1 subgoal): 1. rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 \<Longrightarrow> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 [PROOF STEP] thus "rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2" [PROOF STATE] proof (prove) using this: rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 goal (1 subgoal): 1. rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 [PROOF STEP] using \<open>rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt2\<close> [PROOF STATE] proof (prove) using this: rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 goal (1 subgoal): 1. rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 [PROOF STEP] .. [PROOF STATE] proof (state) this: rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt2 goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 goal (1 subgoal): 1. rt1 \<sqsubset>\<^bsub>dip\<^esub> rt3 [PROOF STEP] ultimately [PROOF STATE] proof (chain) picking this: rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 [PROOF STEP] show "rt1 \<sqsubset>\<^bsub>dip\<^esub> rt3" [PROOF STATE] proof (prove) using this: rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 goal (1 subgoal): 1. rt1 \<sqsubset>\<^bsub>dip\<^esub> rt3 [PROOF STEP] unfolding rt_strictly_fresher_def'' [PROOF STATE] proof (prove) using this: rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 goal (1 subgoal): 1. rt1 \<sqsubseteq>\<^bsub>dip\<^esub> rt3 \<and> \<not> rt3 \<sqsubseteq>\<^bsub>dip\<^esub> rt1 [PROOF STEP] by auto [PROOF STATE] proof (state) this: rt1 \<sqsubset>\<^bsub>dip\<^esub> rt3 goal: No subgoals! [PROOF STEP] qed
(* This file is generated by Why3's Coq driver *) (* Beware! Only edit allowed sections below *) Require Import BuiltIn. Require Reals.R_sqrt. Require BuiltIn. Require HighOrd. Require int.Int. Require int.Abs. Require int.MinMax. Require int.EuclideanDivision. Require real.Real. Require real.FromInt. Require real.Square. Require map.Map. Parameter infix_eqeq: forall {a:Type} {a_WT:WhyType a}, a -> a -> Prop. Axiom infix_eqeq_spec : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (b:a), (infix_eqeq a1 b) -> (a1 = b). Axiom infix_eqeq_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (b:a), (a1 = b) -> infix_eqeq a1 b. Axiom assert_equal : True. Axiom goal_comm : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (b:a), (a1 = b) -> (b = a1). Axiom complex : Type. Parameter complex_WhyType : WhyType complex. Existing Instance complex_WhyType. Parameter teq: complex -> complex -> Prop. Axiom teq_def : forall (x:complex) (y:complex), (teq x y) -> infix_eqeq x y. Axiom teq_def1 : forall (x:complex) (y:complex), (infix_eqeq x y) -> teq x y. Axiom teq_spec : forall (x:complex) (y:complex), (teq x y) -> (x = y). Axiom teq_spec1 : forall (x:complex) (y:complex), (x = y) -> teq x y. Parameter c_zero: complex. Parameter c_one: complex. Parameter prefix_mndt: complex -> complex. Parameter infix_pldt: complex -> complex -> complex. Parameter infix_asdt: complex -> complex -> complex. Parameter inv: complex -> complex. Axiom Assoc : forall (x:complex) (y:complex) (z:complex), ((infix_pldt (infix_pldt x y) z) = (infix_pldt x (infix_pldt y z))). Axiom Unit_def_l : forall (x:complex), ((infix_pldt c_zero x) = x). Axiom Unit_def_r : forall (x:complex), ((infix_pldt x c_zero) = x). Axiom Inv_def_l : forall (x:complex), ((infix_pldt (prefix_mndt x) x) = c_zero). Axiom Inv_def_r : forall (x:complex), ((infix_pldt x (prefix_mndt x)) = c_zero). Axiom Comm : forall (x:complex) (y:complex), ((infix_pldt x y) = (infix_pldt y x)). Axiom Assoc1 : forall (x:complex) (y:complex) (z:complex), ((infix_asdt (infix_asdt x y) z) = (infix_asdt x (infix_asdt y z))). Axiom Mul_distr_l : forall (x:complex) (y:complex) (z:complex), ((infix_asdt x (infix_pldt y z)) = (infix_pldt (infix_asdt x y) (infix_asdt x z))). Axiom Mul_distr_r : forall (x:complex) (y:complex) (z:complex), ((infix_asdt (infix_pldt y z) x) = (infix_pldt (infix_asdt y x) (infix_asdt z x))). Axiom Comm1 : forall (x:complex) (y:complex), ((infix_asdt x y) = (infix_asdt y x)). Axiom Unitary : forall (x:complex), ((infix_asdt c_one x) = x). Axiom NonTrivialRing : ~ (c_zero = c_one). Axiom Inverse : forall (x:complex), ~ (x = c_zero) -> ((infix_asdt x (inv x)) = c_one). Parameter infix_mn: complex -> complex -> complex. Axiom infix_mn_def : forall (x:complex) (y:complex), ((infix_mn x y) = (infix_pldt x (prefix_mndt y))). Parameter infix_sl: complex -> complex -> complex. Axiom infix_sl_def : forall (x:complex) (y:complex), ((infix_sl x y) = (infix_asdt x (inv y))). Axiom add_div : forall (x:complex) (y:complex) (z:complex), ~ (z = c_zero) -> ((infix_sl (infix_pldt x y) z) = (infix_pldt (infix_sl x z) (infix_sl y z))). Axiom sub_div : forall (x:complex) (y:complex) (z:complex), ~ (z = c_zero) -> ((infix_sl (infix_mn x y) z) = (infix_mn (infix_sl x z) (infix_sl y z))). Axiom neg_div : forall (x:complex) (y:complex), ~ (y = c_zero) -> ((infix_sl (prefix_mndt x) y) = (prefix_mndt (infix_sl x y))). Axiom assoc_mul_div : forall (x:complex) (y:complex) (z:complex), ~ (z = c_zero) -> ((infix_sl (infix_asdt x y) z) = (infix_asdt x (infix_sl y z))). Axiom assoc_div_mul : forall (x:complex) (y:complex) (z:complex), (~ (y = c_zero) /\ ~ (z = c_zero)) -> ((infix_sl (infix_sl x y) z) = (infix_sl x (infix_asdt y z))). Axiom assoc_div_div : forall (x:complex) (y:complex) (z:complex), (~ (y = c_zero) /\ ~ (z = c_zero)) -> ((infix_sl x (infix_sl y z)) = (infix_sl (infix_asdt x z) y)). Parameter infix_mndt: complex -> complex -> complex. Axiom infix_mndt_def : forall (x:complex) (y:complex), ((infix_mndt x y) = (infix_pldt x (prefix_mndt y))). Parameter infix_sldt: complex -> complex -> complex. Axiom infix_sldt_def : forall (x:complex) (y:complex), ~ (y = c_zero) -> ((infix_sldt x y) = (infix_asdt x (inv y))). Axiom infix_sldt_spec : forall (x:complex) (y:complex), ~ (y = c_zero) -> ((infix_sldt x y) = (infix_asdt x (inv y))). Parameter infix_slas: R -> R -> R. Axiom infix_slas_def : forall (x:R) (y:R), ~ (y = 0%R) -> ((infix_slas x y) = (x / y)%R). Parameter infix_eqas: R -> R -> Prop. Axiom infix_eqas_def : forall (x:R) (y:R), (infix_eqas x y) -> infix_eqeq x y. Axiom infix_eqas_def1 : forall (x:R) (y:R), (infix_eqeq x y) -> infix_eqas x y. Axiom infix_eqas_spec : forall (x:R) (y:R), (infix_eqas x y) -> (x = y). Axiom infix_eqas_spec1 : forall (x:R) (y:R), (x = y) -> infix_eqas x y. Parameter infix_lsgtas: R -> R -> Prop. Axiom infix_lsgtas_def : forall (x:R) (y:R), (infix_lsgtas x y) -> ~ (infix_eqeq x y). Axiom infix_lsgtas_def1 : forall (x:R) (y:R), ~ (infix_eqeq x y) -> infix_lsgtas x y. Axiom infix_lsgtas_spec : forall (x:R) (y:R), (infix_lsgtas x y) -> ~ (x = y). Axiom infix_lsgtas_spec1 : forall (x:R) (y:R), ~ (x = y) -> infix_lsgtas x y. Parameter infix_plas: R -> R -> R. Axiom infix_plas_def : forall (x:R) (y:R), ((infix_plas x y) = (x + y)%R). Parameter infix_mnas: R -> R -> R. Axiom infix_mnas_def : forall (x:R) (y:R), ((infix_mnas x y) = (x + (-y)%R)%R). Parameter infix_asas: R -> R -> R. Axiom infix_asas_def : forall (x:R) (y:R), ((infix_asas x y) = (x * y)%R). Parameter infix_lseqas: R -> R -> Prop. Axiom infix_lseqas_def : forall (x:R) (y:R), (infix_lseqas x y) -> (x <= y)%R. Axiom infix_lseqas_def1 : forall (x:R) (y:R), (x <= y)%R -> infix_lseqas x y. Parameter prefix_mnas: R -> R. Axiom prefix_mnas_def : forall (y:R), ((prefix_mnas y) = (-y)%R). Parameter infix_lsas: R -> R -> Prop. Axiom infix_lsas_def : forall (x:R) (y:R), (infix_lsas x y) -> infix_lseqas x y. Axiom infix_lsas_def1 : forall (x:R) (y:R), (infix_lsas x y) -> infix_lsgtas x y. Axiom infix_lsas_def2 : forall (x:R) (y:R), ((infix_lseqas x y) /\ (infix_lsgtas x y)) -> infix_lsas x y. Parameter infix_gtas: R -> R -> Prop. Axiom infix_gtas_def : forall (x:R) (y:R), (infix_gtas x y) -> infix_lsas y x. Axiom infix_gtas_def1 : forall (x:R) (y:R), (infix_lsas y x) -> infix_gtas x y. Parameter infix_gteqas: R -> R -> Prop. Axiom infix_gteqas_def : forall (x:R) (y:R), (infix_gteqas x y) -> infix_lseqas y x. Axiom infix_gteqas_def1 : forall (x:R) (y:R), (infix_lseqas y x) -> infix_gteqas x y. Parameter from_int: Z -> R. Axiom from_int_spec : forall (x:Z), ((from_int x) = (BuiltIn.IZR x)). Axiom Zero : ((from_int 0%Z) = 0%R). Axiom Add : forall (x:Z) (y:Z), ((from_int (x + y)%Z) = (infix_plas (from_int x) (from_int y))). Axiom One : ((from_int 1%Z) = 1%R). Axiom Sub : forall (x:Z) (y:Z), ((from_int (x - y)%Z) = (infix_mnas (from_int x) (from_int y))). Axiom mul_pos : forall (x:Z) (y:Z), (0%Z <= y)%Z -> ((from_int (x * y)%Z) = (infix_asas (from_int x) (from_int y))). Axiom mul : forall (x:Z) (y:Z), (0%Z <= y)%Z -> ((from_int (x * y)%Z) = (infix_asas (from_int x) (from_int y))). Axiom mul_rev : forall (x:Z) (y:Z), (0%Z <= y)%Z -> ((infix_asas (from_int x) (from_int y)) = (from_int (x * y)%Z)). Axiom neg : forall (x:Z), ((from_int (-x)%Z) = (prefix_mnas (from_int x))). Axiom injective : forall (x:Z) (y:Z), ((from_int x) = (from_int y)) -> (x = y). Axiom Monotonic : forall (x:Z) (y:Z), (x <= y)%Z -> infix_lseqas (from_int x) (from_int y). Axiom positive_inv : forall (x:R), (infix_lsas 0%R x) -> infix_lsas 0%R (infix_slas 1%R x). Axiom r_zeroLessOne : infix_lseqas 0%R 1%R. Axiom r_compatOrderAdd : forall (x:R) (y:R) (z:R), (infix_lseqas x y) -> infix_lseqas (infix_plas x z) (infix_plas y z). Axiom r_compatOrderMult : forall (x:R) (y:R) (z:R), (infix_lseqas x y) -> (infix_lseqas 0%R z) -> infix_lseqas (infix_asas x z) (infix_asas y z). Axiom inv_order : forall (a:R) (b:R), (infix_lsas 0%R a) -> (infix_lsas 0%R b) -> (infix_lseqas a b) -> infix_lseqas (1%R / b)%R (1%R / a)%R. Axiom inv_strict_order : forall (a:R) (b:R), (infix_lsas 0%R a) -> (infix_lsas 0%R b) -> (infix_lsas a b) -> infix_lsas (1%R / b)%R (1%R / a)%R. Axiom invol_neg : forall (a:complex), ((prefix_mndt (prefix_mndt a)) = a). Axiom injective_neg : forall (a:complex) (b:complex), ((prefix_mndt a) = (prefix_mndt b)) -> (a = b). Axiom find_opposite : forall (a:complex) (b:complex), ((infix_mndt a b) = c_zero) -> (a = b). Axiom add_opposite : forall (a:complex), ((infix_pldt a (prefix_mndt a)) = c_zero). Axiom opposite : forall (a:complex), ((infix_mndt a a) = c_zero). Axiom mult_num : forall (a:complex) (b:complex) (c:complex), ~ (c = c_zero) -> ((infix_sldt (infix_asdt a b) c) = (infix_asdt a (infix_sldt b c))). Axiom div_as_mult_inv : forall (a:complex) (b:complex), ~ (b = c_zero) -> ((infix_sldt a b) = (infix_asdt a (infix_sldt c_one b))). Axiom div_rev : forall (a:complex) (b:complex), ~ (b = c_zero) -> ((infix_asdt a (infix_sldt c_one b)) = (infix_sldt a b)). Axiom mult_div_num : forall (a:complex) (b:complex) (c:complex), ~ (c = c_zero) -> ((infix_asdt (infix_sldt a c) b) = (infix_sldt (infix_asdt a b) c)). Axiom mult_denom : forall (a:complex) (b:complex) (c:complex), ~ (c = c_zero) -> ~ (b = c_zero) -> ((infix_sldt a (infix_asdt b c)) = (infix_asdt (infix_sldt a b) (infix_sldt c_one c))). Axiom mult_simpl : forall (a:complex) (b:complex) (c:complex), ~ (c = c_zero) -> ~ (b = c_zero) -> ((infix_sldt (infix_asdt a b) (infix_asdt c b)) = (infix_sldt a c)). Axiom dic_simpl : forall (a:complex) (b:complex) (c:complex), ~ (c = c_zero) -> ~ (b = c_zero) -> ((infix_asdt (infix_sldt a (infix_asdt c b)) b) = (infix_sldt a c)). Axiom simpl_with_c_one : forall (a:complex) (b:complex), ~ (a = c_zero) -> ~ (b = c_zero) -> ((infix_asdt (infix_sldt a b) (infix_sldt c_one a)) = (infix_sldt c_one b)). Axiom add_op : forall (a1:complex) (a2:complex), (a1 = (prefix_mndt a2)) -> ((infix_pldt a1 a2) = c_zero). Axiom mult_eq_t : forall (a1:complex) (a2:complex) (b1:complex) (b2:complex), (a1 = a2) -> (b1 = b2) -> ((infix_asdt a1 b1) = (infix_asdt a2 b2)). Axiom mult_eq_t_rev : forall (a1:complex) (a2:complex) (b1:complex) (b2:complex), (a1 = a2) -> (b1 = b2) -> ((infix_asdt a1 b1) = (infix_asdt b2 a2)). Axiom mult_comm : forall (a:complex) (b:complex), ((infix_asdt a b) = (infix_asdt b a)). Axiom mult_assoc : forall (a:complex) (b:complex) (c:complex), ((infix_asdt (infix_asdt a b) c) = (infix_asdt a (infix_asdt b c))). Axiom mult_abc_to_acb : forall (a:complex) (b:complex) (c:complex), ((infix_asdt (infix_asdt a b) c) = (infix_asdt (infix_asdt a c) b)). Axiom zero_mult_t : forall (a1:complex) (a2:complex), (a1 = c_zero) -> ((infix_asdt a1 a2) = c_zero). Axiom mult_zero_t : forall (a1:complex) (a2:complex), (a1 = c_zero) -> ((infix_asdt a2 a1) = c_zero). Axiom mult_one_t : forall (a1:complex) (a2:complex), (a2 = c_one) -> ((infix_asdt a1 a2) = a1). Axiom add_eq_t : forall (a1:complex) (a2:complex) (b1:complex) (b2:complex), (a1 = a2) -> (b1 = b2) -> ((infix_pldt a1 b1) = (infix_pldt a2 b2)). Axiom add_eq_t_rev : forall (a1:complex) (a2:complex) (b1:complex) (b2:complex), (a1 = a2) -> (b1 = b2) -> ((infix_pldt a1 b1) = (infix_pldt b2 a2)). Axiom substr_eq_t : forall (a1:complex) (a2:complex) (b1:complex) (b2:complex), (a1 = a2) -> (b1 = b2) -> ((infix_mndt a1 b1) = (infix_mndt a2 b2)). Parameter im: complex. Axiom im_Def : ((infix_asdt im im) = (prefix_mndt c_one)). Parameter ttwo: complex. Axiom ttwo_def : (ttwo = (infix_pldt c_one c_one)). Parameter r_to_c: R -> complex. Axiom r_to_c_zero : ((r_to_c 0%R) = c_zero). Axiom r_to_c_one : ((r_to_c 1%R) = c_one). Axiom r_to_c_add : forall (i:R) (j:R), ((infix_pldt (r_to_c i) (r_to_c j)) = (r_to_c (infix_plas i j))). Axiom r_to_c_add_rev : forall (i:R) (j:R), ((r_to_c (infix_plas i j)) = (infix_pldt (r_to_c i) (r_to_c j))). Axiom r_to_c_opp : forall (i:R), ((r_to_c (prefix_mnas i)) = (prefix_mndt (r_to_c i))). Axiom r_to_c_div : forall (i:R) (j:R), ~ (j = 0%R) -> ((r_to_c (infix_slas i j)) = (infix_sldt (r_to_c i) (r_to_c j))). Axiom r_to_c_mult : forall (i:R) (j:R), ((infix_asdt (r_to_c i) (r_to_c j)) = (r_to_c (infix_asas i j))). Axiom r_to_c_mult_rev : forall (i:R) (j:R), ((r_to_c (infix_asas i j)) = (infix_asdt (r_to_c i) (r_to_c j))). Axiom r_to_c_sub : forall (i:R) (j:R), ((infix_mndt (r_to_c i) (r_to_c j)) = (r_to_c (infix_mnas i j))). Parameter real_part: complex -> R. Parameter im_part: complex -> R. Axiom Real_part_add : forall (i:complex) (j:complex), ((real_part (infix_pldt i j)) = (infix_plas (real_part i) (real_part j))). Axiom Im_part_add : forall (i:complex) (j:complex), ((im_part (infix_pldt i j)) = (infix_plas (im_part i) (im_part j))). Axiom Real_part_opposite : forall (i:complex), ((real_part (prefix_mndt i)) = (prefix_mnas (real_part i))). Axiom Im_part_opposite : forall (i:complex), ((im_part (prefix_mndt i)) = (prefix_mnas (im_part i))). Axiom Complex_decomp : forall (i:complex), (i = (infix_pldt (r_to_c (real_part i)) (infix_asdt im (r_to_c (im_part i))))). Axiom Unic_decomp : forall (i:complex), forall (x:R) (y:R), (i = (infix_pldt (r_to_c x) (infix_asdt im (r_to_c y)))) -> (x = (real_part i)). Axiom Unic_decomp1 : forall (i:complex), forall (x:R) (y:R), (i = (infix_pldt (r_to_c x) (infix_asdt im (r_to_c y)))) -> (y = (im_part i)). Parameter real_: complex -> Prop. Axiom real__def : forall (x:complex), (real_ x) -> infix_eqeq (im_part x) 0%R. Axiom real__def1 : forall (x:complex), (infix_eqeq (im_part x) 0%R) -> real_ x. Parameter pure_im_: complex -> Prop. Axiom pure_im__def : forall (x:complex), (pure_im_ x) -> infix_eqeq (real_part x) 0%R. Axiom pure_im__def1 : forall (x:complex), (infix_eqeq (real_part x) 0%R) -> pure_im_ x. Axiom unic_decomp : forall (i:complex) (x:R) (y:R), (i = (infix_pldt (r_to_c x) (infix_asdt im (r_to_c y)))) -> (x = (real_part i)). Axiom unic_decomp1 : forall (i:complex) (x:R) (y:R), (i = (infix_pldt (r_to_c x) (infix_asdt im (r_to_c y)))) -> (y = (im_part i)). Axiom r_to_c_real : forall (x:complex), (real_ x) -> (x = (r_to_c (real_part x))). Axiom real_r_to_c : forall (x:R), real_ (r_to_c x). Axiom r_to_c_pure_im : forall (x:complex), (pure_im_ x) -> (x = (infix_asdt im (r_to_c (im_part x)))). Axiom decomp_mult : forall (a:complex) (b:complex), ((infix_asdt a b) = (infix_pldt (infix_mndt (infix_asdt (r_to_c (real_part a)) (r_to_c (real_part b))) (infix_asdt (r_to_c (im_part a)) (r_to_c (im_part b)))) (infix_asdt im (infix_pldt (infix_asdt (r_to_c (real_part a)) (r_to_c (im_part b))) (infix_asdt (r_to_c (real_part b)) (r_to_c (im_part a))))))). Parameter t_real_part: complex -> complex. Axiom t_real_part_def : forall (x:complex), ((t_real_part x) = (r_to_c (real_part x))). Axiom t_real_part_spec : forall (x:complex), real_ (t_real_part x). Axiom t_real_part_inv : forall (x:complex), ((t_real_part (prefix_mndt x)) = (prefix_mndt (t_real_part x))). Parameter t_im_part: complex -> complex. Axiom t_im_part_def : forall (x:complex), ((t_im_part x) = (r_to_c (im_part x))). Axiom t_im_part_spec : forall (x:complex), real_ (t_im_part x). Axiom t_im_part_inv : forall (x:complex), ((t_im_part (prefix_mndt x)) = (prefix_mndt (t_im_part x))). Axiom decomp_mult_as_reals : forall (a:complex) (b:complex), ((infix_asdt a b) = (infix_pldt (infix_mndt (infix_asdt (t_real_part a) (t_real_part b)) (infix_asdt (t_im_part a) (t_im_part b))) (infix_asdt im (infix_pldt (infix_asdt (t_real_part a) (t_im_part b)) (infix_asdt (t_real_part b) (t_im_part a)))))). Axiom decomp_mult_real_part : forall (a:complex) (b:complex), ((real_part (infix_asdt a b)) = (infix_mnas (infix_asas (real_part a) (real_part b)) (infix_asas (im_part a) (im_part b)))). Axiom decomp_mult_im_part : forall (a:complex) (b:complex), ((im_part (infix_asdt a b)) = (infix_plas (infix_asas (real_part a) (im_part b)) (infix_asas (real_part b) (im_part a)))). Axiom t_mult_real : forall (a:complex) (b:complex), ((t_real_part (infix_asdt a b)) = (infix_mndt (infix_asdt (t_real_part a) (t_real_part b)) (infix_asdt (t_im_part a) (t_im_part b)))). Axiom t_mult_im : forall (a:complex) (b:complex), ((t_im_part (infix_asdt a b)) = (infix_pldt (infix_asdt (t_real_part a) (t_im_part b)) (infix_asdt (t_im_part a) (t_real_part b)))). Axiom mult_real_real : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> ((infix_asdt a b) = (infix_asdt (r_to_c (real_part a)) (r_to_c (real_part b)))). Axiom mult_real_real1 : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> ((infix_asdt (r_to_c (real_part a)) (r_to_c (real_part b))) = (r_to_c (infix_asas (real_part a) (real_part b)))). Axiom mult_real_real2 : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> ((real_part (infix_asdt a b)) = (infix_asas (real_part a) (real_part b))). Axiom mult_real_real3 : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> ((im_part (infix_asdt a b)) = 0%R). Axiom complex_squared : forall (a:complex), ((infix_asdt a a) = (infix_pldt (infix_mndt (infix_asdt (t_real_part a) (t_real_part a)) (infix_asdt (t_im_part a) (t_im_part a))) (infix_asdt (infix_asdt (infix_asdt im ttwo) (t_real_part a)) (t_im_part a)))). Axiom complex_squared1 : forall (a:complex), ((t_real_part (infix_asdt a a)) = (infix_mndt (infix_asdt (t_real_part a) (t_real_part a)) (infix_asdt (t_im_part a) (t_im_part a)))). Axiom complex_squared2 : forall (a:complex), ((t_im_part (infix_asdt a a)) = (infix_asdt (infix_asdt ttwo (t_real_part a)) (t_im_part a))). Axiom complex_real_squared : forall (a:complex), (real_ a) -> ((infix_asdt a a) = (infix_asdt (t_real_part a) (t_real_part a))). Axiom decomp_div : forall (a:complex) (b:complex), ~ (b = c_zero) -> ((infix_sldt a b) = (infix_pldt (infix_sldt (t_real_part (infix_asdt a b)) (infix_asdt b b)) (infix_asdt im (infix_sldt (t_im_part (infix_asdt a b)) (infix_asdt b b))))). Axiom decomp_div_real : forall (a:complex) (b:complex), (real_ b) -> ~ (b = c_zero) -> ((infix_sldt a b) = (infix_pldt (infix_sldt (infix_asdt (t_real_part a) b) (infix_asdt b b)) (infix_asdt im (infix_sldt (infix_asdt (t_im_part a) b) (infix_asdt b b))))). Axiom complex_prod_fact : forall (a:complex) (b:complex), ((infix_asdt a b) = (infix_pldt (infix_asdt (r_to_c (real_part a)) b) (infix_asdt (infix_asdt im (r_to_c (im_part a))) b))). Axiom non_zero_prod_pre : forall (a:complex) (b:complex), ~ (a = c_zero) -> ((infix_asdt a b) = c_zero) -> ((im_part b) = (real_part b)). Axiom non_zero_prod_pre1 : forall (a:complex) (b:complex), ~ (a = c_zero) -> ((infix_asdt a b) = c_zero) -> ((real_part b) = 0%R). Axiom non_zero_prod : forall (a:complex) (b:complex), ~ (a = c_zero) -> ~ (b = c_zero) -> ~ ((infix_asdt a b) = c_zero). Axiom minus_c_one : forall (a:complex), ((prefix_mndt a) = (infix_asdt (prefix_mndt c_one) a)). Axiom mult_neg_l : forall (a:complex) (b:complex), ((infix_asdt (prefix_mndt a) b) = (prefix_mndt (infix_asdt a b))). Axiom mult_neg_r : forall (a:complex) (b:complex), ((infix_asdt a (prefix_mndt b)) = (prefix_mndt (infix_asdt a b))). Axiom neg_neg_out : forall (a:complex), ((prefix_mndt (prefix_mndt a)) = a). Axiom div_neg_l : forall (a:complex) (b:complex), ~ (b = c_zero) -> ((infix_sldt (prefix_mndt a) b) = (prefix_mndt (infix_sldt a b))). Axiom eq_to_real : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> (a = b) -> ((real_part a) = (real_part b)). Axiom eq_by_real : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> ((real_part a) = (real_part b)) -> (a = b). Axiom div_neg_r : forall (a:complex) (b:complex), ~ (b = c_zero) -> ((infix_sldt a (prefix_mndt b)) = (prefix_mndt (infix_sldt a b))). Axiom invadd : forall (i:complex), ((prefix_mndt i) = (infix_asdt (prefix_mndt c_one) i)). Axiom noc_zeroAdd : forall (x:complex) (y:complex), ~ (x = c_zero) -> ~ ((infix_pldt x y) = y). Axiom Absorbing_zero : forall (a:complex) (b:complex), ((infix_asdt a b) = c_zero) -> ~ (a = c_zero) -> (b = c_zero). Axiom Absorbing_zero1 : forall (a:complex) (b:complex), (a = c_zero) -> ((infix_asdt a b) = c_zero). Axiom Absorbing_zero2 : forall (a:complex) (b:complex), (b = c_zero) -> ((infix_asdt a b) = c_zero). Axiom real_part_add : forall (i:complex) (j:complex), ((real_part (infix_pldt i j)) = (infix_plas (real_part i) (real_part j))). Axiom mult_im_rev : forall (a:complex), ((infix_asdt a im) = (infix_asdt im a)). Axiom im_im_elim : forall (a:complex), ((infix_asdt im (infix_asdt im a)) = (prefix_mndt a)). Axiom im_im_fact : forall (a:complex) (b:complex), ((infix_asdt (infix_asdt im a) (infix_asdt im b)) = (prefix_mndt (infix_asdt a b))). Axiom minus_minus_fact : forall (a:complex) (b:complex), ((infix_asdt (prefix_mndt a) (prefix_mndt b)) = (infix_asdt a b)). Axiom minus_minus_add : forall (a:complex) (b:complex), ((infix_pldt (prefix_mndt a) (prefix_mndt b)) = (prefix_mndt (infix_pldt a b))). Axiom minus_minus_add_rev : forall (a:complex) (b:complex), ((prefix_mndt (infix_pldt a b)) = (infix_pldt (prefix_mndt a) (prefix_mndt b))). Axiom minus_out_left : forall (a:complex) (b:complex), ((infix_asdt (prefix_mndt a) b) = (prefix_mndt (infix_asdt a b))). Axiom minus_out_right : forall (a:complex) (b:complex), ((infix_asdt a (prefix_mndt b)) = (prefix_mndt (infix_asdt a b))). Axiom minus_in_left : forall (a:complex) (b:complex), ((prefix_mndt (infix_asdt a b)) = (infix_asdt (prefix_mndt a) b)). Axiom minus_in_right : forall (a:complex) (b:complex), ((prefix_mndt (infix_asdt a b)) = (infix_asdt a (prefix_mndt b))). Axiom minus_add_out_left : forall (a:complex) (b:complex), ((infix_pldt (prefix_mndt a) b) = (prefix_mndt (infix_pldt a (prefix_mndt b)))). Axiom minus_as_add_opp : forall (a:complex) (b:complex), ((infix_mndt a b) = (infix_pldt a (prefix_mndt b))). Axiom minus_add_out_right : forall (a:complex) (b:complex), ((infix_pldt a (prefix_mndt b)) = (prefix_mndt (infix_pldt (prefix_mndt a) b))). Axiom minus_add_in : forall (a:complex) (b:complex), ((prefix_mndt (infix_pldt a b)) = (infix_pldt (prefix_mndt a) (prefix_mndt b))). Axiom minus_add_out : forall (a:complex) (b:complex), ((infix_pldt (prefix_mndt a) (prefix_mndt b)) = (prefix_mndt (infix_pldt a b))). Axiom minus_eq : forall (a:complex) (b:complex), (a = b) -> ((prefix_mndt a) = (prefix_mndt b)). Axiom im_out_right : forall (a:complex) (b:complex), ((infix_asdt (infix_asdt im a) b) = (infix_asdt im (infix_asdt a b))). Axiom im_out_left : forall (a:complex) (b:complex), ((infix_asdt a (infix_asdt im b)) = (infix_asdt im (infix_asdt a b))). Axiom im_part_add : forall (i:complex) (j:complex), ((im_part (infix_pldt i j)) = (infix_plas (im_part i) (im_part j))). Axiom injective_real_part : forall (i:complex) (j:complex), ~ ((real_part i) = (real_part j)) -> ~ (i = j). Axiom injective_im_part : forall (i:complex) (j:complex), ~ ((im_part i) = (im_part j)) -> ~ (i = j). Axiom minus_distr_four : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_asdt a b) (infix_asdt (infix_asdt (prefix_mndt b) c) d)) = (infix_asdt (infix_mndt a (infix_asdt c d)) b)). Axiom complex_decomp : forall (i:complex), (i = (infix_pldt (r_to_c (real_part i)) (infix_asdt im (r_to_c (im_part i))))). Axiom simpl_frac : forall (x:complex) (y:complex), ~ (y = c_zero) -> ((infix_sldt (infix_asdt x y) y) = x). Axiom simpl_frac_ : forall (x:complex) (y:complex) (z:complex), ~ (y = c_zero) -> ~ (z = c_zero) -> ((infix_sldt (infix_asdt x y) (infix_asdt z y)) = (infix_sldt x z)). Axiom fact_frac : forall (x:complex) (y:complex) (z:complex), ~ (z = c_zero) -> ((infix_sldt (infix_asdt x y) z) = (infix_asdt x (infix_sldt y z))). Axiom fact_frac_rev : forall (x:complex) (y:complex) (z:complex), ~ (z = c_zero) -> ((infix_asdt x (infix_sldt y z)) = (infix_sldt (infix_asdt x y) z)). Axiom mult_sym : forall (x:complex) (y:complex), ((infix_asdt x y) = (infix_asdt y x)). Axiom inv_mult : forall (x:complex) (y:complex), ~ (x = c_zero) -> ~ (y = c_zero) -> ((infix_asdt (infix_sldt c_one x) (infix_sldt c_one y)) = (infix_sldt c_one (infix_asdt x y))). Axiom div_div : forall (x:complex) (y:complex) (z:complex), ~ (y = c_zero) -> ~ (z = c_zero) -> ((infix_sldt (infix_sldt x y) z) = (infix_sldt x (infix_asdt y z))). Axiom div_div_rev : forall (x:complex) (y:complex) (z:complex), ~ (y = c_zero) -> ~ (z = c_zero) -> ((infix_sldt x (infix_asdt y z)) = (infix_sldt (infix_sldt x y) z)). Axiom involutive_inv : forall (a:complex), ~ (a = c_zero) -> ((infix_sldt c_one (infix_sldt c_one a)) = a). Axiom twice : forall (i:complex), ((infix_asdt ttwo i) = (infix_pldt i i)). Axiom twice_half : ((infix_asdt ttwo (infix_sldt c_one ttwo)) = c_one). Axiom half_plus_half : forall (i:complex), ((infix_pldt (infix_sldt i ttwo) (infix_sldt i ttwo)) = i). Axiom decomp_inv_real : forall (a:complex), (real_ a) -> ~ (a = c_zero) -> ((infix_sldt c_one a) = (infix_sldt c_one (t_real_part a))). Axiom decomp_inv_real1 : forall (a:complex), (real_ a) -> ~ (a = c_zero) -> real_ (infix_sldt c_one a). Axiom decomp_inv_real2 : forall (a:complex), (real_ a) -> ~ (a = c_zero) -> ((t_real_part (infix_sldt c_one a)) = (infix_sldt c_one (t_real_part a))). Axiom decomp_inv_real3 : forall (a:complex), (real_ a) -> ~ (a = c_zero) -> ((real_part (infix_sldt c_one a)) = (infix_slas 1%R (real_part a))). Axiom mult_div_comm : forall (x:complex) (y:complex) (z:complex) (t:complex), ~ (z = c_zero) -> ~ (t = c_zero) -> ((infix_sldt (infix_asdt x y) (infix_asdt z t)) = (infix_asdt (infix_sldt x z) (infix_sldt y t))). Axiom mult_div_comm_rev : forall (x:complex) (y:complex) (z:complex) (t:complex), ~ (z = c_zero) -> ~ (t = c_zero) -> ((infix_asdt (infix_sldt x z) (infix_sldt y t)) = (infix_sldt (infix_asdt x y) (infix_asdt z t))). Parameter infix_lseqdt: complex -> complex -> Prop. Axiom infix_lseqdt_def : forall (x:complex) (y:complex), (infix_lseqdt x y) -> (real_ x) \/ (infix_eqeq x y). Axiom infix_lseqdt_def1 : forall (x:complex) (y:complex), (infix_lseqdt x y) -> (real_ y) \/ (infix_eqeq x y). Axiom infix_lseqdt_def2 : forall (x:complex) (y:complex), (infix_lseqdt x y) -> (infix_lseqas (real_part x) (real_part y)) \/ (infix_eqeq x y). Axiom infix_lseqdt_def3 : forall (x:complex) (y:complex), ((real_ x) /\ ((real_ y) /\ (infix_lseqas (real_part x) (real_part y)))) -> infix_lseqdt x y. Axiom infix_lseqdt_def4 : forall (x:complex) (y:complex), (infix_eqeq x y) -> infix_lseqdt x y. Parameter infix_lsdt: complex -> complex -> Prop. Axiom infix_lsdt_def : forall (x:complex) (y:complex), (infix_lsdt x y) -> infix_lseqdt x y. Axiom infix_lsdt_def1 : forall (x:complex) (y:complex), (infix_lsdt x y) -> ~ (infix_eqeq x y). Axiom infix_lsdt_def2 : forall (x:complex) (y:complex), ((infix_lseqdt x y) /\ ~ (infix_eqeq x y)) -> infix_lsdt x y. Parameter infix_gteqdt: complex -> complex -> Prop. Axiom infix_gteqdt_def : forall (x:complex) (y:complex), (infix_gteqdt x y) -> infix_lseqdt y x. Axiom infix_gteqdt_def1 : forall (x:complex) (y:complex), (infix_lseqdt y x) -> infix_gteqdt x y. Parameter infix_gtdt: complex -> complex -> Prop. Axiom infix_gtdt_def : forall (x:complex) (y:complex), (infix_gtdt x y) -> infix_gteqdt x y. Axiom infix_gtdt_def1 : forall (x:complex) (y:complex), (infix_gtdt x y) -> ~ (infix_eqeq x y). Axiom infix_gtdt_def2 : forall (x:complex) (y:complex), ((infix_gteqdt x y) /\ ~ (infix_eqeq x y)) -> infix_gtdt x y. Axiom leq_left_real : forall (a:complex) (b:complex), (infix_lseqdt a b) -> (real_ a) -> real_ b. Axiom leq_right_real : forall (a:complex) (b:complex), (infix_lseqdt a b) -> (real_ b) -> real_ a. Axiom inf_left_real : forall (a:complex) (b:complex), (infix_lsdt a b) -> real_ a. Axiom inf_right_real : forall (a:complex) (b:complex), (infix_lsdt a b) -> real_ b. Axiom inf_from_real : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> (infix_lsas (real_part a) (real_part b)) -> infix_lsdt a b. Axiom inf_to_real : forall (a:complex) (b:complex), (infix_lsdt a b) -> infix_lsas (real_part a) (real_part b). Axiom leq_left_not_real_a : forall (a:complex) (b:complex), (infix_lseqdt a b) -> ~ (real_ a) -> (a = b). Axiom leq_left_not_real_b : forall (a:complex) (b:complex), (infix_lseqdt a b) -> ~ (real_ b) -> (a = b). Axiom Refl : forall (x:complex), infix_lseqdt x x. Axiom Trans : forall (x:complex) (y:complex) (z:complex), (infix_lseqdt x y) -> (infix_lseqdt y z) -> infix_lseqdt x z. Axiom Antisymm : forall (x:complex) (y:complex), (infix_lseqdt x y) -> (infix_lseqdt y x) -> (x = y). Axiom Refl1 : forall (x:complex), infix_gteqdt x x. Axiom Trans1 : forall (x:complex) (y:complex) (z:complex), (infix_gteqdt x y) -> (infix_gteqdt y z) -> infix_gteqdt x z. Axiom Antisymm1 : forall (x:complex) (y:complex), (infix_gteqdt x y) -> (infix_gteqdt y x) -> (x = y). Axiom Trans2 : forall (x:complex) (y:complex) (z:complex), (infix_lsdt x y) -> (infix_lsdt y z) -> infix_lsdt x z. Axiom Asymm : forall (x:complex) (y:complex), (infix_lsdt x y) -> ~ (infix_lsdt y x). Axiom Trans3 : forall (x:complex) (y:complex) (z:complex), (infix_gtdt x y) -> (infix_gtdt y z) -> infix_gtdt x z. Axiom Asymm1 : forall (x:complex) (y:complex), (infix_gtdt x y) -> ~ (infix_gtdt y x). Axiom r_to_c_inf : forall (i:R) (j:R), (infix_lseqdt (r_to_c i) (r_to_c j)) -> infix_lseqas i j. Axiom r_to_c_inf1 : forall (i:R) (j:R), (infix_lseqas i j) -> infix_lseqdt (r_to_c i) (r_to_c j). Axiom reali_is_its_real_part : forall (a:complex), (real_ a) -> (a = (r_to_c (real_part a))). Axiom inf_from_r : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> (infix_lseqas (real_part a) (real_part b)) -> infix_lseqdt a b. Axiom strict_inf_from_r : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> (infix_lsas (real_part a) (real_part b)) -> infix_lsdt a b. Axiom positive_inv_t : forall (x:complex), (infix_lsdt c_zero x) -> infix_lsdt c_zero (infix_sldt c_one x). Parameter pi: complex. Axiom pi_def : infix_lsdt (r_to_c 3%R) pi. Axiom real_pi : real_ pi. Axiom pi_sup_one : infix_lsdt c_one pi. Axiom pi_sup_zero : infix_lsdt c_zero pi. Axiom compat_order_mult : forall (x:complex) (y:complex) (z:complex), (infix_lseqdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lseqdt c_zero z) -> infix_lseqdt (infix_asdt x z) (infix_asdt y z). Axiom compat_order_add : forall (x:complex) (y:complex) (z:complex), (infix_lseqdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> infix_lseqdt (infix_pldt x z) (infix_pldt y z). Axiom compat_order_substr : forall (x:complex) (y:complex) (z:complex), (infix_lseqdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> infix_lseqdt (infix_mndt x z) (infix_mndt y z). Axiom compat_inf_mult : forall (x:complex) (y:complex) (z:complex), (infix_lsdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> infix_lsdt (infix_asdt x z) (infix_asdt y z). Axiom transitive_infeq : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt a b) -> (infix_lseqdt b c) -> infix_lseqdt a c. Axiom transitive_infeq_inf : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt a b) -> (infix_lsdt b c) -> infix_lsdt a c. Axiom transitive_inf_infeq : forall (a:complex) (b:complex) (c:complex), (infix_lsdt a b) -> (infix_lseqdt b c) -> infix_lsdt a c. Axiom transitive_inf : forall (a:complex) (b:complex) (c:complex), (infix_lsdt a b) -> (infix_lsdt b c) -> infix_lsdt a c. Axiom pi_sup_ttwo : infix_lsdt ttwo pi. Axiom transitive_leq_inv_r : forall (a:complex) (b:complex) (c:complex), (real_ a) -> (real_ b) -> (real_ c) -> (infix_lseqdt a b) -> (infix_lseqdt b (infix_sldt c_one c)) -> (infix_lseqdt c_one c) -> infix_lseqdt a b. Axiom transitive_leq_inv_r1 : forall (a:complex) (b:complex) (c:complex), (real_ a) -> (real_ b) -> (real_ c) -> (infix_lseqdt a b) -> (infix_lseqdt b (infix_sldt c_one c)) -> (infix_lseqdt c_one c) -> infix_lseqdt b c_one. Axiom compat_inf_mult_left : forall (x:complex) (y:complex) (z:complex), (infix_lsdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> infix_lsdt (infix_asdt z x) (infix_asdt z y). Axiom compat_inf_mult_both : forall (x:complex) (y:complex) (z:complex) (t:complex), (infix_lsdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> ((infix_lsdt c_zero z) /\ (infix_lsdt z t)) -> (infix_lsdt c_zero y) -> infix_lsdt (infix_asdt z x) (infix_asdt t y). Axiom compat_inf_add : forall (x:complex) (y:complex) (z:complex), (infix_lsdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> infix_lsdt (infix_pldt x z) (infix_pldt y z). Axiom compat_inf_add_left : forall (x:complex) (y:complex) (z:complex), (infix_lsdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> infix_lsdt (infix_pldt z x) (infix_pldt z y). Axiom compat_inf_add_both : forall (x:complex) (y:complex) (z:complex) (t:complex), (infix_lsdt x y) -> (infix_lsdt z t) -> infix_lsdt (infix_pldt x z) (infix_pldt y t). Axiom compat_inf_substr : forall (x:complex) (y:complex) (z:complex), (infix_lsdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> infix_lsdt (infix_mndt x z) (infix_mndt y z). Axiom real_inv : forall (x:complex), (real_ x) -> ~ (x = c_zero) -> real_ (infix_sldt c_one x). Axiom compat_order_mult_rev : forall (x:complex) (y:complex) (z:complex), (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> (infix_lseqdt (infix_asdt x z) (infix_asdt y z)) -> infix_lseqdt x y. Axiom compat_order_mult_left : forall (x:complex) (y:complex) (z:complex), (infix_lseqdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lseqdt c_zero z) -> infix_lseqdt (infix_asdt z x) (infix_asdt z y). Axiom strict_compat_order_mult : forall (x:complex) (y:complex) (z:complex), (infix_lsdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> infix_lsdt (infix_asdt x z) (infix_asdt y z). Axiom strict_compat_order_mult_left : forall (x:complex) (y:complex) (z:complex), (infix_lsdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> infix_lsdt (infix_asdt z x) (infix_asdt z y). Axiom complete_order_real : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> ~ (x = y) -> ~ (infix_lsdt x y) -> infix_lsdt y x. Axiom complete_order_real_ : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> ~ (infix_lsdt x y) -> ~ (infix_lsdt y x) -> (y = x). Axiom compat_order_mult_both : forall (x:complex) (y:complex) (z:complex) (t:complex), ((infix_lseqdt c_zero x) /\ (infix_lseqdt x y)) -> ((infix_lseqdt c_zero z) /\ (infix_lseqdt z t)) -> infix_lseqdt (infix_asdt z x) (infix_asdt t y). Axiom inf_to_non_sup_eq : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> (infix_lsdt x y) -> ~ (infix_gteqdt x y). Axiom sup_eq_to_non_inf : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> (infix_gteqdt x y) -> ~ (infix_lsdt x y). Axiom sup_to_inf : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> (infix_gtdt x y) -> infix_lsdt y x. Axiom inf_to_sup : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> (infix_lsdt x y) -> infix_gtdt y x. Axiom sup_to_non_inf_eq : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> (infix_gtdt x y) -> ~ (infix_lseqdt x y). Axiom inf_eq_to_non_sup : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> (infix_lseqdt x y) -> ~ (infix_gtdt x y). Axiom non_inf_eq_to_sup : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> ~ (infix_lseqdt x y) -> infix_gtdt x y. Axiom non_sup_toinf_eq : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> ~ (infix_gtdt x y) -> infix_lseqdt x y. Axiom real_mult : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> real_ (infix_asdt x y). Axiom real_add : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> real_ (infix_pldt x y). Axiom inv_pos : forall (x:complex), (real_ x) -> (infix_lsdt c_zero x) -> infix_lsdt c_zero (infix_sldt c_one x). Axiom lower_over_cons : forall (a:complex) (b:complex) (c:complex), (infix_lsdt c_zero c) -> (infix_lseqdt c_zero a) -> (infix_lseqdt a b) -> infix_lseqdt (infix_sldt a c) (infix_sldt b c). Axiom eq_to_leq_t : forall (a:complex) (b:complex), (real_ a) -> (a = b) -> infix_lseqdt a b. Axiom real_minus : forall (a:complex), (real_ a) -> real_ (prefix_mndt a). Axiom compat_r_to_c_infeq : forall (a:R) (b:R), (infix_lseqas a b) -> infix_lseqdt (r_to_c a) (r_to_c b). Axiom compat_r_to_c_inf : forall (a:R) (b:R), (infix_lsas a b) -> infix_lsdt (r_to_c a) (r_to_c b). Axiom compat_r_to_c_supeq : forall (a:R) (b:R), (infix_gteqas a b) -> infix_gteqdt (r_to_c a) (r_to_c b). Axiom compat_r_to_c_sup : forall (a:R) (b:R), (infix_gtas a b) -> infix_gtdt (r_to_c a) (r_to_c b). Axiom unic_inv : forall (i:complex) (j:complex), ~ (i = c_zero) -> ((infix_asdt i j) = c_one) -> (j = (inv i)). Axiom inf_eq_def : forall (x:complex) (y:complex), (infix_lseqdt x y) -> (real_ x) \/ (x = y). Axiom inf_eq_def1 : forall (x:complex) (y:complex), (infix_lseqdt x y) -> (real_ y) \/ (x = y). Axiom inf_eq_def2 : forall (x:complex) (y:complex), (infix_lseqdt x y) -> (infix_lseqas (real_part x) (real_part y)) \/ (x = y). Axiom inf_eq_def3 : forall (x:complex) (y:complex), ((real_ x) /\ ((real_ y) /\ (infix_lseqas (real_part x) (real_part y)))) -> infix_lseqdt x y. Axiom inf_eq_def4 : forall (x:complex) (y:complex), (x = y) -> infix_lseqdt x y. Axiom inf_minus : forall (x:complex) (y:complex), (infix_lsdt x y) -> infix_lsdt (prefix_mndt y) (prefix_mndt x). Axiom absorbing_zero : forall (a:complex) (b:complex), ((infix_asdt a b) = c_zero) -> ~ (a = c_zero) -> (b = c_zero). Axiom absorbing_zero1 : forall (a:complex) (b:complex), ((infix_asdt a b) = c_zero) -> ~ (b = c_zero) -> (a = c_zero). Axiom inf_zero_inv : forall (z:complex), (infix_lsdt c_zero z) -> infix_lsdt c_zero (infix_sldt c_one z). Axiom inf_zero_inv1 : forall (z:complex), (infix_lsdt c_zero z) -> infix_lseqdt c_zero (infix_sldt c_one z). Axiom mult_pos : forall (x:complex) (y:complex), (infix_lseqdt c_zero x) -> (infix_lseqdt c_zero y) -> infix_lseqdt c_zero (infix_asdt x y). Axiom simpl_leq_mult_div : forall (a:complex) (b:complex) (c:complex), (real_ a) -> (infix_lsdt c_zero b) -> (infix_lseqdt (infix_asdt a b) c) -> infix_lseqdt a (infix_asdt (infix_sldt c_one b) c). Axiom mult_leq_c_one_leq : forall (a:complex) (b:complex), (infix_lseqdt c_zero a) -> ((infix_lseqdt c_zero b) /\ (infix_lseqdt b c_one)) -> infix_lseqdt (infix_asdt a b) a. Axiom mult_leq_c_one_leq_gen : forall (a:complex) (a':complex) (b:complex), (infix_lseqdt c_zero a) -> ((infix_lseqdt c_zero b) /\ (infix_lseqdt b c_one)) -> (a = a') -> infix_lseqdt (infix_asdt a b) a'. Axiom mult_leq_c_one : forall (a:complex) (b:complex), (infix_lseqdt c_zero a) -> (exists c:complex, (infix_lseqdt a c) /\ (b = (infix_sldt c_one c))) -> (infix_lsdt c_zero b) -> infix_lseqdt (infix_asdt a b) c_one. Axiom mult_leq_c_one_expl : forall (a:complex) (b:complex) (d:complex), (infix_lseqdt c_zero a) -> (infix_lseqdt a d) -> (infix_lsdt c_zero d) -> (b = (infix_sldt c_one d)) -> infix_lseqdt (infix_asdt a b) c_one. Axiom mult_leq_c_one_rev : forall (a:complex) (b:complex), (infix_lseqdt c_zero a) -> (infix_lsdt c_zero b) -> (infix_lseqdt (infix_asdt a b) c_one) -> infix_lseqdt a (infix_sldt c_one b). Axiom simpl_leq_mult : forall (a:complex) (b:complex) (c:complex), (infix_lsdt c_zero b) -> (infix_lseqdt a c) -> infix_lseqdt (infix_asdt a b) (infix_asdt c b). Axiom simpl_leq_mult_inv : forall (a:complex) (b:complex) (c:complex), (infix_lsdt c_zero a) -> (infix_lsdt c_zero b) -> (infix_lsdt c_zero c) -> (infix_lseqdt a (infix_sldt c_one (infix_asdt b c))) -> infix_lseqdt (infix_asdt a b) (infix_sldt c_one c). Axiom mult_to_div_leq : forall (a:complex) (b:complex) (c:complex), (real_ a) -> (infix_lsdt c_zero b) -> (infix_lseqdt (infix_asdt a b) c) -> infix_lseqdt a (infix_asdt (infix_sldt c_one b) c). Axiom mult_div : forall (x:complex) (y:complex), (infix_lseqdt c_zero x) -> (infix_lsdt c_zero y) -> infix_lseqdt c_zero (infix_sldt x y). Axiom strict_mult_pos : forall (x:complex) (y:complex), (infix_lsdt c_zero x) -> (infix_lsdt c_zero y) -> infix_lsdt c_zero (infix_asdt x y). Axiom rewrite_supeq : forall (x:complex) (y:complex), (infix_lseqdt x y) -> infix_gteqdt y x. Axiom rewrite_sup : forall (x:complex) (y:complex), (infix_lsdt x y) -> infix_gtdt y x. Axiom inv_order_complex : forall (a:complex) (b:complex), (infix_lsdt c_zero a) -> (infix_lsdt c_zero b) -> (infix_lseqdt a b) -> infix_lseqdt (infix_sldt c_one b) (infix_sldt c_one a). Axiom compat_inv_order : forall (a:complex) (b:complex) (c:complex), ((infix_lsdt c_zero a) /\ (infix_lseqdt a b)) -> (infix_lseqdt c (infix_sldt c_one b)) -> infix_lseqdt c (infix_sldt c_one a). Axiom leq_by_div_simpl : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt c_zero a) -> ((infix_lsdt c_zero b) /\ (infix_lseqdt b c)) -> infix_lseqdt (infix_sldt a c) (infix_sldt a b). Axiom leq_by_div : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt c_zero a) -> ((infix_lsdt c_zero b) /\ (infix_lseqdt b c)) -> infix_lseqdt (infix_sldt a c) (infix_sldt a b). Axiom inf_def : forall (x:complex) (y:complex), (infix_lsdt x y) -> real_ x. Axiom inf_def1 : forall (x:complex) (y:complex), (infix_lsdt x y) -> real_ y. Axiom inf_def2 : forall (x:complex) (y:complex), (infix_lsdt x y) -> infix_lsas (real_part x) (real_part y). Axiom inf_def3 : forall (x:complex) (y:complex), ((real_ x) /\ ((real_ y) /\ (infix_lsas (real_part x) (real_part y)))) -> infix_lsdt x y. Axiom sup_eq_def : forall (x:complex) (y:complex), (infix_gteqdt x y) -> (real_ x) \/ (x = y). Axiom sup_eq_def1 : forall (x:complex) (y:complex), (infix_gteqdt x y) -> (real_ y) \/ (x = y). Axiom sup_eq_def2 : forall (x:complex) (y:complex), (infix_gteqdt x y) -> (infix_gteqas (real_part x) (real_part y)) \/ (x = y). Axiom sup_eq_def3 : forall (x:complex) (y:complex), ((real_ x) /\ ((real_ y) /\ (infix_gteqas (real_part x) (real_part y)))) -> infix_gteqdt x y. Axiom sup_eq_def4 : forall (x:complex) (y:complex), (x = y) -> infix_gteqdt x y. Axiom sup_def : forall (x:complex) (y:complex), (infix_gtdt x y) -> real_ x. Axiom sup_def1 : forall (x:complex) (y:complex), (infix_gtdt x y) -> real_ y. Axiom sup_def2 : forall (x:complex) (y:complex), (infix_gtdt x y) -> infix_gtas (real_part x) (real_part y). Axiom sup_def3 : forall (x:complex) (y:complex), ((real_ x) /\ ((real_ y) /\ (infix_gtas (real_part x) (real_part y)))) -> infix_gtdt x y. Axiom assoc_mult_div : forall (x:complex) (y:complex) (z:complex), ~ (z = c_zero) -> ((infix_asdt x (infix_sldt y z)) = (infix_sldt (infix_asdt x y) z)). Axiom assoc_mult_div_rev : forall (x:complex) (y:complex) (z:complex), ~ (z = c_zero) -> ((infix_sldt (infix_asdt x y) z) = (infix_asdt x (infix_sldt y z))). Axiom subst_zero : forall (a:complex), ((infix_mndt a c_zero) = a). Axiom subst_zero_gen : forall (a:complex) (b:complex), (b = c_zero) -> ((infix_mndt a b) = a). Axiom transitive_inf_inv_r : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt a b) -> (infix_lseqdt b (infix_sldt c_one c)) -> (infix_lsdt c_one c) -> infix_lseqdt a b. Axiom transitive_inf_inv_r1 : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt a b) -> (infix_lseqdt b (infix_sldt c_one c)) -> (infix_lsdt c_one c) -> infix_lsdt b c_one. Axiom infeq_scal_r : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt a c) -> (infix_lseqdt c_zero b) -> infix_lseqdt (infix_asdt a b) (infix_asdt c b). Axiom infeq_scal_l : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt a c) -> (infix_lseqdt c_zero b) -> infix_lseqdt (infix_asdt b a) (infix_asdt b c). Axiom transitive_supeq : forall (a:complex) (b:complex) (c:complex), (infix_gteqdt a b) -> (infix_gteqdt b c) -> infix_gteqdt a c. Axiom transitive_inf_l : forall (a:complex) (b:complex) (c:complex), (infix_lsdt a b) -> (infix_lseqdt b c) -> infix_lsdt a c. Axiom transitive_sup_l : forall (a:complex) (b:complex) (c:complex), (infix_gtdt a b) -> (infix_gteqdt b c) -> infix_gtdt a c. Axiom transitive_inf_r : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt a b) -> (infix_lsdt b c) -> infix_lsdt a c. Axiom transitive_sup_r : forall (a:complex) (b:complex) (c:complex), (infix_gteqdt a b) -> (infix_gtdt b c) -> infix_gtdt a c. Axiom simpl_frac_r : forall (x:complex) (y:complex), ~ (x = c_zero) -> ((infix_asdt x (infix_sldt y x)) = y). Axiom compat_mult_sup_eq_right : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt c_zero a) -> (infix_gteqdt b c) -> infix_gteqdt (infix_asdt a b) (infix_asdt a c). Axiom compat_mult_sup_right : forall (a:complex) (b:complex) (c:complex), (infix_lsdt c_zero a) -> (infix_gtdt b c) -> infix_gtdt (infix_asdt a b) (infix_asdt a c). Axiom compat_mult_inf_right : forall (a:complex) (b:complex) (c:complex), (infix_lsdt c_zero a) -> (infix_lsdt b c) -> infix_lsdt (infix_asdt a b) (infix_asdt a c). Axiom infeq_to_supeq : forall (a:complex) (b:complex), (infix_lseqdt a b) -> infix_gteqdt b a. Axiom infeq_inv : forall (a:complex) (b:complex), (infix_lseqdt a b) -> infix_lseqdt (prefix_mndt b) (prefix_mndt a). Axiom infeq_inv_add_l : forall (a:complex) (b:complex) (c:complex), (infix_lseqdt (infix_pldt a c) b) -> (real_ a) -> (real_ c) -> infix_lseqdt a (infix_mndt b c). Axiom infeq_inv_add_r : forall (a:complex) (b:complex) (c:complex), (real_ a) -> (real_ c) -> (infix_lseqdt a (infix_pldt b c)) -> infix_lseqdt (infix_mndt a c) b. Axiom r_to_c_surj : forall (x:R) (y:R), ~ (x = y) -> ~ ((r_to_c x) = (r_to_c y)). Axiom r_to_c_inf_rev : forall (x:R) (y:R), (infix_lsas x y) -> infix_lsdt (r_to_c x) (r_to_c y). Axiom div_simpl : forall (a:complex) (b:complex), (infix_lsdt c_zero a) -> (infix_lsdt c_zero b) -> ((infix_sldt c_one b) = (infix_sldt a (infix_asdt a b))). Axiom infeq_inv_subs_l : forall (a:complex) (b:complex) (c:complex), (real_ a) -> (real_ b) -> (real_ c) -> (infix_lseqdt (infix_mndt a c) b) -> infix_lseqdt a (infix_pldt b c). Axiom infeq_inv_subs_r : forall (a:complex) (b:complex) (c:complex), (real_ a) -> (real_ b) -> (real_ c) -> (infix_lseqdt a (infix_mndt b c)) -> infix_lseqdt (infix_pldt a c) b. Axiom infeq_pos_elim : forall (a:complex) (b:complex), (real_ a) -> (infix_lseqdt c_zero b) -> infix_lseqdt a (infix_pldt a b). Axiom infeq_pos_elim_add : forall (a:complex) (b:complex) (c:complex), (real_ a) -> (real_ b) -> (real_ c) -> (infix_lseqdt c_zero b) -> (infix_lseqdt c a) -> infix_lseqdt c (infix_pldt a b). Axiom supeq_elim_left : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> (infix_gteqdt a b) -> infix_gteqdt c_zero (infix_mndt b a). Axiom sup_elim_left : forall (a:complex) (b:complex), (infix_gtdt a b) -> infix_gtdt c_zero (infix_mndt b a). Axiom infeq_elim_left : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> (infix_lseqdt a b) -> infix_lseqdt c_zero (infix_mndt b a). Axiom inf_elim_left : forall (a:complex) (b:complex), (infix_lsdt a b) -> infix_lsdt c_zero (infix_mndt b a). Axiom t_im_real : forall (a:complex) (b:complex), ((t_im_part (infix_asdt a b)) = (infix_pldt (infix_asdt (t_real_part a) (t_im_part b)) (infix_asdt (t_im_part a) (t_real_part b)))). Axiom t_decomp_mult : forall (a:complex) (b:complex), ((infix_asdt a b) = (infix_pldt (infix_mndt (infix_asdt (t_real_part a) (t_real_part b)) (infix_asdt (t_im_part a) (t_im_part b))) (infix_asdt im (infix_pldt (infix_asdt (t_real_part a) (t_im_part b)) (infix_asdt (t_im_part a) (t_real_part b)))))). Axiom t_complex_decomp : forall (i:complex), (i = (infix_pldt (t_real_part i) (infix_asdt im (t_im_part i)))). Axiom t_unic_decomp : forall (i:complex) (a:complex) (b:complex), (real_ a) -> (real_ b) -> (i = (infix_pldt a (infix_asdt im b))) -> (a = (t_real_part i)). Axiom t_unic_decomp1 : forall (i:complex) (a:complex) (b:complex), (real_ a) -> (real_ b) -> (i = (infix_pldt a (infix_asdt im b))) -> (b = (t_im_part i)). Axiom t_decomp_minus : forall (i:complex) (a:complex) (b:complex), (real_ a) -> (real_ b) -> (i = (infix_mndt a (infix_asdt im b))) -> (a = (t_real_part i)). Axiom t_decomp_minus1 : forall (i:complex) (a:complex) (b:complex), (real_ a) -> (real_ b) -> (i = (infix_mndt a (infix_asdt im b))) -> ((prefix_mndt b) = (t_im_part i)). Axiom real_sum : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> real_ (infix_pldt x y). Axiom set : forall (a:Type), Type. Parameter set_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (set a). Existing Instance set_WhyType. Parameter mem: forall {a:Type} {a_WT:WhyType a}, a -> (set a) -> Prop. Parameter infix_eqeq1: forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> Prop. Axiom infix_eqeq_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), (infix_eqeq1 s1 s2) -> forall (x:a), (mem x s1) -> mem x s2. Axiom infix_eqeq_spec3 : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), (infix_eqeq1 s1 s2) -> forall (x:a), (mem x s2) -> mem x s1. Axiom infix_eqeq_spec4 : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), (forall (x:a), (mem x s1) <-> (mem x s2)) -> infix_eqeq1 s1 s2. Axiom extensionality : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), (infix_eqeq1 s1 s2) -> (s1 = s2). Parameter subset: forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> Prop. Axiom subset_spec : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), (subset s1 s2) -> forall (x:a), (mem x s1) -> mem x s2. Axiom subset_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), (forall (x:a), (mem x s1) -> mem x s2) -> subset s1 s2. Axiom subset_refl : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), subset s s. Axiom subset_trans : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a) (s3:set a), (subset s1 s2) -> (subset s2 s3) -> subset s1 s3. Parameter is_empty: forall {a:Type} {a_WT:WhyType a}, (set a) -> Prop. Axiom is_empty_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), (is_empty s) -> forall (x:a), ~ (mem x s). Axiom is_empty_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), (forall (x:a), ~ (mem x s)) -> is_empty s. Parameter empty: forall {a:Type} {a_WT:WhyType a}, set a. Axiom empty_def : forall {a:Type} {a_WT:WhyType a}, is_empty (empty : set a). Parameter add: forall {a:Type} {a_WT:WhyType a}, a -> (set a) -> set a. Axiom add_spec : forall {a:Type} {a_WT:WhyType a}, forall (x:a) (s:set a), forall (y:a), (mem y (add x s)) -> (y = x) \/ (mem y s). Axiom add_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (x:a) (s:set a), forall (y:a), (y = x) -> mem y (add x s). Axiom add_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (x:a) (s:set a), forall (y:a), (mem y s) -> mem y (add x s). Parameter singleton: forall {a:Type} {a_WT:WhyType a}, a -> set a. Axiom singleton_def : forall {a:Type} {a_WT:WhyType a}, forall (x:a), ((singleton x) = (add x (empty : set a))). Parameter remove: forall {a:Type} {a_WT:WhyType a}, a -> (set a) -> set a. Axiom remove_spec : forall {a:Type} {a_WT:WhyType a}, forall (x:a) (s:set a), forall (y:a), (mem y (remove x s)) -> ~ (y = x). Axiom remove_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (x:a) (s:set a), forall (y:a), (mem y (remove x s)) -> mem y s. Axiom remove_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (x:a) (s:set a), forall (y:a), (~ (y = x) /\ (mem y s)) -> mem y (remove x s). Axiom add_remove : forall {a:Type} {a_WT:WhyType a}, forall (x:a) (s:set a), (mem x s) -> ((add x (remove x s)) = s). Axiom remove_add : forall {a:Type} {a_WT:WhyType a}, forall (x:a) (s:set a), ((remove x (add x s)) = (remove x s)). Axiom subset_remove : forall {a:Type} {a_WT:WhyType a}, forall (x:a) (s:set a), subset (remove x s) s. Parameter union: forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> set a. Axiom union_spec : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), forall (x:a), (mem x (union s1 s2)) -> (mem x s1) \/ (mem x s2). Axiom union_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), forall (x:a), (mem x s1) -> mem x (union s1 s2). Axiom union_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), forall (x:a), (mem x s2) -> mem x (union s1 s2). Parameter inter: forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> set a. Axiom inter_spec : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), forall (x:a), (mem x (inter s1 s2)) -> mem x s1. Axiom inter_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), forall (x:a), (mem x (inter s1 s2)) -> mem x s2. Axiom inter_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), forall (x:a), ((mem x s1) /\ (mem x s2)) -> mem x (inter s1 s2). Parameter diff: forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> set a. Axiom diff_spec : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), forall (x:a), (mem x (diff s1 s2)) -> mem x s1. Axiom diff_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), forall (x:a), (mem x (diff s1 s2)) -> ~ (mem x s2). Axiom diff_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), forall (x:a), ((mem x s1) /\ ~ (mem x s2)) -> mem x (diff s1 s2). Axiom subset_diff : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), subset (diff s1 s2) s1. Parameter choose: forall {a:Type} {a_WT:WhyType a}, (set a) -> a. Axiom choose_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), ~ (is_empty s) -> mem (choose s) s. Parameter cardinal: forall {a:Type} {a_WT:WhyType a}, (set a) -> Z. Axiom cardinal_nonneg : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), ((cardinal s) >= 0%Z)%Z. Axiom cardinal_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), ((cardinal s) = 0%Z) -> is_empty s. Axiom cardinal_empty1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), (is_empty s) -> ((cardinal s) = 0%Z). Axiom cardinal_add : forall {a:Type} {a_WT:WhyType a}, forall (x:a), forall (s:set a), ~ (mem x s) -> ((cardinal (add x s)) = (1%Z + (cardinal s))%Z). Axiom cardinal_remove : forall {a:Type} {a_WT:WhyType a}, forall (x:a), forall (s:set a), (mem x s) -> ((cardinal s) = (1%Z + (cardinal (remove x s)))%Z). Axiom cardinal_subset : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), (subset s1 s2) -> ((cardinal s1) <= (cardinal s2))%Z. Axiom subset_eq : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a), (subset s1 s2) -> ((cardinal s1) = (cardinal s2)) -> infix_eqeq1 s1 s2. Axiom cardinal1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), ((cardinal s) = 1%Z) -> forall (x:a), (mem x s) -> (x = (choose s)). Axiom real_diff : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> real_ (infix_mndt x y). Axiom pure_im_sum : forall (x:complex) (y:complex), (pure_im_ x) -> (pure_im_ y) -> pure_im_ (infix_pldt x y). Axiom equal_decomp : forall (x:complex) (y:complex), ((real_part x) = (real_part y)) -> ((im_part x) = (im_part y)) -> (x = y). Axiom t_equal_decomp : forall (x:complex) (y:complex), ((t_real_part x) = (t_real_part y)) -> ((t_im_part x) = (t_im_part y)) -> (x = y). Axiom pure_im_diff : forall (x:complex) (y:complex), (pure_im_ x) -> (pure_im_ y) -> pure_im_ (infix_mndt x y). Axiom real_div : forall (x:complex) (y:complex), (real_ x) -> ~ (y = c_zero) -> (real_ y) -> real_ (infix_sldt x y). Axiom mult_im_im : forall (a:complex) (b:complex), (pure_im_ a) -> (pure_im_ b) -> ((infix_asdt a b) = (infix_asdt (infix_asdt im im) (infix_asdt (r_to_c (im_part a)) (r_to_c (im_part b))))). Axiom mult_im_im1 : forall (a:complex) (b:complex), (pure_im_ a) -> (pure_im_ b) -> ((infix_asdt a b) = (prefix_mndt (r_to_c (infix_asas (im_part a) (im_part b))))). Axiom mult_im_im2 : forall (a:complex) (b:complex), (pure_im_ a) -> (pure_im_ b) -> ((real_part (infix_asdt a b)) = (prefix_mnas (infix_asas (im_part a) (im_part b)))). Axiom mult_im_im3 : forall (a:complex) (b:complex), (pure_im_ a) -> (pure_im_ b) -> ((im_part (infix_asdt a b)) = 0%R). Axiom mult_real_im : forall (a:complex) (b:complex), (real_ a) -> (pure_im_ b) -> ((infix_asdt a b) = (infix_asdt im (infix_asdt (r_to_c (real_part a)) (r_to_c (im_part b))))). Axiom mult_real_im1 : forall (a:complex) (b:complex), (real_ a) -> (pure_im_ b) -> ((infix_asdt a b) = (infix_asdt im (r_to_c (infix_asas (real_part a) (im_part b))))). Axiom mult_real_im2 : forall (a:complex) (b:complex), (real_ a) -> (pure_im_ b) -> ((real_part (infix_asdt a b)) = 0%R). Axiom mult_real_im3 : forall (a:complex) (b:complex), (real_ a) -> (pure_im_ b) -> ((im_part (infix_asdt a b)) = (infix_asas (real_part a) (im_part b))). Axiom mult_im_real : forall (a:complex) (b:complex), (pure_im_ a) -> (real_ b) -> ((infix_asdt a b) = (infix_asdt im (infix_asdt (r_to_c (im_part a)) (r_to_c (real_part b))))). Axiom mult_im_real1 : forall (a:complex) (b:complex), (pure_im_ a) -> (real_ b) -> ((infix_asdt a b) = (infix_asdt im (r_to_c (infix_asas (im_part a) (real_part b))))). Axiom mult_im_real2 : forall (a:complex) (b:complex), (pure_im_ a) -> (real_ b) -> ((real_part (infix_asdt a b)) = 0%R). Axiom mult_im_real3 : forall (a:complex) (b:complex), (pure_im_ a) -> (real_ b) -> ((im_part (infix_asdt a b)) = (infix_asas (im_part a) (real_part b))). Axiom decomp_mult_gen : forall (a:complex) (b:complex), ((real_part (infix_asdt a b)) = (infix_mnas (infix_asas (real_part a) (real_part b)) (infix_asas (im_part a) (im_part b)))). Axiom decomp_mult_gen1 : forall (a:complex) (b:complex), ((im_part (infix_asdt a b)) = (infix_plas (infix_asas (real_part a) (im_part b)) (infix_asas (im_part a) (real_part b)))). Axiom inv_real : forall (a:complex), ~ (a = c_zero) -> (real_ a) -> ((real_part (infix_sldt c_one a)) = (infix_slas 1%R (real_part a))). Axiom inv_real1 : forall (a:complex), ~ (a = c_zero) -> (real_ a) -> real_ (infix_sldt c_one a). Axiom div_real_real : forall (a:complex) (b:complex), (real_ a) -> (real_ b) -> ~ (b = c_zero) -> ((real_part (infix_sldt a b)) = (infix_slas (real_part a) (real_part b))). Axiom zeroLessOne : infix_lseqdt c_zero c_one. Axiom compatOrderAdd : forall (x:complex) (y:complex) (z:complex), (infix_lseqdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> infix_lseqdt (infix_pldt x z) (infix_pldt y z). Axiom positive_add : forall (x:complex) (y:complex), (infix_lseqdt c_zero x) -> (infix_lseqdt c_zero y) -> infix_lseqdt c_zero (infix_pldt x y). Axiom strict_positive_add_l : forall (x:complex) (y:complex), (infix_lsdt c_zero x) -> (infix_lseqdt c_zero y) -> infix_lsdt c_zero (infix_pldt x y). Axiom strict_compatOrderAdd : forall (x:complex) (y:complex) (z:complex) (t:complex), (infix_lsdt x y) -> (infix_lsdt z t) -> (real_ x) -> (real_ y) -> (real_ z) -> (real_ t) -> infix_lsdt (infix_pldt x z) (infix_pldt y t). Axiom compat_sup_add : forall (x:complex) (y:complex) (z:complex) (t:complex), (infix_gtdt x y) -> (infix_gtdt z t) -> (real_ x) -> (real_ y) -> (real_ z) -> (real_ t) -> infix_gtdt (infix_pldt x z) (infix_pldt y t). Axiom compat_supeq_mult : forall (x:complex) (y:complex) (z:complex), (infix_gteqdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lseqdt c_zero z) -> infix_gteqdt (infix_asdt x z) (infix_asdt y z). Axiom compat_supeq_div : forall (x:complex) (y:complex) (z:complex), (infix_gteqdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> infix_gteqdt (infix_sldt x z) (infix_sldt y z). Axiom compat_infeq_div : forall (x:complex) (y:complex) (z:complex), (infix_lseqdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> infix_lseqdt (infix_sldt x z) (infix_sldt y z). Axiom compat_sup_div : forall (x:complex) (y:complex) (z:complex), (infix_gtdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> infix_gtdt (infix_sldt x z) (infix_sldt y z). Axiom compat_inf_div : forall (x:complex) (y:complex) (z:complex), (infix_lsdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> infix_lsdt (infix_sldt x z) (infix_sldt y z). Axiom positive_prod_itself : forall (x:complex), (real_ x) -> infix_lseqdt c_zero (infix_asdt x x). Axiom strict_positive_prod_itself : forall (x:complex), (real_ x) -> ~ (x = c_zero) -> infix_lsdt c_zero (infix_asdt x x). Axiom compat_sup_mult : forall (x:complex) (y:complex) (z:complex), (infix_gteqdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lseqdt c_zero z) -> infix_gteqdt (infix_asdt x z) (infix_asdt y z). Axiom strict_compat_sup_mult : forall (x:complex) (y:complex) (z:complex), (infix_gtdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> infix_gtdt (infix_asdt x z) (infix_asdt y z). Axiom compat_sup_mult_left : forall (x:complex) (y:complex) (z:complex), (infix_gteqdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lseqdt c_zero z) -> infix_gteqdt (infix_asdt z x) (infix_asdt z y). Axiom strict_compat_sup_mult_left : forall (x:complex) (y:complex) (z:complex), (infix_gtdt x y) -> (real_ x) -> (real_ y) -> (real_ z) -> (infix_lsdt c_zero z) -> infix_gtdt (infix_asdt z x) (infix_asdt z y). Axiom inv_inf_eq : forall (a:complex) (b:complex), (infix_lsdt c_zero a) -> (infix_lsdt c_zero b) -> (infix_lseqdt a b) -> infix_lseqdt (infix_sldt c_one b) (infix_sldt c_one a). Axiom inv_sup_eq : forall (a:complex) (b:complex), (infix_lsdt c_zero a) -> (infix_lsdt c_zero b) -> (infix_gteqdt a b) -> infix_gteqdt (infix_sldt c_one b) (infix_sldt c_one a). Axiom inv_sup : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> ((infix_lsdt c_zero x) /\ (infix_lsdt x y)) -> infix_gtdt (infix_sldt c_one x) (infix_sldt c_one y). Axiom inv_eqinf : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> ((infix_lsdt c_zero x) /\ (infix_lseqdt x y)) -> infix_gteqdt (infix_sldt c_one x) (infix_sldt c_one y). Axiom inv_eqsup : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> ((infix_gteqdt x y) /\ (infix_gtdt y c_zero)) -> infix_lseqdt (infix_sldt c_one x) (infix_sldt c_one y). Axiom inv_inf : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> ((infix_gtdt x y) /\ (infix_gtdt y c_zero)) -> infix_lsdt (infix_sldt c_one x) (infix_sldt c_one y). Axiom inv_neg : forall (x:complex), (real_ x) -> (infix_lsdt x c_zero) -> infix_lsdt (infix_sldt c_one x) c_zero. Axiom lower_inv : forall (a:complex) (b:complex) (c:complex), (infix_lsdt c_zero b) -> (infix_lseqdt c_zero a) -> (infix_lseqdt b c) -> infix_gteqdt (infix_sldt a b) (infix_sldt a c). Axiom lower_inv_ : forall (a:complex) (b:complex) (c:complex), (infix_lsdt c_zero b) -> (infix_lseqdt c_zero a) -> (infix_lseqdt b c) -> infix_lseqdt (infix_sldt a c) (infix_sldt a b). Axiom zero_add_t : forall (a1:complex) (a2:complex), (a1 = c_zero) -> ((infix_pldt a1 a2) = a2). Axiom add_zero_t : forall (a1:complex) (a2:complex), (a2 = c_zero) -> ((infix_pldt a1 a2) = a1). Axiom one_mult_t : forall (a1:complex) (a2:complex), (a1 = c_one) -> ((infix_asdt a1 a2) = a2). Axiom one_mult_t_const : forall (a:complex), ((infix_asdt c_one a) = a). Axiom zero_mult_t_const : forall (a:complex), ((infix_asdt c_zero a) = c_zero). Axiom mult_zero_t_const : forall (a:complex), ((infix_asdt a c_zero) = c_zero). Axiom subs_eq : forall (a1:complex) (a2:complex) (b1:complex) (b2:complex), (a1 = a2) -> (b1 = b2) -> ((infix_mndt a1 b1) = (infix_mndt a2 b2)). Axiom subst_itself : forall (a1:complex) (a2:complex), (a1 = a2) -> ((infix_mndt a1 a2) = c_zero). Axiom mult_assoc_four : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_asdt (infix_asdt a (infix_asdt b c)) d) = (infix_asdt (infix_asdt a b) (infix_asdt c d))). Axiom mult_assoc_rev : forall (a:complex) (b:complex) (c:complex), ((infix_asdt a (infix_asdt b c)) = (infix_asdt (infix_asdt a b) c)). Axiom add_assoc : forall (a:complex) (b:complex) (c:complex), ((infix_pldt (infix_pldt a b) c) = (infix_pldt a (infix_pldt b c))). Axiom add_assoc_rev : forall (a:complex) (b:complex) (c:complex), ((infix_pldt a (infix_pldt b c)) = (infix_pldt (infix_pldt a b) c)). Axiom div_mult : forall (a:complex) (b:complex) (c:complex), ~ (c = c_zero) -> ((infix_asdt a (infix_sldt b c)) = (infix_sldt (infix_asdt a b) c)). Axiom div_mult_rev : forall (a:complex) (b:complex) (c:complex), ~ (c = c_zero) -> ((infix_sldt (infix_asdt a b) c) = (infix_asdt a (infix_sldt b c))). Axiom triang_p : forall (a:complex) (b:complex), ((infix_asdt (infix_pldt a b) (infix_pldt a b)) = (infix_pldt (infix_pldt (infix_asdt a a) (infix_asdt b b)) (infix_asdt (infix_asdt ttwo a) b))). Axiom triang_n : forall (a:complex) (b:complex), ((infix_asdt (infix_mndt a b) (infix_mndt a b)) = (infix_mndt (infix_pldt (infix_asdt a a) (infix_asdt b b)) (infix_asdt (infix_asdt ttwo a) b))). Axiom triang_s : forall (a:complex) (b:complex) (c:complex) (d:complex) (e:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) (infix_pldt (infix_mndt d b) e)) = (infix_pldt (infix_pldt a c) (infix_pldt d e))). Axiom triang_t : forall (a:complex) (b:complex), ((infix_asdt (infix_pldt a b) (infix_mndt a b)) = (infix_mndt (infix_asdt a a) (infix_asdt b b))). Axiom triang_sr : forall (a:complex) (b:complex) (c:complex) (d:complex) (e:complex), ((infix_pldt (infix_pldt (infix_mndt a b) c) (infix_pldt (infix_pldt d b) e)) = (infix_pldt (infix_pldt a c) (infix_pldt d e))). Axiom add_pos : forall (x:complex) (y:complex), (infix_lseqdt c_zero x) -> (infix_lseqdt c_zero y) -> infix_lseqdt c_zero (infix_pldt x y). Axiom add_pos_strit_l : forall (x:complex) (y:complex), (infix_lsdt c_zero x) -> (infix_lseqdt c_zero y) -> infix_lsdt c_zero (infix_pldt x y). Axiom add_pos_strit_r : forall (x:complex) (y:complex), (infix_lseqdt c_zero x) -> (infix_lsdt c_zero y) -> infix_lsdt c_zero (infix_pldt x y). Axiom modulus_pre_pre : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_asdt a b) (infix_asdt c d)) (infix_pldt (infix_asdt a d) (infix_asdt c b))) = (infix_pldt (infix_asdt a (infix_pldt b d)) (infix_asdt c (infix_pldt b d)))). Axiom modulus_pre_pre1 : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_asdt a b) (infix_asdt c d)) (infix_pldt (infix_asdt a d) (infix_asdt c b))) = (infix_asdt (infix_pldt a c) (infix_pldt b d))). Axiom modulus_pre : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_asdt (infix_asdt a b) (infix_asdt a b)) (infix_asdt (infix_asdt c d) (infix_asdt c d))) (infix_pldt (infix_asdt (infix_asdt a d) (infix_asdt a d)) (infix_asdt (infix_asdt c b) (infix_asdt c b)))) = (infix_asdt (infix_pldt (infix_asdt a a) (infix_asdt c c)) (infix_pldt (infix_asdt b b) (infix_asdt d d)))). Parameter real_sqrt: R -> R. Axiom real_sqrt_spec : forall (x:R), (infix_lseqas 0%R x) -> ((infix_asas (real_sqrt x) (real_sqrt x)) = x). Axiom real_sqrt_spec1 : forall (x:R), (infix_lseqas 0%R x) -> ((real_sqrt x) = (Reals.R_sqrt.sqrt x)). Parameter square_rt: complex -> complex. Axiom square_rt_def : forall (x:complex), (infix_lseqdt c_zero x) -> ((square_rt x) = (r_to_c (real_sqrt (real_part x)))). Axiom square_rt_spec : forall (x:complex), (infix_lseqdt c_zero x) -> real_ (square_rt x). Axiom square_rt_spec1 : forall (x:complex), (infix_lseqdt c_zero x) -> ((infix_asdt (square_rt x) (square_rt x)) = x). Axiom square_rt_spec2 : forall (x:complex), (infix_lseqdt c_zero x) -> infix_lseqdt c_zero (square_rt x). Axiom square_rt_eq : forall (a:complex) (b:complex), (infix_lseqdt c_zero a) -> (infix_lseqdt c_zero b) -> (a = b) -> ((square_rt a) = (square_rt b)). Axiom real_square_rt : forall (x:complex), (real_ x) -> (infix_lseqdt c_zero x) -> real_ (square_rt x). Axiom pos_square_rt : forall (x:complex), (real_ x) -> (infix_lseqdt c_zero x) -> infix_gteqdt (square_rt x) c_zero. Axiom square_rt_square : forall (x:complex), (infix_lseqdt c_zero x) -> ((infix_asdt (square_rt x) (square_rt x)) = x). Axiom square_rt_infeq : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> ((infix_lseqdt c_zero x) /\ (infix_lseqdt x y)) -> infix_lseqdt (square_rt x) (square_rt y). Axiom square_rt_inf : forall (x:complex) (y:complex), ((infix_lseqdt c_zero x) /\ (infix_lsdt x y)) -> infix_lsdt (square_rt x) (square_rt y). Axiom injective_square_rt : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> (infix_lseqdt c_zero x) -> (infix_lseqdt c_zero y) -> ((square_rt x) = (square_rt y)) -> (x = y). Axiom injective_square : forall (x:complex) (y:complex), (real_ x) -> (real_ y) -> (infix_lseqdt c_zero x) -> (infix_lseqdt c_zero y) -> ((infix_asdt x x) = (infix_asdt y y)) -> (x = y). Axiom square_rt_c_one : ((square_rt c_one) = c_one). Axiom square_rt_mult : forall (t:complex) (t':complex), (real_ t) -> (infix_lseqdt c_zero t) -> (real_ t') -> (infix_lseqdt c_zero t') -> ((infix_asdt (square_rt t) (square_rt t')) = (square_rt (infix_asdt t t'))). Axiom square_rt_mult_rev : forall (t:complex) (t':complex), (real_ t) -> (infix_lseqdt c_zero t) -> (real_ t') -> (infix_lseqdt c_zero t') -> ((square_rt (infix_asdt t t')) = (infix_asdt (square_rt t) (square_rt t'))). Parameter modulus: complex -> complex. Axiom modulus_def : forall (x:complex), ((modulus x) = (square_rt (infix_pldt (infix_asdt (t_real_part x) (t_real_part x)) (infix_asdt (t_im_part x) (t_im_part x))))). Axiom modulus_spec : forall (x:complex), infix_lseqdt c_zero (modulus x). Parameter c_one_modulus: complex -> Prop. Axiom c_one_modulus_def : forall (x:complex), (c_one_modulus x) -> ((modulus x) = c_one). Axiom c_one_modulus_def1 : forall (x:complex), ((modulus x) = c_one) -> c_one_modulus x. Axiom modulus_eq : forall (x:complex) (y:complex), ((infix_asdt (t_real_part x) (t_real_part x)) = (infix_asdt (t_real_part y) (t_real_part y))) -> ((infix_asdt (t_im_part x) (t_im_part x)) = (infix_asdt (t_im_part y) (t_im_part y))) -> ((modulus x) = (modulus y)). Axiom modulus_minus : forall (x:complex), ((modulus (prefix_mndt x)) = (modulus x)). Axiom square_rt_simpl : forall (x:complex), (infix_lsdt c_zero x) -> ((infix_asdt x (infix_sldt c_one (square_rt x))) = (square_rt x)). Axiom square_rt_simpl_fact : forall (x:complex) (a:complex), (infix_lsdt c_zero x) -> ((infix_asdt (infix_asdt a (infix_sldt c_one (square_rt x))) x) = (infix_asdt a (square_rt x))). Axiom square_rt_simpl_mult : forall (x:complex) (a:complex), (infix_lsdt c_zero x) -> ((infix_asdt (infix_asdt (square_rt x) a) (infix_sldt c_one (square_rt x))) = a). Axiom square_rt_simpl_fact_assoc : forall (x:complex) (a:complex), (infix_lsdt c_zero x) -> ((infix_asdt x (infix_asdt a (infix_sldt c_one (square_rt x)))) = (infix_asdt a (square_rt x))). Axiom modulus_itself : forall (x:complex) (y:complex), (x = y) -> ((modulus x) = (modulus y)). Axiom modulus_real_pos : forall (x:complex), (real_ x) -> (infix_lseqdt c_zero x) -> ((modulus x) = x). Axiom modulus_real_pos_inv : forall (x:complex), (real_ x) -> (infix_lseqdt c_zero x) -> ((modulus (prefix_mndt x)) = x). Axiom modulus_real_neg : forall (x:complex), (real_ x) -> (infix_lseqdt x c_zero) -> ((modulus x) = (prefix_mndt x)). Axiom strict_positive_modulus : forall (x:complex), ~ (x = c_zero) -> infix_lsdt c_zero (modulus x). Axiom not_modulus_zero : forall (x:complex), ~ (x = c_zero) -> ~ ((modulus x) = c_zero). Axiom modulus_real : forall (x:complex), real_ (modulus x). Axiom t_mult_real_square : forall (a:complex) (b:complex), ((infix_asdt (t_real_part (infix_asdt a b)) (t_real_part (infix_asdt a b))) = (infix_mndt (infix_pldt (infix_asdt (infix_asdt (t_real_part a) (t_real_part a)) (infix_asdt (t_real_part b) (t_real_part b))) (infix_asdt (infix_asdt (t_im_part a) (t_im_part a)) (infix_asdt (t_im_part b) (t_im_part b)))) (infix_asdt ttwo (infix_asdt (infix_asdt (infix_asdt (t_real_part a) (t_real_part b)) (t_im_part a)) (t_im_part b))))). Axiom t_mult_im_square : forall (a:complex) (b:complex), ((infix_asdt (t_im_part (infix_asdt a b)) (t_im_part (infix_asdt a b))) = (infix_pldt (infix_pldt (infix_asdt (infix_asdt (t_real_part a) (t_real_part a)) (infix_asdt (t_im_part b) (t_im_part b))) (infix_asdt (infix_asdt (t_im_part a) (t_im_part a)) (infix_asdt (t_real_part b) (t_real_part b)))) (infix_asdt ttwo (infix_asdt (infix_asdt (infix_asdt (t_real_part a) (t_real_part b)) (t_im_part a)) (t_im_part b))))). Axiom mult_modulus_pre : forall (a:complex) (b:complex), ((infix_pldt (infix_asdt (t_real_part (infix_asdt a b)) (t_real_part (infix_asdt a b))) (infix_asdt (t_im_part (infix_asdt a b)) (t_im_part (infix_asdt a b)))) = (infix_asdt (infix_pldt (infix_asdt (t_real_part a) (t_real_part a)) (infix_asdt (t_im_part a) (t_im_part a))) (infix_pldt (infix_asdt (t_real_part b) (t_real_part b)) (infix_asdt (t_im_part b) (t_im_part b))))). Axiom mult_modulus : forall (x:complex) (y:complex), ((modulus (infix_asdt x y)) = (infix_asdt (modulus x) (modulus y))). Axiom mult_modulus_rev : forall (x:complex) (y:complex), ((infix_asdt (modulus x) (modulus y)) = (modulus (infix_asdt x y))). Axiom mult_real_modulus : forall (x:complex) (y:complex), (real_ x) -> (infix_lseqdt c_zero x) -> ((modulus (infix_asdt x y)) = (infix_asdt x (modulus y))). Axiom mult_modulus_real : forall (x:complex) (y:complex), (real_ y) -> (infix_lseqdt c_zero y) -> ((modulus (infix_asdt x y)) = (infix_asdt (modulus x) y)). Axiom mult_modulus_non_null : forall (x:complex) (y:complex), ~ (x = c_zero) -> ~ (y = c_zero) -> ~ ((modulus (infix_asdt x y)) = c_zero). Axiom modulus_to_non_null : forall (x:complex), (infix_lsdt c_zero (modulus x)) -> ~ (x = c_zero). Axiom mult_c_one_modulus : forall (x:complex) (y:complex), (c_one_modulus x) -> (c_one_modulus y) -> c_one_modulus (infix_asdt x y). Axiom modulus_pos : forall (x:complex), ~ (x = c_zero) -> infix_lseqdt c_zero (modulus x). Axiom modulus_infeq : forall (x:complex) (b:complex) (c:complex), (real_ x) -> (infix_lseqdt b c) -> (infix_lseqdt (modulus x) b) -> infix_lseqdt x c. Axiom modulus_inf : forall (x:complex) (b:complex) (c:complex), (real_ x) -> (infix_lsdt b c) -> (infix_lseqdt (modulus x) b) -> infix_lsdt x c. Axiom modulus_diff_rev : forall (a:complex) (b:complex), ((modulus (infix_mndt a b)) = (modulus (infix_mndt b a))). Axiom modulus_simpl_leq : forall (a:complex) (b:complex) (c:complex), (real_ a) -> (real_ b) -> (real_ c) -> (infix_lsdt c_zero c) -> (infix_lseqdt (modulus (infix_asdt a c)) (infix_asdt b c)) -> infix_lseqdt (modulus a) b. Axiom modulus_simpl_leq_rev : forall (a:complex) (b:complex) (c:complex), (real_ a) -> (real_ b) -> (real_ c) -> (infix_lseqdt c_zero c) -> (infix_lseqdt (modulus a) b) -> infix_lseqdt (modulus (infix_asdt a c)) (infix_asdt b c). Axiom div_eq : forall (a1:complex) (a2:complex) (b1:complex) (b2:complex), (a1 = a2) -> (b1 = b2) -> ~ (b1 = c_zero) -> ((infix_sldt a1 b1) = (infix_sldt a2 b2)). Axiom add_eq_inv_t : forall (a1:complex) (a2:complex) (b1:complex) (b2:complex), (a1 = a2) -> (b1 = b2) -> ((infix_pldt a1 b1) = (infix_pldt b2 a2)). Axiom mult_eq_inv_t : forall (a1:complex) (a2:complex) (b1:complex) (b2:complex), (a1 = a2) -> (b1 = b2) -> ((infix_asdt a1 b1) = (infix_asdt b2 a2)). Axiom sum_frac : forall (a1:complex) (a2:complex) (b:complex), ~ (b = c_zero) -> ((infix_pldt (infix_sldt a1 b) (infix_sldt a2 b)) = (infix_sldt (infix_pldt a1 a2) b)). Axiom sum_frac_rev : forall (a1:complex) (a2:complex) (b:complex), ~ (b = c_zero) -> ((infix_sldt (infix_pldt a1 a2) b) = (infix_pldt (infix_sldt a1 b) (infix_sldt a2 b))). Parameter p_id: forall {a:Type} {a_WT:WhyType a}, a -> a. Axiom p_id_def : forall {a:Type} {a_WT:WhyType a}, forall (a1:a), ((p_id a1) = a1). Parameter const: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, a -> b -> a. Axiom const_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (b1:b), ((const a1 b1) = a1). Parameter constant_f: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> Prop. Axiom constant_f_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b), (constant_f f) -> exists a1:b, (f = ((fun (y0:b) (y1:a) => (const y0 y1)) a1)). Axiom constant_f_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b), (exists a1:b, (f = ((fun (y0:b) (y1:a) => (const y0 y1)) a1))) -> constant_f f. Parameter op: forall {im1:Type} {im1_WT:WhyType im1}, im1 -> im1 -> im1. Parameter po: forall {im1:Type} {im1_WT:WhyType im1}, im1 -> im1 -> im1. Parameter inver: forall {im1:Type} {im1_WT:WhyType im1}, im1 -> im1. Parameter filter: forall {a:Type} {a_WT:WhyType a}, (a -> bool) -> (set a) -> set a. Axiom filter_def : forall {a:Type} {a_WT:WhyType a}, forall (p:a -> bool) (u:set a), forall (x:a), (mem x (filter p u)) -> ((p x) = true). Axiom filter_def1 : forall {a:Type} {a_WT:WhyType a}, forall (p:a -> bool) (u:set a), forall (x:a), (mem x (filter p u)) -> mem x u. Axiom filter_def2 : forall {a:Type} {a_WT:WhyType a}, forall (p:a -> bool) (u:set a), forall (x:a), (((p x) = true) /\ (mem x u)) -> mem x (filter p u). Axiom filter_cardinal : forall {a:Type} {a_WT:WhyType a}, forall (p:a -> bool) (u:set a), ((cardinal (filter p u)) <= (cardinal u))%Z. Parameter map: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (set a) -> set b. Axiom map_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (u:set a), forall (y:b), (mem y (map f u)) -> exists x:a, (mem x u) /\ (y = (f x)). Axiom map_def11 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (u:set a), forall (y:b), (exists x:a, (mem x u) /\ (y = (f x))) -> mem y (map f u). Axiom map_def2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (u:set a), forall (x:a), (mem x u) -> mem (f x) (map f u). Axiom map_cardinal : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (u:set a), ((cardinal (map f u)) <= (cardinal u))%Z. Parameter fir: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a* b)%type -> a. Parameter sec: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a* b)%type -> b. Axiom projections : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (o:(a* b)%type), (o = (fir o, sec o)). Axiom get_fir : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (b1:b), ((fir (a1, b1)) = a1). Axiom get_sec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (b1:b), ((sec (a1, b1)) = b1). (* Why3 assumption *) Inductive ref (a:Type) := | mk_ref : a -> ref a. Axiom ref_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (ref a). Existing Instance ref_WhyType. Arguments mk_ref {a}. (* Why3 assumption *) Definition contents {a:Type} {a_WT:WhyType a} (v:ref a) : a := match v with | mk_ref x => x end. Parameter prefix_ex: forall {a:Type} {a_WT:WhyType a}, (ref a) -> a. Axiom prefix_ex_def : forall {a:Type} {a_WT:WhyType a}, forall (r:ref a), ((prefix_ex r) = (contents r)). Parameter eq_e: forall {a:Type} {a_WT:WhyType a}, a -> a -> Prop. Axiom eq_e_def : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (a':a), (eq_e a1 a') -> (a1 = a'). Axiom eq_e_def1 : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (a':a), (a1 = a') -> eq_e a1 a'. Axiom set_equal : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (forall (e:a), (mem e s) -> mem e s') -> (forall (e:a), (mem e s') -> mem e s) -> (s = s'). Axiom set_equal_eqq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (forall (e:a), (mem e s) -> mem e s') -> (forall (e:a), (mem e s') -> mem e s) -> infix_eqeq s s'. Axiom union_exchange : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), ~ (is_empty s') -> ((union (add (choose s') s) (remove (choose s') s')) = (union s s')). Axiom get_filter : forall {a:Type} {a_WT:WhyType a}, forall (p:a -> bool) (s:set a) (x:a), (mem x (filter p s)) -> ((p x) = true). Axiom get_filter1 : forall {a:Type} {a_WT:WhyType a}, forall (p:a -> bool) (s:set a) (x:a), (mem x (filter p s)) -> mem x s. Axiom set_filter : forall {a:Type} {a_WT:WhyType a}, forall (p:a -> bool) (s:set a) (x:a), ((p x) = true) -> (mem x s) -> mem x (filter p s). Axiom inter_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (is_empty s) -> is_empty (inter s s'). Axiom inter_empty_comm : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (is_empty s') -> is_empty (inter s s'). Axiom inter_empty_elts : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (forall (e:a), (mem e s) -> ~ (mem e s')) -> is_empty (inter s s'). Axiom inter_sym : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), ((inter s s') = (inter s' s)). Axiom union_sym : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), ((union s s') = (union s' s)). Axiom union_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (is_empty s) -> ((union s s') = s'). Axiom union_comm : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (is_empty s') -> ((union s s') = s). Axiom union_members : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), forall (a1:a), (mem a1 (union s s')) -> ~ (mem a1 s) -> mem a1 s'. Axiom union_members1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), forall (a1:a), (mem a1 (union s s')) -> ~ (mem a1 s') -> mem a1 s. Axiom union_alt : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (e:a), (mem e (union s s')) -> ~ (mem e s) -> mem e s'. Axiom union_empty_comm : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (is_empty s') -> ((union s s') = s). Axiom set_subset : forall {a:Type} {a_WT:WhyType a}, forall (s':set a) (s:set a), (forall (e:a), (mem e s') -> mem e s) -> subset s' s. Axiom set_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), (forall (e:a), ~ (mem e s)) -> (s = (empty : set a)). Axiom set_empty1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), (forall (e:a), ~ (mem e s)) -> is_empty s. Axiom get_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), (s = (empty : set a)) -> forall (e:a), ~ (mem e s). Axiom get_empty1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), (s = (empty : set a)) -> is_empty s. Axiom get_non_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), ~ (is_empty s) -> exists e:a, mem e s. Axiom set_non_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), (exists e:a, mem e s) -> ~ (is_empty s). Axiom set_non_empty1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), (exists e:a, mem e s) -> ((cardinal s) > 0%Z)%Z. Axiom set_pos_card_elt : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (a1:a), (mem a1 s) -> ((cardinal s) > 0%Z)%Z. Axiom union_add : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (x:a), ~ (mem x s') -> ((union s (add x s')) = (add x (union s s'))). Axiom union_add_mem : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (x:a) (y:a), (mem x (add y (union s s'))) -> ~ (mem x s') -> ~ (mem x s) -> (x = y). Axiom union_add_comm : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (x:a), ~ (mem x s') -> ((add x (union s s')) = (union s (add x s'))). Axiom remove_add1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (x:a), ~ (mem x s) -> ((remove x (add x s)) = s). Axiom add_remove1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (x:a), (mem x s) -> ((add x (remove x s)) = s). Parameter p_injective: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (set a) -> Prop. Axiom p_injective_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), (p_injective f s) -> forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') -> ~ ((f e) = (f e')). Axiom p_injective_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), (forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') -> ~ ((f e) = (f e'))) -> p_injective f s. Axiom set_map_mem : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (b1:b), (exists a1:a, (mem a1 s) /\ (b1 = (f a1))) -> mem b1 (map f s). Axiom map_add : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (x:a), ~ (mem x s) -> ((map f (add x s)) = (add (f x) (map f s))). Axiom map_eq : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:a -> b) (s:set a), (forall (e:a), (mem e s) -> ((f e) = (g e))) -> ((map f s) = (map g s)). Axiom remove_mem : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (e:a) (f:a), (mem e (remove f s)) -> mem e s. Axiom injective_map_cardinal : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), (p_injective f s) -> ((cardinal (map f s)) = (cardinal s)). Axiom set_map_mem_el : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (b1:b) (a1:a), (mem a1 s) -> (b1 = (f a1)) -> mem b1 (map f s). Axiom set_map_mem_el_gen : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (b1:b), (exists a1:a, (mem a1 s) /\ (b1 = (f a1))) -> mem b1 (map f s). Axiom map_antec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (b1:b), (mem b1 (map f s)) -> exists a1:a, (mem a1 s) /\ (b1 = (f a1)). Axiom map_antec_gen : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), forall (b1:b), (mem b1 (map f s)) -> exists a1:a, (mem a1 s) /\ (b1 = (f a1)). Axiom map_remove_choose : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (f:a -> b), (p_injective f s) -> ((map f (remove (choose s) s)) = (remove (f (choose s)) (map f s))). Parameter antec_set: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (set a) -> (a -> b) -> b -> set a. Parameter result: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> b -> a -> bool. Axiom result_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (b1:b) (e:a), (((result f b1) e) = true) <-> (eq_e (f e) b1). Axiom antec_set_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) -> ((antec_set s f b1) = (filter (result f b1) s)). Parameter remove_s: forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> set a. Parameter result1: forall {a:Type} {a_WT:WhyType a}, (set a) -> a -> bool. Axiom result_def1 : forall {a:Type} {a_WT:WhyType a}, forall (s':set a) (e:a), (((result1 s') e) = true) <-> ~ (mem e s'). Axiom remove_s_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (subset s' s) -> ((remove_s s s') = (filter (result1 s') s)). Axiom remove_s_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (subset s' s) -> forall (e:a), (mem e (remove_s s s')) -> mem e s. Axiom remove_s_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (subset s' s) -> forall (e:a), (mem e (remove_s s s')) -> ~ (mem e s'). Axiom remove_s_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (subset s' s) -> forall (e:a), ((mem e s) /\ ~ (mem e s')) -> mem e (remove_s s s'). Parameter remove_antecs: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (set a) -> (a -> b) -> b -> set a. Axiom remove_antecs_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) -> ((remove_antecs s f b1) = (remove_s s (antec_set s f b1))). Axiom remove_antecs_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) -> forall (e:a), (mem e (remove_antecs s f b1)) -> mem e s. Axiom remove_antecs_spec1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) -> forall (e:a), (mem e (remove_antecs s f b1)) -> ~ ((f e) = b1). Axiom remove_antecs_spec2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) -> forall (e:a), ((mem e s) /\ ~ ((f e) = b1)) -> mem e (remove_antecs s f b1). Axiom remove_antecs_spec3 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) -> ((cardinal (remove_antecs s f b1)) < (cardinal s))%Z. Axiom map_remove_antec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) -> ((map f (remove_antecs s f b1)) = (remove b1 (map f s))). Axiom map_non_empty : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), ((cardinal s) > 0%Z)%Z -> ((cardinal (map f s)) > 0%Z)%Z. Axiom non_empty_map : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), ((cardinal (map f s)) > 0%Z)%Z -> ((cardinal s) > 0%Z)%Z. Parameter right_injections: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, a -> (set b) -> set (a* b)%type. Axiom right_injections_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), (is_empty s) -> ((right_injections a1 s) = (empty : set (a* b)%type)). Axiom right_injections_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), ~ (is_empty s) -> ((right_injections a1 s) = (add (a1, choose s) (right_injections a1 (remove (choose s) s)))). Axiom right_injections_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), ((cardinal (right_injections a1 s)) = (cardinal s)). Axiom right_injections_spec1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), forall (a':a), forall (b1:b), (mem (a', b1) (right_injections a1 s)) -> (a' = a1). Axiom right_injections_spec2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), forall (a':a), forall (b1:b), (mem (a', b1) (right_injections a1 s)) -> mem b1 s. Axiom right_injections_spec3 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), forall (a':a), forall (b1:b), ((a' = a1) /\ (mem b1 s)) -> mem (a', b1) (right_injections a1 s). Axiom right_injections_spec4 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), ((right_injections a1 s) = (map (fun (b1:b) => (a1, b1)) s)). Parameter left_injections: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (set a) -> b -> set (a* b)%type. Axiom left_injections_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), (is_empty s) -> ((left_injections s b1) = (empty : set (a* b)%type)). Axiom left_injections_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), ~ (is_empty s) -> ((left_injections s b1) = (add (choose s, b1) (left_injections (remove (choose s) s) b1))). Axiom left_injections_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), forall (a1:a), forall (b':b), (mem (a1, b') (left_injections s b1)) -> mem a1 s. Axiom left_injections_spec1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), forall (a1:a), forall (b':b), (mem (a1, b') (left_injections s b1)) -> (b' = b1). Axiom left_injections_spec2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), forall (a1:a), forall (b':b), ((mem a1 s) /\ (b' = b1)) -> mem (a1, b') (left_injections s b1). Axiom left_injections_spec3 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), ((cardinal (left_injections s b1)) = (cardinal s)). Axiom left_injections_spec4 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), ((left_injections s b1) = (map (fun (a1:a) => (a1, b1)) s)). Axiom set_map_eq : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (forall (b1:b), (mem b1 s') -> exists a1:a, (mem a1 s) /\ ((f a1) = b1)) -> (forall (a1:a), (mem a1 s) -> mem (f a1) s') -> ((map f s) = s'). Axiom right_injections_l : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), ((cardinal (right_injections a1 s)) = (cardinal s)). Axiom right_injections_l1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), forall (a':a), forall (b1:b), (mem (a', b1) (right_injections a1 s)) -> (a' = a1). Axiom right_injections_l2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), forall (a':a), forall (b1:b), (mem (a', b1) (right_injections a1 s)) -> mem b1 s. Axiom right_injections_l3 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), forall (a':a), forall (b1:b), ((a' = a1) /\ (mem b1 s)) -> mem (a', b1) (right_injections a1 s). Axiom right_injections_l4 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (s:set b), ((right_injections a1 s) = (map (fun (b1:b) => (a1, b1)) s)). Axiom left_injections_l : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), forall (a1:a), forall (b':b), (mem (a1, b') (left_injections s b1)) -> mem a1 s. Axiom left_injections_l1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), forall (a1:a), forall (b':b), (mem (a1, b') (left_injections s b1)) -> (b' = b1). Axiom left_injections_l2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), forall (a1:a), forall (b':b), ((mem a1 s) /\ (b' = b1)) -> mem (a1, b') (left_injections s b1). Axiom left_injections_l3 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), ((cardinal (left_injections s b1)) = (cardinal s)). Axiom left_injections_l4 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b), ((left_injections s b1) = (map (fun (a1:a) => (a1, b1)) s)). Axiom disjoint_injections : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b) (c:b), ~ (b1 = c) -> is_empty (inter (right_injections b1 s) (right_injections c s)). Axiom disjoint_injections1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (b1:b) (c:b), ~ (b1 = c) -> is_empty (inter (left_injections s b1) (left_injections s c)). Axiom induction : forall {a:Type} {a_WT:WhyType a}, forall (p:(set a) -> bool) (t:set a), (forall (s:set a), (is_empty s) -> ((p s) = true)) -> (forall (s:set a), ((p s) = true) -> forall (t1:a), ~ (mem t1 s) -> ((p (add t1 s)) = true)) -> ((p t) = true). Axiom cardinal_sum : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), ((cardinal (union s s')) = (((cardinal s) + (cardinal s'))%Z - (cardinal (inter s s')))%Z). Axiom cardinal_eq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), (forall (e:a), (mem e s) -> mem e s') -> (forall (e:a), (mem e s') -> mem e s) -> ((cardinal s) = (cardinal s')). Axiom cardinal_sum_empty_inter : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a), ((inter s s') = (empty : set a)) -> ((cardinal (union s s')) = ((cardinal s) + (cardinal s'))%Z). Parameter cartesian_product: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (set a) -> (set b) -> set (a* b)%type. Axiom cartesian_product_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), ((cardinal (cartesian_product s1 s2)) = ((cardinal s1) * (cardinal s2))%Z). Axiom cartesian_product_spec1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (a1:a), forall (b1:b), (mem (a1, b1) (cartesian_product s1 s2)) -> mem a1 s1. Axiom cartesian_product_spec2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (a1:a), forall (b1:b), (mem (a1, b1) (cartesian_product s1 s2)) -> mem b1 s2. Axiom cartesian_product_spec3 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (a1:a), forall (b1:b), ((mem a1 s1) /\ (mem b1 s2)) -> mem (a1, b1) (cartesian_product s1 s2). Axiom cartesian_product_spec4 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (o:(a* b)%type), (mem o (cartesian_product s1 s2)) -> mem (fir o) s1. Axiom cartesian_product_spec5 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (o:(a* b)%type), (mem o (cartesian_product s1 s2)) -> mem (sec o) s2. Axiom cartesian_product_spec6 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (o:(a* b)%type), ((mem (fir o) s1) /\ (mem (sec o) s2)) -> mem o (cartesian_product s1 s2). Parameter commute: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a* b)%type -> (b* a)%type. Axiom commute_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (o:(a* b)%type), forall (x:a) (x1:b), (o = (x, x1)) -> ((commute o) = (x1, x)). Axiom commute_inj : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (a':a) (b1:b) (b':b), ~ (a1 = a') -> ~ ((commute (a1, b1)) = (commute (a', b'))). Axiom commute_inj1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (a':a) (b1:b) (b':b), ~ (b1 = b') -> ~ ((commute (a1, b1)) = (commute (a', b'))). Axiom mem_cartesian_product : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b) (a1:a) (b1:b), (mem a1 s1) -> (mem b1 s2) -> mem (a1, b1) (cartesian_product s1 s2). Axiom commute_inj_gen : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), p_injective (fun (y0:(a* b)%type) => (commute y0)) (cartesian_product s1 s2). Parameter commute_product: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (set a) -> (set b) -> set (b* a)%type. Axiom commute_product_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), ((commute_product s1 s2) = (map (fun (y0:(a* b)%type) => (commute y0)) (cartesian_product s1 s2))). Axiom commute_product_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), ((commute_product s1 s2) = (cartesian_product s2 s1)). Parameter commute_product_el: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (set a) -> (set b) -> set (b* a)%type. Axiom commute_product_el_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), ((commute_product_el s1 s2) = (map (fun (y0:(a* b)%type) => (commute y0)) (cartesian_product s1 s2))). Axiom commute_product_el_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b), (o = (x, x1)) -> (mem o (cartesian_product s1 s2)) -> mem x s1. Axiom commute_product_el_spec1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b), (o = (x, x1)) -> (mem o (cartesian_product s1 s2)) -> mem x1 s2. Axiom commute_product_el_spec2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b), (o = (x, x1)) -> ((mem x s1) /\ (mem x1 s2)) -> mem o (cartesian_product s1 s2). Axiom commute_product_el_spec3 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b), (o = (x, x1)) -> ((mem x s1) /\ (mem x1 s2)) -> mem (x1, x) (commute_product_el s1 s2). Axiom commute_product_el_spec4 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b), (o = (x, x1)) -> (mem (x1, x) (commute_product_el s1 s2)) -> mem x s1. Axiom commute_product_el_spec5 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b), (o = (x, x1)) -> (mem (x1, x) (commute_product_el s1 s2)) -> mem x1 s2. Axiom cartesian_product_union : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b) (s3:set b), ((cartesian_product s1 (union s2 s3)) = (union (cartesian_product s1 s2) (cartesian_product s1 s3))). Axiom cartesian_union_product : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set a) (s3:set b), ((cartesian_product (union s1 s2) s3) = (union (cartesian_product s1 s3) (cartesian_product s2 s3))). Axiom cartesian_product_cardone_r : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), ((cardinal s1) = 1%Z) -> infix_eqeq (cartesian_product s1 s2) (right_injections (choose s1) s2). Axiom cartesian_product_cardone_r1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), ((cardinal s1) = 1%Z) -> infix_eqeq (cartesian_product s1 s2) (map (fun (e2:b) => (choose s1, e2)) s2). Axiom cartesian_product_cardone_l : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), ((cardinal s2) = 1%Z) -> infix_eqeq (cartesian_product s1 s2) (left_injections s1 (choose s2)). Axiom cartesian_product_cardone_l1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b), ((cardinal s2) = 1%Z) -> infix_eqeq (cartesian_product s1 s2) (map (fun (e1:a) => (e1, choose s2)) s1). Axiom disjoint_cartesian_product_l : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set a) (s3:set b), ((inter s1 s2) = (empty : set a)) -> ((inter (cartesian_product s1 s3) (cartesian_product s2 s3)) = (empty : set (a* b)%type)). Axiom disjoint_cartesian_product_r : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b) (s3:set b), ((inter s2 s3) = (empty : set b)) -> ((inter (cartesian_product s1 s2) (cartesian_product s1 s3)) = (empty : set (a* b)%type)). Parameter iter_union: forall {a:Type} {a_WT:WhyType a}, (set (set a)) -> set a. Axiom iter_union_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set (set a)), (is_empty s) -> ((iter_union s) = (empty : set a)). Axiom iter_union_def1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set (set a)), ~ (is_empty s) -> ((iter_union s) = (union (choose s) (iter_union (remove (choose s) s)))). Axiom get_mem_union : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (e:a), (mem e (union s s')) -> ~ (mem e s') -> mem e s. Axiom get_mem_union' : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (e:a), (mem e (union s s')) -> ~ (mem e s) -> mem e s'. Axiom set_mem_union : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (e:a), (mem e s) -> mem e (union s s'). Axiom set_mem_union' : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (e:a), (mem e s') -> mem e (union s s'). Parameter op_neutral_left: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> im1 -> Prop. Axiom op_neutral_left_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral:im1), (op_neutral_left op1 neutral) -> forall (e:im1), (((op1 neutral) e) = e). Axiom op_neutral_left_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral:im1), (forall (e:im1), (((op1 neutral) e) = e)) -> op_neutral_left op1 neutral. Parameter op_neutral_right: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> im1 -> Prop. Axiom op_neutral_right_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral:im1), (op_neutral_right op1 neutral) -> forall (e:im1), (((op1 e) neutral) = e). Axiom op_neutral_right_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral:im1), (forall (e:im1), (((op1 e) neutral) = e)) -> op_neutral_right op1 neutral. Parameter op_assoc: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> Prop. Axiom op_assoc_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), (op_assoc op1) -> forall (a:im1) (b:im1) (c:im1), (((op1 ((op1 a) b)) c) = ((op1 a) ((op1 b) c))). Axiom op_assoc_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), (forall (a:im1) (b:im1) (c:im1), (((op1 ((op1 a) b)) c) = ((op1 a) ((op1 b) c)))) -> op_assoc op1. Parameter op_neutral_left_comm: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> im1 -> Prop. Axiom op_neutral_left_comm_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral:im1), (op_neutral_left_comm op1 neutral) -> forall (a:im1), (forall (b:im1), (((op1 a) b) = b)) -> (a = neutral). Axiom op_neutral_left_comm_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral:im1), (forall (a:im1), (forall (b:im1), (((op1 a) b) = b)) -> (a = neutral)) -> op_neutral_left_comm op1 neutral. Parameter commut: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> Prop. Axiom commut_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), (commut op1) -> forall (a:im1) (b:im1), (((op1 a) b) = ((op1 b) a)). Axiom commut_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), (forall (a:im1) (b:im1), (((op1 a) b) = ((op1 b) a))) -> commut op1. Parameter assoc: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> Prop. Axiom assoc_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), (assoc op1) -> forall (a:im1) (b:im1) (c:im1), (((op1 ((op1 a) b)) c) = ((op1 a) ((op1 b) c))). Axiom assoc_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), (forall (a:im1) (b:im1) (c:im1), (((op1 ((op1 a) b)) c) = ((op1 a) ((op1 b) c)))) -> assoc op1. Parameter opposite_n: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (im1 -> im1 -> im1) -> im1 -> Prop. Axiom opposite_n_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (neutral:im1), (opposite_n op1 po1 neutral) -> forall (a:im1), (((po1 a) a) = neutral). Axiom opposite_n_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (neutral:im1), (forall (a:im1), (((po1 a) a) = neutral)) -> opposite_n op1 po1 neutral. Parameter inverse: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (im1 -> im1 -> im1) -> (im1 -> im1) -> Prop. Axiom inverse_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (inver1:im1 -> im1), (inverse op1 po1 inver1) -> forall (a:im1) (b:im1), (((po1 a) b) = ((op1 a) (inver1 b))). Axiom inverse_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (inver1:im1 -> im1), (forall (a:im1) (b:im1), (((po1 a) b) = ((op1 a) (inver1 b)))) -> inverse op1 po1 inver1. Parameter opposite1: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (im1 -> im1 -> im1) -> Prop. Axiom opposite_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1), (opposite1 op1 po1) -> forall (a:im1) (b:im1), (((op1 ((po1 a) b)) b) = a). Axiom opposite_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1), (forall (a:im1) (b:im1), (((op1 ((po1 a) b)) b) = a)) -> opposite1 op1 po1. Parameter opposite_com: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (im1 -> im1 -> im1) -> Prop. Axiom opposite_com_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1), (opposite_com op1 po1) -> forall (a:im1) (b:im1), (((po1 ((op1 a) b)) b) = a). Axiom opposite_com_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1), (forall (a:im1) (b:im1), (((po1 ((op1 a) b)) b) = a)) -> opposite_com op1 po1. Axiom refl : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (a:im1) (b:im1), (commut op1) -> (((op1 a) b) = ((op1 b) a)). Parameter neutral: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> im1 -> Prop. Axiom neutral_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neut:im1), (neutral op1 neut) -> op_neutral_left op1 neut. Axiom neutral_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neut:im1), (neutral op1 neut) -> op_neutral_right op1 neut. Axiom neutral_def2 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neut:im1), (neutral op1 neut) -> op_assoc op1. Axiom neutral_def3 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neut:im1), ((op_neutral_left op1 neut) /\ ((op_neutral_right op1 neut) /\ (op_assoc op1))) -> neutral op1 neut. Axiom set_neutral : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neut:im1), (op_neutral_left op1 neut) -> (op_neutral_right op1 neut) -> (op_assoc op1) -> neutral op1 neut. Parameter has_neutral: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> Prop. Axiom has_neutral_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), (has_neutral op1) -> exists e:im1, neutral op1 e. Axiom has_neutral_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), (exists e:im1, neutral op1 e) -> has_neutral op1. Parameter iterates: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> im1 -> Prop. Axiom iterates_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral1:im1), (iterates op1 neutral1) -> op_neutral_left op1 neutral1. Axiom iterates_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral1:im1), (iterates op1 neutral1) -> op_neutral_right op1 neutral1. Axiom iterates_def2 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral1:im1), (iterates op1 neutral1) -> op_assoc op1. Axiom iterates_def3 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral1:im1), ((op_neutral_left op1 neutral1) /\ ((op_neutral_right op1 neutral1) /\ (op_assoc op1))) -> iterates op1 neutral1. Parameter iterable: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> Prop. Axiom iterable_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), (iterable op1) -> exists e:im1, iterates op1 e. Axiom iterable_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), (exists e:im1, iterates op1 e) -> iterable op1. Axiom iterates_ : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral1:im1), (op_neutral_left op1 neutral1) -> (op_neutral_right op1 neutral1) -> (op_assoc op1) -> iterates op1 neutral1. Axiom iterates_1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (neutral1:im1), (op_neutral_left op1 neutral1) -> (op_neutral_right op1 neutral1) -> (op_assoc op1) -> iterable op1. Parameter neutral_elt: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> im1. Axiom neutral_elt_spec : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), forall (e:im1), (neutral op1 e) -> ((neutral_elt op1) = e). Axiom neutral_elt_spec1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), forall (e:im1), ((neutral_elt op1) = e) -> neutral op1 e. Parameter inverse_tuple: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (im1 -> im1 -> im1) -> im1 -> Prop. Axiom inverse_tuple_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (neutral1:im1), (inverse_tuple op1 po1 neutral1) -> opposite_n op1 po1 neutral1. Axiom inverse_tuple_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (neutral1:im1), (inverse_tuple op1 po1 neutral1) -> opposite1 op1 po1. Axiom inverse_tuple_def2 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (neutral1:im1), (inverse_tuple op1 po1 neutral1) -> opposite_com op1 po1. Axiom inverse_tuple_def3 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (neutral1:im1), ((opposite_n op1 po1 neutral1) /\ ((opposite1 op1 po1) /\ (opposite_com op1 po1))) -> inverse_tuple op1 po1 neutral1. Parameter iterate: forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (set a) -> (a -> im1) -> im1. Axiom Iterate_def_empty : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), forall (s:set a), forall (f:a -> im1), (commut op1) -> (iterable op1) -> (is_empty s) -> ((iterate op1 (empty : set a) f) = (neutral_elt op1)). Axiom Iterate_one : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), forall (s:set a), forall (f:a -> im1), forall (x:a), (is_empty s) -> (commut op1) -> ((iterate op1 (add x s) f) = (f x)). Axiom Iterate_add : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1), forall (s:set a), forall (f:a -> im1), forall (x:a), ((cardinal s) > 0%Z)%Z -> (commut op1) -> ~ (mem x s) -> ((iterate op1 (add x s) f) = ((op1 (f x)) (iterate op1 s f))). Axiom minus_zero : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1), (iterable op1) -> (inverse_tuple op1 po1 (neutral_elt op1)) -> (((po1 a) (neutral_elt op1)) = a). Axiom unic : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1) (b:im1) (c:im1), (iterable op1) -> (commut op1) -> (((op1 a) b) = ((op1 a) c)) -> (inverse_tuple op1 po1 (neutral_elt op1)) -> (b = c). Axiom substract_comm : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1) (b:im1), (iterable op1) -> (commut op1) -> (inverse_tuple op1 po1 (neutral_elt op1)) -> (((po1 ((op1 a) b)) a) = b). Axiom substract_comm1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1) (b:im1), (iterable op1) -> (commut op1) -> (inverse_tuple op1 po1 (neutral_elt op1)) -> (((po1 ((op1 b) a)) a) = b). Axiom substract_comm2 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1) (b:im1) (c:im1), (iterable op1) -> (commut op1) -> (inverse_tuple op1 po1 (neutral_elt op1)) -> (((po1 a) ((po1 b) c)) = ((op1 ((po1 a) b)) c)). Axiom substract_comm3 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1) (b:im1) (c:im1), (iterable op1) -> (commut op1) -> (inverse_tuple op1 po1 (neutral_elt op1)) -> (((po1 ((op1 a) b)) c) = ((op1 a) ((po1 b) c))). Parameter int_iterate: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (Z -> im1) -> Z -> Z -> im1. Axiom int_iterate_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z -> (j <= i)%Z -> ((int_iterate op1 f i j) = (neutral_elt op1)). Axiom int_iterate_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z -> ~ (j <= i)%Z -> (j = (i + 1%Z)%Z) -> ((int_iterate op1 f i j) = (f i)). Axiom int_iterate_def2 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z -> ~ (j <= i)%Z -> ~ (j = (i + 1%Z)%Z) -> ((int_iterate op1 f i j) = ((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j))). Axiom int_iterate_def3 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) -> (j <= i)%Z -> ((int_iterate op1 f i j) = (neutral_elt op1)). Axiom int_iterate_def4 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) -> ~ (j <= i)%Z -> (j = (i + 1%Z)%Z) -> ((int_iterate op1 f i j) = (f i)). Axiom int_iterate_def5 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) -> ~ (j <= i)%Z -> ~ (j = (i + 1%Z)%Z) -> ((int_iterate op1 f i j) = ((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j))). Axiom int_iterate_spec : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z -> (j <= i)%Z -> ((int_iterate op1 f i j) = (neutral_elt op1)). Axiom int_iterate_spec1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z -> (j = (i + 1%Z)%Z) -> ((int_iterate op1 f i j) = ((op1 (f i)) (neutral_elt op1))). Axiom int_iterate_spec2 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) -> (j <= i)%Z -> ((int_iterate op1 f i j) = (neutral_elt op1)). Axiom int_iterate_spec3 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) -> (j = (i + 1%Z)%Z) -> ((int_iterate op1 f i j) = ((op1 (f i)) (neutral_elt op1))). Parameter int_int_iterate: forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (Z -> Z -> im1) -> Z -> Z -> Z -> Z -> im1. Axiom int_int_iterate_def : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z), (iterable op1) -> (j <= i)%Z -> ((int_int_iterate op1 f i j k l) = (neutral_elt op1)). Axiom int_int_iterate_def1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z), (iterable op1) -> ~ (j <= i)%Z -> ((int_int_iterate op1 f i j k l) = ((op1 (int_iterate op1 (f i) k l)) (int_int_iterate op1 f (i + 1%Z)%Z j k l))). Parameter to_set: forall {a:Type} {a_WT:WhyType a}, a -> set a. Axiom to_set_def : forall {a:Type} {a_WT:WhyType a}, forall (e:a), ((to_set e) = (add e (empty : set a))). Axiom to_set_spec : forall {a:Type} {a_WT:WhyType a}, forall (e:a), forall (b:a), (b = e) -> mem b (to_set e). Axiom to_set_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (e:a), ((cardinal (to_set e)) = 1%Z). Axiom to_set_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (e:a), forall (b:a), (mem b (to_set e)) -> (b = e). Parameter to_fset: Z -> Z -> set Z. Axiom to_fset_spec : forall (i:Z) (j:Z), (i < j)%Z -> ((cardinal (to_fset i j)) = (j - i)%Z). Axiom to_fset_spec1 : forall (i:Z) (j:Z), (j <= i)%Z -> is_empty (to_fset i j). Axiom to_fset_spec2 : forall (i:Z) (j:Z), forall (k:Z), (mem k (to_fset i j)) -> (i <= k)%Z. Axiom to_fset_spec3 : forall (i:Z) (j:Z), forall (k:Z), (mem k (to_fset i j)) -> (k < j)%Z. Axiom to_fset_spec4 : forall (i:Z) (j:Z), forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> mem k (to_fset i j). Axiom to_fset_bounds : forall (i:Z) (k:Z) (j:Z), (i < j)%Z -> (mem k (to_fset i j)) -> (i <= k)%Z. Axiom to_fset_bounds1 : forall (i:Z) (k:Z) (j:Z), (i < j)%Z -> (mem k (to_fset i j)) -> (k < j)%Z. Axiom to_fset_unit_ext : forall (i:Z) (j:Z), (i < j)%Z -> ((to_fset i j) = (add i (to_fset (i + 1%Z)%Z j))). Axiom to_fset_ext : forall (i:Z) (i':Z) (j:Z), ((i <= i')%Z /\ (i' <= j)%Z) -> ((to_fset i j) = (union (to_fset i i') (to_fset i' j))). Axiom card_fset : forall (n:Z), (0%Z <= n)%Z -> ((cardinal (to_fset 0%Z n)) = n). Axiom set_mem_to_fset : forall (i:Z) (k:Z) (j:Z), ((i <= k)%Z /\ (k < j)%Z) -> mem k (to_fset i j). Parameter element: forall {a:Type} {a_WT:WhyType a}, (set a) -> a. Axiom element_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), ((cardinal s) = 1%Z) -> ((element s) = (choose s)). Axiom cardone : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (a1:a), (forall (b:a), (mem b s) <-> (b = a1)) -> ((cardinal s) > 0%Z)%Z -> ((cardinal s) = 1%Z). Axiom cardone1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (a1:a), (forall (b:a), (mem b s) <-> (b = a1)) -> ((cardinal s) > 0%Z)%Z -> ((element s) = a1). Axiom set_cardone : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), ((cardinal s) > 0%Z)%Z -> (exists a1:a, forall (b:a), (mem b s) <-> (b = a1)) -> ((cardinal s) = 1%Z). Axiom get_cardone : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), ((cardinal s) = 1%Z) -> exists a1:a, forall (b:a), (mem b s) <-> (b = a1). Axiom get_cardone_elt : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (e:a), ((cardinal s) = 1%Z) -> (mem e s) -> (e = (element s)). Axiom set_cardone_elt : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (a1:a), (forall (b:a), (mem b s) <-> (b = a1)) -> ((cardinal s) = 1%Z). Axiom set_cardone_elt1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (a1:a), (forall (b:a), (mem b s) <-> (b = a1)) -> ((element s) = a1). Axiom set_cardone_elt_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (a1:a), (forall (b:a), (mem b s) <-> (b = a1)) -> ((cardinal s) = 1%Z). Axiom cardzero : forall {a:Type} {a_WT:WhyType a}, forall (s:set a), (forall (b:a), ~ (mem b s)) -> ((cardinal s) = 0%Z). Axiom get_choose_cardone : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (e:a), ((cardinal s) = 1%Z) -> (mem e s) -> ((choose s) = e). Parameter p_injective_in: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (set a) -> (set b) -> Prop. Axiom p_injective_in_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_injective_in f s s') -> forall (e:a), (mem e s) -> mem (f e) s'. Axiom p_injective_in_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_injective_in f s s') -> forall (e:a), (mem e s) -> forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ~ (e1 = e') -> ~ ((f e1) = (f e')). Axiom p_injective_in_def2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (forall (e:a), (mem e s) -> (mem (f e) s') /\ forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ~ (e1 = e') -> ~ ((f e1) = (f e'))) -> p_injective_in f s s'. Parameter equal_func: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (a -> b) -> Prop. Axiom equal_func_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:a -> b), (equal_func f g) -> forall (e:a), ((f e) = (g e)). Axiom equal_func_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:a -> b), (forall (e:a), ((f e) = (g e))) -> equal_func f g. Axiom set_equal_func : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:a -> b), (forall (e:a), ((f e) = (g e))) -> (f = g). Axiom get_equal_func : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:a -> b), (equal_func f g) -> forall (e:a), ((f e) = (g e)). Axiom set_injective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), (forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') -> ~ ((f e) = (f e'))) -> p_injective f s. Parameter image: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (set a) -> set b. Axiom image_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), ((image f s) = (map f s)). Axiom image_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), forall (a1:b), (mem a1 (image f s)) -> exists antec_a:a, (mem antec_a s) /\ (a1 = (f antec_a)). Axiom image_spec1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), forall (a1:b), (exists antec_a:a, (mem antec_a s) /\ (a1 = (f antec_a))) -> mem a1 (image f s). Axiom card_image : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), ((cardinal (image f s)) <= (cardinal s))%Z. Axiom card_image_injective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), (p_injective f s) -> ((cardinal (image f s)) = (cardinal s)). Axiom get_injective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), (p_injective f s) -> forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') -> ~ ((f e) = (f e')). Axiom get_not_injective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), ~ (p_injective f s) -> exists e:a, exists e':a, (mem e s) /\ ((mem e' s) /\ (~ (e = e') /\ ((f e) = (f e')))). Axiom set_injective_in : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (forall (e:a), (mem e s) -> mem (f e) s') -> (forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') -> ~ ((f e) = (f e'))) -> p_injective f s. Axiom get_injective_in : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_injective_in f s s') -> forall (e:a), (mem e s) -> mem (f e) s'. Axiom get_injective_in1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_injective_in f s s') -> forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') -> ~ ((f e) = (f e')). Parameter p_surjective: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (set a) -> (set b) -> Prop. Axiom p_surjective_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_surjective f s s') -> forall (e:a), (mem e s) -> mem (f e) s'. Axiom p_surjective_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_surjective f s s') -> forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e'). Axiom p_surjective_def2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), ((forall (e:a), (mem e s) -> mem (f e) s') /\ forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e')) -> p_surjective f s s'. Axiom set_surjective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (forall (e:a), (mem e s) -> mem (f e) s') -> (forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e')) -> p_surjective f s s'. Axiom get_surjective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_surjective f s s') -> forall (e:a), (mem e s) -> mem (f e) s'. Axiom get_surjective1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_surjective f s s') -> forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e'). Axiom image_surjective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_surjective f s s') -> ((image f s) = s'). Parameter p_bijective: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (set a) -> (set b) -> Prop. Axiom p_bijective_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> p_injective_in f s s'. Axiom p_bijective_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> p_surjective f s s'. Axiom p_bijective_def2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), ((p_injective_in f s s') /\ (p_surjective f s s')) -> p_bijective f s s'. Axiom bijective_is_injective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> p_injective f s. Axiom bijective_is_surjective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> p_surjective f s s'. Axiom set_bijective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (forall (e:a), (mem e s) -> mem (f e) s') -> (forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') -> ~ ((f e) = (f e'))) -> (forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e')) -> p_bijective f s s'. Axiom set_bijective1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (forall (e:a), (mem e s) -> mem (f e) s') -> (forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') -> ~ ((f e) = (f e'))) -> (forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e')) -> ((map f s) = s'). Axiom bijectivity_is_transitive : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {c:Type} {c_WT:WhyType c}, forall (f:a -> b) (g:b -> c) (s:set a) (s':set b) (s'':set c), (p_bijective f s s') -> (p_bijective g s' s'') -> p_bijective (fun (k:a) => (g (f k))) s s''. Axiom bijective_image : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> ((cardinal s) = (cardinal s')). Axiom bijective_image1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> (s' = (image f s)). Axiom get_bijective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> forall (e:a), (mem e s) -> mem (f e) s'. Axiom get_bijective1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') -> ~ ((f e) = (f e')). Axiom get_bijective2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e'). Axiom get_bijective3 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> ((cardinal s) = (cardinal s')). Axiom bijective_eq : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> (forall (e:a), (mem e s) -> ((f e) = (g e))) -> p_bijective g s s'. Axiom bijective_eq_gen : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> forall (g:a -> b), (forall (e:a), (mem e s) -> ((f e) = (g e))) -> p_bijective g s s'. Axiom bij_equal_card : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a), ((cardinal s) = (cardinal (map f s))) -> p_bijective f s (map f s). Axiom set_bijective_auto : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> a) (s:set a), (forall (e:a), (mem e s) -> mem (f e) s) -> (forall (e':a), (mem e' s) -> exists e:a, (mem e s) /\ ((f e) = e')) -> p_bijective f s s. Axiom iterate_empty : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (is_empty s) -> (commut op1) -> (iterable op1) -> ((iterate op1 s t) = (neutral_elt op1)). Axiom iterate_one : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), ((cardinal s) = 1%Z) -> (commut op1) -> ((iterate op1 s t) = (t (choose s))). Axiom iterate_add : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (x:a), (commut op1) -> (iterable op1) -> ~ (mem x s) -> ((iterate op1 (add x s) f) = ((op1 (f x)) (iterate op1 s f))). Axiom iterate_add_ : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (x:a), (commut op1) -> ~ (mem x s) -> ~ (is_empty s) -> ((iterate op1 (add x s) f) = ((op1 (f x)) (iterate op1 s f))). Axiom iterate_remove : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (x:a), (commut op1) -> (iterable op1) -> (inverse_tuple op1 (fun (y0:im1) (y1:im1) => (po y0 y1)) (neutral_elt op1)) -> (mem x s) -> ((iterate op1 (remove x s) f) = (po (iterate op1 s f) (f x))). Axiom iterate_def_choose : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1), ~ ((cardinal s) = 1%Z) -> (commut op1) -> ~ (is_empty s) -> ((iterate op1 s f) = ((op1 (f (choose s))) (iterate op1 (remove (choose s) s) f))). Axiom iterate_def_choose1 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1), (iterable op1) -> (commut op1) -> ~ (is_empty s) -> ((iterate op1 s f) = ((op1 (f (choose s))) (iterate op1 (remove (choose s) s) f))). Axiom choose_any : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (t:a), (iterable op1) -> (commut op1) -> (mem t s) -> ((iterate op1 s f) = ((op1 (f t)) (iterate op1 (remove t s) f))). Axiom iterate_comp_iterate : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s1:set a) (f:a -> im1) (g:a -> im1), (iterable op1) -> (commut op1) -> (assoc op1) -> ((iterate op1 s1 (fun (k:a) => ((op1 (f k)) (g k)))) = ((op1 (iterate op1 s1 (fun (k:a) => (f k)))) (iterate op1 s1 (fun (k:a) => (g k))))). Axiom iterate_comp_iterate_com : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s1:set a) (f:a -> im1) (g:a -> im1), (iterable op1) -> (commut op1) -> (((op1 (iterate op1 s1 (fun (k:a) => (f k)))) (iterate op1 s1 (fun (k:a) => (g k)))) = (iterate op1 s1 (fun (k:a) => ((op1 (f k)) (g k))))). Axiom iterate_transitivity : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (s1:set a) (s2:set a) (f:a -> im1), (iterable op1) -> (commut op1) -> (inverse_tuple op1 po1 (neutral_elt op1)) -> ((iterate op1 (union s1 s2) f) = ((po1 ((op1 (iterate op1 s1 f)) (iterate op1 s2 f))) (iterate op1 (inter s1 s2) f))). Axiom iterate_disjoint_transitivity : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s1:set a) (s2:set a) (t:a -> im1), (iterable op1) -> (commut op1) -> ((inter s1 s2) = (empty : set a)) -> ((iterate op1 (union s1 s2) t) = ((op1 (iterate op1 s1 t)) (iterate op1 s2 t))). Axiom iterate_eq : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (g:a -> im1), (forall (x:a), (mem x s) -> ((f x) = (g x))) -> (commut op1) -> ~ (is_empty s) -> ((iterate op1 s f) = (iterate op1 s g)). Axiom iterate_eq1 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (g:a -> im1), (forall (x:a), (mem x s) -> ((f x) = (g x))) -> (commut op1) -> (iterable op1) -> ((iterate op1 s f) = (iterate op1 s g)). Axiom iterate_map : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set b) (f:b -> a) (t:a -> im1), ~ (is_empty s) -> (commut op1) -> (p_injective f s) -> ((iterate op1 (map f s) t) = (iterate op1 s (fun (b1:b) => (t (f b1))))). Axiom iterate_map1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set b) (f:b -> a) (t:a -> im1), (iterable op1) -> (commut op1) -> (p_injective f s) -> ((iterate op1 (map f s) t) = (iterate op1 s (fun (b1:b) => (t (f b1))))). Axiom iterate_cardone : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (iterable op1) -> (commut op1) -> ((cardinal s) = 1%Z) -> ((iterate op1 s t) = (t (element s))). Axiom iterate_cardzero : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (commut op1) -> (iterable op1) -> ((cardinal s) = 0%Z) -> ((iterate op1 s t) = (neutral_elt op1)). Axiom injec_iterate : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (a1:a) (s:set b) (f:a -> b -> im1), (iterable op1) -> (commut op1) -> ((iterate op1 s (f a1)) = (iterate op1 (cartesian_product (to_set a1) s) (fun (o:(a* b)%type) => ((f (fir o)) (sec o))))). Axiom iterate_cartesian_product : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s1:set a) (s2:set b) (f:a -> b -> im1), (iterable op1) -> (commut op1) -> ((iterate op1 s1 (fun (a1:a) => (iterate op1 s2 (f a1)))) = (iterate op1 (cartesian_product s1 s2) (fun (o:(a* b)%type) => ((f (fir o)) (sec o))))). Axiom iterate_eq_func : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (f1:a -> im1) (f2:a -> im1), (commut op1) -> (iterable op1) -> (p_injective f1 s) -> (p_injective f2 s) -> ((map f1 s) = (map f2 s)) -> ((iterate op1 s f1) = (iterate op1 s f2)). Axiom int_iterate_def_empty : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (j <= i)%Z -> (iterable op1) -> ((int_iterate op1 f i j) = (neutral_elt op1)). Axiom int_iterate_def_plus_one : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (i < j)%Z -> ~ ((i + 1%Z)%Z = j) -> ((int_iterate op1 f i j) = ((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j))). Axiom int_iterate_def_plus_one1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (i < j)%Z -> (iterable op1) -> ((int_iterate op1 f i j) = ((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j))). Axiom int_iterate_cardone : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (j = (i + 1%Z)%Z) -> ((int_iterate op1 f i j) = (f i)). Axiom int_iterate_def_plus_one_com : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (i < j)%Z -> ~ (j = (i + 1%Z)%Z) -> (((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j)) = (int_iterate op1 f i j)). Axiom int_iterate_def_plus_one_com1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (i < j)%Z -> (iterable op1) -> (((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j)) = (int_iterate op1 f i j)). Axiom int_iterate_to_iterate : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z -> (commut op1) -> ((int_iterate op1 f i j) = (iterate op1 (to_fset i j) f)). Axiom int_iterate_to_iterate1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) -> (commut op1) -> ((int_iterate op1 f i j) = (iterate op1 (to_fset i j) f)). Axiom int_iterate_right_extension : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) -> (i < j)%Z -> ((int_iterate op1 f i j) = ((op1 (int_iterate op1 f i (j - 1%Z)%Z)) (f (j - 1%Z)%Z))). Axiom int_iterate_right_extension_ : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (assoc op1) -> ((i + 1%Z)%Z < j)%Z -> ((int_iterate op1 f i j) = ((op1 (int_iterate op1 f i (j - 1%Z)%Z)) (f (j - 1%Z)%Z))). Axiom int_iterate_transitivity : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (k:Z) (j:Z), (iterable op1) -> (iterable op1) -> (op_neutral_left op1 (neutral_elt op1)) -> ((i <= k)%Z /\ (k <= j)%Z) -> ((int_iterate op1 f i j) = ((op1 (int_iterate op1 f i k)) (int_iterate op1 f k j))). Axiom int_iterate_transitivity_ : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (k:Z) (j:Z), (op_neutral_left op1 (neutral_elt op1)) -> ((i < k)%Z /\ (k < j)%Z) -> ((int_iterate op1 f i j) = ((op1 (int_iterate op1 f i k)) (int_iterate op1 f k j))). Axiom int_iterate_comp_iterate : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (g:Z -> im1) (i:Z) (j:Z), (iterable op1) -> (op_neutral_right op1 (neutral_elt op1)) -> (commut op1) -> ((int_iterate op1 (fun (k:Z) => ((op1 (f k)) (g k))) i j) = ((op1 (int_iterate op1 f i j)) (int_iterate op1 g i j))). Axiom int_iterate_attr_no_f : forall {im1:Type} {im1_WT:WhyType im1} {im2:Type} {im2_WT:WhyType im2}, forall (op1:im1 -> im1 -> im1) (op2:im2 -> im2 -> im2) (t1:Z -> im1) (t2:Z -> im2) (f:im1 -> im2) (i:Z) (j:Z), (forall (x:Z), forall (y:im1), (((op2 (t2 x)) (f y)) = (f ((op1 (t1 x)) y)))) -> ((f (neutral_elt op1)) = (neutral_elt op2)) -> (iterable op1) -> (iterable op2) -> (forall (i1:Z), ((f (t1 i1)) = (t2 i1))) -> ((int_iterate op2 t2 i j) = (f (int_iterate op1 t1 i j))). Axiom int_iterate_attr : forall {im1:Type} {im1_WT:WhyType im1} {im2:Type} {im2_WT:WhyType im2}, forall (op1:im1 -> im1 -> im1) (op2:im2 -> im2 -> im2) (t:Z -> im1) (f:im1 -> im2) (i:Z) (j:Z), (forall (x:Z), forall (y:im1), (((op2 (f (t x))) (f y)) = (f ((op1 (t x)) y)))) -> ((f (neutral_elt op1)) = (neutral_elt op2)) -> (iterable op1) -> (iterable op2) -> ((int_iterate op2 (fun (e:Z) => (f (t e))) i j) = (f (int_iterate op1 t i j))). Axiom int_iterate_attr_comm : forall {im1:Type} {im1_WT:WhyType im1} {im2:Type} {im2_WT:WhyType im2}, forall (op1:im1 -> im1 -> im1) (op2:im2 -> im2 -> im2) (t:Z -> im1) (f:im1 -> im2) (i:Z) (j:Z), (forall (x:Z), forall (y:im1), (((op2 (f (t x))) (f y)) = (f ((op1 (t x)) y)))) -> ((f (neutral_elt op1)) = (neutral_elt op2)) -> (iterable op1) -> (iterable op2) -> ((f (int_iterate op1 t i j)) = (int_iterate op2 (fun (e:Z) => (f (t e))) i j)). Axiom int_iterate_eq : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (g:Z -> im1) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ~ (j <= i)%Z -> ((int_iterate op1 f i j) = (int_iterate op1 g i j)). Axiom int_iterate_eq1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (g:Z -> im1) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> (iterable op1) -> ((int_iterate op1 f i j) = (int_iterate op1 g i j)). Axiom int_iterate_left_right : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (l:Z) (k:Z) (h:Z), (iterable op1) -> (commut op1) -> ((l <= k)%Z /\ (k <= h)%Z) -> ((int_iterate op1 f l k) = (int_iterate op1 (fun (a:Z) => (f ((h - (a + 1%Z)%Z)%Z + l)%Z)) ((h - k)%Z + l)%Z h)). Axiom int_iterate_eq_func : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (i:Z) (j:Z) (f:Z -> im1) (g:Z -> im1), (iterable op1) -> (commut op1) -> (p_injective f (to_fset i j)) -> (p_injective g (to_fset i j)) -> ((map f (to_fset i j)) = (map g (to_fset i j))) -> ((int_iterate op1 f i j) = (int_iterate op1 g i j)). Axiom int_iterate_map : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t:Z -> im1), ~ (j <= i)%Z -> (commut op1) -> (p_bijective f (to_fset i j) (to_fset k l)) -> ((int_iterate op1 t k l) = (int_iterate op1 (fun (b:Z) => (t (f b))) i j)). Axiom int_iterate_map1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t:Z -> im1), (iterable op1) -> (commut op1) -> (p_bijective f (to_fset i j) (to_fset k l)) -> ((int_iterate op1 t k l) = (int_iterate op1 (fun (b:Z) => (t (f b))) i j)). Axiom int_iterate_transl : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z) (k:Z), (iterable op1) -> ((int_iterate op1 f i j) = (int_iterate op1 (fun (b:Z) => (f (b + k)%Z)) (i - k)%Z (j - k)%Z)). Axiom int_iterate_map_auto : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (i:Z) (j:Z) (f:Z -> Z) (t:Z -> im1), ~ (j <= i)%Z -> (commut op1) -> (p_bijective f (to_fset i j) (to_fset i j)) -> ((int_iterate op1 t i j) = (int_iterate op1 (fun (b:Z) => (t (f b))) i j)). Axiom int_iterate_map_auto1 : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (i:Z) (j:Z) (f:Z -> Z) (t:Z -> im1), (iterable op1) -> (commut op1) -> (p_bijective f (to_fset i j) (to_fset i j)) -> ((int_iterate op1 t i j) = (int_iterate op1 (fun (b:Z) => (t (f b))) i j)). Axiom leq_trans : forall (a:Z) (b:Z) (c:Z), (a <= b)%Z -> (b <= c)%Z -> (a <= c)%Z. Axiom leq_trans_add : forall (a:Z) (b:Z) (c:Z) (d:Z), (a <= c)%Z -> (b <= d)%Z -> ((a + b)%Z <= (c + d)%Z)%Z. Axiom leq_trans_mult : forall (a:Z) (b:Z) (c:Z), (0%Z <= c)%Z -> (a <= b)%Z -> ((a * c)%Z <= (b * c)%Z)%Z. Axiom leq_trans_mult_right : forall (a:Z) (b:Z) (c:Z), (0%Z <= c)%Z -> (a <= b)%Z -> ((c * a)%Z <= (c * b)%Z)%Z. Axiom compat_int_order_mult : forall (a:Z) (b:Z) (c:Z) (d:Z), ((0%Z <= c)%Z /\ (c <= d)%Z) -> ((0%Z <= a)%Z /\ (a <= b)%Z) -> ((c * a)%Z <= (d * b)%Z)%Z. Axiom leq_trans_fact : forall (a:Z) (b:Z) (c:Z) (n:Z), (0%Z <= n)%Z -> ((0%Z <= a)%Z /\ (a <= c)%Z) -> ((0%Z <= b)%Z /\ (b <= (c * n)%Z)%Z) -> ((a + b)%Z <= (c * (n + 1%Z)%Z)%Z)%Z. Axiom leq_trans_facrev : forall (a:Z) (b:Z) (c:Z) (n:Z), (0%Z <= n)%Z -> ((0%Z <= a)%Z /\ (a <= c)%Z) -> ((0%Z <= b)%Z /\ (b <= (c * n)%Z)%Z) -> ((b + a)%Z <= (c * (n + 1%Z)%Z)%Z)%Z. Axiom neutrals : (0%Z = (neutral_elt (fun (y0:Z) (y1:Z) => (y0 + y1)%Z))). Axiom neutrals1 : (1%Z = (neutral_elt (fun (y0:Z) (y1:Z) => (y0 * y1)%Z))). Axiom neutrals2 : iterable (fun (y0:Z) (y1:Z) => (y0 + y1)%Z). Axiom neutrals3 : iterable (fun (y0:Z) (y1:Z) => (y0 * y1)%Z). Parameter isum: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> Z) -> Z. Axiom isum_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> Z), ((isum s t) = (iterate (fun (y0:Z) (y1:Z) => (y0 + y1)%Z) s t)). Parameter iproduct: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> Z) -> Z. Axiom iproduct_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> Z), ((iproduct s t) = (iterate (fun (y0:Z) (y1:Z) => (y0 * y1)%Z) s t)). Axiom isum_iter : iterates (fun (y0:Z) (y1:Z) => (y0 + y1)%Z) 0%Z. Axiom isum_iter__ : iterable (fun (y0:Z) (y1:Z) => (y0 + y1)%Z). Axiom isum_eq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> Z) (t':a -> Z), (forall (e:a), (mem e s) -> ((t e) = (t' e))) -> ((isum s t) = (isum s t')). Axiom isum_eq_gen : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (t:a -> Z) (t':a -> Z), (s = s') -> (forall (e:a), (mem e s) -> ((t e) = (t' e))) -> ((isum s t) = (isum s t')). Axiom isum_add : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> Z) (x:b), ~ (mem x s) -> ((isum (add x s) f) = ((f x) + (isum s f))%Z). Axiom iproduct_eq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> Z) (t':a -> Z), (forall (e:a), (mem e s) -> ((t e) = (t' e))) -> ((iproduct s t) = (iproduct s t')). Axiom iproduct_eq_gen : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (t:a -> Z) (t':a -> Z), (s = s') -> (forall (e:a), (mem e s) -> ((t e) = (t' e))) -> ((iproduct s t) = (iproduct s t')). Axiom iproduct_add : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> Z) (x:b), ~ (mem x s) -> ((iproduct (add x s) f) = ((f x) * (iproduct s f))%Z). Axiom iproduct_from_choose : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> Z), (0%Z < (cardinal s))%Z -> ((iproduct s f) = ((f (choose s)) * (iproduct (remove (choose s) s) f))%Z). Axiom iproduct_map : forall (s:set Z) (f:Z -> Z) (t:Z -> Z), (p_injective f s) -> ((iproduct (map f s) t) = (iproduct s (fun (b:Z) => (t (f b))))). Axiom iproduct_map_auto : forall (s:set Z) (f:Z -> Z) (t:Z -> Z), (p_bijective f s s) -> ((iproduct s t) = (iproduct s (fun (b:Z) => (t (f b))))). Axiom iproduct_one : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> Z), (forall (e:a), (mem e s) -> ((f e) = 1%Z)) -> ((iproduct s f) = 1%Z). Axiom iproduct_one_but_maybe_one_elt : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> Z) (e:a), (mem e s) -> (forall (e':a), (mem e' s) -> ~ (e' = e) -> ((f e') = 1%Z)) -> ((iproduct s f) = (f e)). Axiom iproduct_one_but_maybe_one_elt1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> Z) (e:a), (mem e s) -> (forall (e':a), (mem e' s) -> ~ (e' = e) -> ((f e') = 1%Z)) -> ((iproduct s f) = ((f (choose s)) * (iproduct (remove (choose s) s) f))%Z). Axiom mul_assoc : forall (a:Z) (b:Z) (c:Z), (((a * b)%Z * c)%Z = (a * (b * c)%Z)%Z). Axiom ad_assoc : forall (a:Z) (b:Z) (c:Z), (((a + b)%Z + c)%Z = (a + (b + c)%Z)%Z). Axiom ad_assoc_rev : forall (a:Z) (b:Z) (c:Z), ((a + (b + c)%Z)%Z = ((a + b)%Z + c)%Z). Axiom ad_seq_switch : forall (a:Z) (b:Z) (c:Z) (a':Z) (b':Z) (c':Z), (a = a') -> (b = b') -> (c = c') -> ((a' + (b' + c')%Z)%Z = (b + (c + a)%Z)%Z). Axiom mul_comm : forall (a:Z) (b:Z), ((a * b)%Z = (b * a)%Z). Axiom add_eq_i : forall (a:Z) (a':Z) (b:Z) (b':Z), (a = a') -> (b = b') -> ((a + b)%Z = (a' + b')%Z). Axiom mult_eq_i : forall (a:Z) (a':Z) (b:Z) (b':Z), (a = a') -> (b = b') -> ((a * b)%Z = (a' * b')%Z). Axiom mul_assoc_rev : forall (a:Z) (b:Z) (c:Z), ((a * (b * c)%Z)%Z = ((a * b)%Z * c)%Z). Axiom mult_add_distr : forall (a:Z) (b:Z) (c:Z) (d:Z), (((a + b)%Z * (c + d)%Z)%Z = ((((a * c)%Z + (a * d)%Z)%Z + (b * c)%Z)%Z + (b * d)%Z)%Z). Axiom mult_add_right : forall (a:Z) (b:Z) (c:Z), (((a + b)%Z * c)%Z = ((a * c)%Z + (b * c)%Z)%Z). Axiom mult_add_right_rev : forall (a:Z) (b:Z) (c:Z), (((a * c)%Z + (b * c)%Z)%Z = ((a + b)%Z * c)%Z). Axiom mult_add_left : forall (a:Z) (b:Z) (c:Z), ((a * (b + c)%Z)%Z = ((a * b)%Z + (a * c)%Z)%Z). Axiom mult_add_left_rev : forall (a:Z) (b:Z) (c:Z), (((a * b)%Z + (a * c)%Z)%Z = (a * (b + c)%Z)%Z). Axiom mult_add_distr_rev : forall (a:Z) (b:Z) (c:Z) (d:Z), (((((a * c)%Z + (a * d)%Z)%Z + (b * c)%Z)%Z + (b * d)%Z)%Z = ((a + b)%Z * (c + d)%Z)%Z). Axiom mul_assoc_comm : forall (a:Z) (b:Z) (c:Z), (((a * b)%Z * c)%Z = (b * (a * c)%Z)%Z). Axiom mul_assoc_rev_comm : forall (a:Z) (b:Z) (c:Z), ((a * (b * c)%Z)%Z = ((a * c)%Z * b)%Z). Axiom add_assoc1 : forall (a:Z) (b:Z) (c:Z), (((a + b)%Z + c)%Z = (a + (b + c)%Z)%Z). Axiom add_assoc_rev1 : forall (a:Z) (b:Z) (c:Z), ((a + (b + c)%Z)%Z = ((a + b)%Z + c)%Z). Axiom isum_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> Z), (is_empty s) -> ((isum s f) = 0%Z). Axiom iproduct_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> Z), (is_empty s) -> ((iproduct s f) = 1%Z). Axiom isum_iter_ : opposite_n (fun (y0:Z) (y1:Z) => (y0 + y1)%Z) (fun (y0:Z) (y1:Z) => (y0 - y1)%Z) 0%Z. Axiom isum_iter_1 : opposite1 (fun (y0:Z) (y1:Z) => (y0 + y1)%Z) (fun (y0:Z) (y1:Z) => (y0 - y1)%Z). Axiom isum_iter_2 : opposite_com (fun (y0:Z) (y1:Z) => (y0 + y1)%Z) (fun (y0:Z) (y1:Z) => (y0 - y1)%Z). Axiom isum_iter_3 : inverse_tuple (fun (y0:Z) (y1:Z) => (y0 + y1)%Z) (fun (y0:Z) (y1:Z) => (y0 - y1)%Z) 0%Z. Parameter ind_isum: (Z -> Z) -> Z -> Z -> Z. Axiom ind_isum_def : forall (f:Z -> Z) (i:Z) (j:Z), ((ind_isum f i j) = (int_iterate (fun (y0:Z) (y1:Z) => (y0 + y1)%Z) f i j)). Axiom ind_isum_empty : forall (f:Z -> Z) (i:Z) (j:Z), (j <= i)%Z -> ((ind_isum f i j) = 0%Z). Axiom ind_isum_one : forall (f:Z -> Z) (i:Z) (j:Z), (j = (i + 1%Z)%Z) -> ((ind_isum f i j) = (f i)). Axiom ind_isum_plus_one : forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> ((ind_isum f i j) = ((f i) + (ind_isum f (i + 1%Z)%Z j))%Z). Axiom ind_isum_to_isum : forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> ((ind_isum f i j) = (isum (to_fset i j) f)). Axiom pos_to_strict : forall (a:Z), (1%Z <= a)%Z -> (0%Z < a)%Z. Axiom pos_by_strict : forall (a:Z), (0%Z < a)%Z -> (1%Z <= a)%Z. Axiom ind_isum_const : forall (k:Z) (i:Z) (j:Z), (i < j)%Z -> ((ind_isum ((fun (y0:Z) (y1:Z) => (const y0 y1)) k) i j) = (k * (j - i)%Z)%Z). Axiom ind_isum_null : forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = 0%Z)) -> ((ind_isum f i j) = 0%Z). Axiom ind_isum_right_extension : forall (f:Z -> Z) (i:Z) (j:Z), (i <= j)%Z -> ((ind_isum f i (j + 1%Z)%Z) = ((ind_isum f i j) + (f j))%Z). Axiom ind_isum_re : forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> ((ind_isum f i j) = ((ind_isum f i (j - 1%Z)%Z) + (f (j - 1%Z)%Z))%Z). Axiom ind_isum_re_null : forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> ((f j) = 0%Z) -> ((ind_isum f i (j + 1%Z)%Z) = (ind_isum f i j)). Axiom ind_isum_null_but_maybe_one_elt : forall (l:Z) (h:Z) (t:Z -> Z) (e:Z), ((l <= e)%Z /\ (e < h)%Z) -> (forall (a:Z), ((l <= a)%Z /\ (a < h)%Z) -> ~ (a = e) -> ((t a) = 0%Z)) -> ((ind_isum t l h) = (t e)). Axiom ind_isum_eq : forall (f:Z -> Z) (g:Z -> Z) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ind_isum f i j) = (ind_isum g i j)). Parameter fc: (Z -> Z) -> (Z -> Z) -> (Z -> bool) -> Z -> Z. Axiom fc_def : forall (f:Z -> Z) (g:Z -> Z) (p:Z -> bool) (k:Z), (((p k) = true) -> (((fc f g p) k) = (f k))) /\ (~ ((p k) = true) -> (((fc f g p) k) = (g k))). Axiom ind_isum_to_guard : forall (f:Z -> Z) (g:Z -> Z) (p:Z -> bool) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((p k) = true)) -> ((ind_isum (fc f g p) i j) = (ind_isum f i j)). Parameter fc1: (Z -> Z) -> (Z -> Z) -> (Z -> bool) -> Z -> Z. Axiom fc_def1 : forall (f:Z -> Z) (g:Z -> Z) (p:Z -> bool) (k:Z), (((p k) = true) -> (((fc1 f g p) k) = (g k))) /\ (~ ((p k) = true) -> (((fc1 f g p) k) = (f k))). Axiom ind_isum_no_guard : forall (f:Z -> Z) (g:Z -> Z) (p:Z -> bool) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ~ ((p k) = true)) -> ((ind_isum (fc1 f g p) i j) = (ind_isum f i j)). Axiom ind_isum_eq_gen : forall (f:Z -> Z) (g:Z -> Z) (i:Z) (i1:Z) (j:Z) (j1:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> (i = i1) -> (j = j1) -> ((ind_isum f i j) = (ind_isum g i1 j1)). Axiom ind_isum_func_const : forall (k:Z) (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> (forall (l:Z), ((i <= l)%Z /\ (l < j)%Z) -> ((f l) = k)) -> ((ind_isum f i j) = (k * (j - i)%Z)%Z). Axiom ind_isum_pos : forall (f:Z -> Z) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) >= 0%Z)%Z) -> (0%Z <= (ind_isum f i j))%Z. Parameter ind_iproduct: (Z -> Z) -> Z -> Z -> Z. Axiom ind_iproduct_def : forall (f:Z -> Z) (i:Z) (j:Z), ((ind_iproduct f i j) = (int_iterate (fun (y0:Z) (y1:Z) => (y0 * y1)%Z) f i j)). Axiom ind_iproduct_eq : forall (f:Z -> Z) (g:Z -> Z) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ind_iproduct f i j) = (ind_iproduct g i j)). Axiom ind_iproduct_eq_gen : forall (f:Z -> Z) (g:Z -> Z) (i1:Z) (j1:Z) (i2:Z) (j2:Z), (forall (k:Z), ((i1 <= k)%Z /\ (k < j1)%Z) -> ((f k) = (g k))) -> (i1 = i2) -> (j1 = j2) -> ((ind_iproduct f i1 j1) = (ind_iproduct g i2 j2)). Axiom ind_iproduct_to_iproduct : forall (f:Z -> Z) (i:Z) (j:Z), ((ind_iproduct f i j) = (iproduct (to_fset i j) f)). Axiom ind_iproduct_one_but_maybe_one_elt : forall (f:Z -> Z) (i:Z) (j:Z) (e:Z), ((i <= e)%Z /\ (e < j)%Z) -> (forall (e':Z), ((i <= e')%Z /\ (e' <= j)%Z) -> ~ (e = e') -> ((f e') = 1%Z)) -> ((ind_iproduct f i j) = (f e)). Axiom mult_one_int : forall (a:Z) (b:Z), (b = 1%Z) -> ((a * b)%Z = a). Axiom one_mult_int : forall (a:Z) (b:Z), (a = 1%Z) -> ((a * b)%Z = b). Axiom mult_zero_int : forall (a:Z) (b:Z), (b = 0%Z) -> ((a * b)%Z = 0%Z). Axiom zero_mult_int : forall (a:Z) (b:Z), (a = 0%Z) -> ((a * b)%Z = 0%Z). Axiom iproduct_to_iterate : forall (f:Z -> Z) (i:Z) (j:Z), ((ind_iproduct f i j) = (int_iterate (fun (y0:Z) (y1:Z) => (y0 * y1)%Z) f i j)). Axiom ind_isum_map_auto : forall (i:Z) (j:Z) (f:Z -> Z) (t:Z -> Z), (p_bijective f (to_fset i j) (to_fset i j)) -> ((ind_isum t i j) = (ind_isum (fun (b:Z) => (t (f b))) i j)). Axiom ind_isum_rev : forall (i:Z) (j:Z) (f:Z -> Z), ((ind_isum f i j) = (ind_isum (fun (k:Z) => (f (((j - k)%Z - 1%Z)%Z + i)%Z)) i j)). Axiom ind_isum_map : forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t:Z -> Z), (p_bijective f (to_fset i j) (to_fset k l)) -> ((ind_isum t k l) = (ind_isum (fun (b:Z) => (t (f b))) i j)). Axiom ind_isum_map_auto_bij : forall (i:Z) (j:Z) (f:Z -> Z) (t:Z -> Z), (forall (e:Z), ((i <= e)%Z /\ (e < j)%Z) -> (i <= (f e))%Z /\ ((f e) < j)%Z) -> (forall (e:Z) (e':Z), ((i <= e)%Z /\ (e < j)%Z) -> ((i <= e')%Z /\ (e' < j)%Z) -> ~ (e = e') -> ~ ((f e) = (f e'))) -> (forall (e':Z), ((i <= e')%Z /\ (e' < j)%Z) -> exists e:Z, ((i <= e)%Z /\ (e < j)%Z) /\ ((f e) = e')) -> ((ind_isum t i j) = (ind_isum (fun (b:Z) => (t (f b))) i j)). Axiom ind_isum_map_bij : forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t:Z -> Z), (forall (e:Z), ((i <= e)%Z /\ (e < j)%Z) -> (k <= (f e))%Z /\ ((f e) < l)%Z) -> (forall (e:Z) (e':Z), ((i <= e)%Z /\ (e < j)%Z) -> ((i <= e')%Z /\ (e' < j)%Z) -> ~ (e = e') -> ~ ((f e) = (f e'))) -> (forall (e':Z), ((k <= e')%Z /\ (e' < l)%Z) -> exists e:Z, ((i <= e)%Z /\ (e < j)%Z) /\ ((f e) = e')) -> ((ind_isum t k l) = (ind_isum (fun (b:Z) => (t (f b))) i j)). Axiom ind_iproduct_empty : forall (f:Z -> Z) (i:Z) (j:Z), (i >= j)%Z -> ((ind_iproduct f i j) = 1%Z). Axiom ind_iproduct_plus_one : forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> ((ind_iproduct f i j) = ((f i) * (ind_iproduct f (i + 1%Z)%Z j))%Z). Axiom ind_iproduct_right_extension : forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> ((ind_iproduct f i j) = ((ind_iproduct f i (j - 1%Z)%Z) * (f (j - 1%Z)%Z))%Z). Axiom ind_iproduct_right_extension_comm : forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> (((ind_iproduct f i (j - 1%Z)%Z) * (f (j - 1%Z)%Z))%Z = (ind_iproduct f i j)). Axiom ind_iproduct_comp : forall (f:Z -> Z) (g:Z -> Z) (h:Z -> Z) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> (((f k) * (g k))%Z = (h k))) -> ((ind_iproduct h i j) = ((ind_iproduct f i j) * (ind_iproduct g i j))%Z). Axiom ind_iproduct_one : forall (f:Z -> Z) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = 1%Z)) -> ((ind_iproduct f i j) = 1%Z). Axiom positive_iproduct : forall (f:Z -> Z) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) > 0%Z)%Z) -> ((ind_iproduct f i j) > 0%Z)%Z. Axiom ind_iproduct_pos : forall (f:Z -> Z) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> (0%Z <= (f k))%Z) -> (0%Z <= (ind_iproduct f i j))%Z. Axiom ind_iproduct_strict_pos : forall (f:Z -> Z) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> (0%Z < (f k))%Z) -> (0%Z < (ind_iproduct f i j))%Z. Axiom iproduct_strict_pos : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> Z), (forall (k:a), (mem k s) -> (0%Z < (f k))%Z) -> (0%Z < (iproduct s f))%Z. Axiom ind_iproduct_strict_pos_one : forall (f:Z -> Z) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> (0%Z < (f k))%Z) -> (1%Z <= (ind_iproduct f i j))%Z. Axiom ind_iproduct_left_right : forall (f:Z -> Z) (l:Z) (k:Z) (h:Z), ((l <= k)%Z /\ (k <= h)%Z) -> ((ind_iproduct f l k) = (ind_iproduct (fun (a:Z) => (f ((h - (a + 1%Z)%Z)%Z + l)%Z)) ((h - k)%Z + l)%Z h)). Axiom iterable_imult : iterable (fun (y0:Z) (y1:Z) => (y0 * y1)%Z). Axiom int_minus_distr : forall (a:Z) (b:Z), ((-(a + b)%Z)%Z = ((-a)%Z + (-b)%Z)%Z). Axiom int_minus_eq : forall (a:Z) (b:Z), (a = b) -> ((-a)%Z = (-b)%Z). Axiom ind_iproduct_map_auto : forall (i:Z) (j:Z) (f:Z -> Z) (t:Z -> Z), (p_bijective f (to_fset i j) (to_fset i j)) -> ((ind_iproduct t i j) = (ind_iproduct (fun (b:Z) => (t (f b))) i j)). Axiom ind_iproduct_map : forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t:Z -> Z), (p_bijective f (to_fset i j) (to_fset k l)) -> ((ind_iproduct t k l) = (ind_iproduct (fun (b:Z) => (t (f b))) i j)). Axiom ind_iproduct_trans : forall (f:Z -> Z) (i:Z) (k:Z) (j:Z), ((i <= k)%Z /\ (k <= j)%Z) -> ((ind_iproduct f i j) = ((ind_iproduct f i k) * (ind_iproduct f k j))%Z). Axiom ind_iproduct_inf : forall (f:Z -> Z) (g:Z -> Z) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> (0%Z <= (f k))%Z /\ ((f k) <= (g k))%Z) -> ((ind_iproduct f i j) <= (ind_iproduct g i j))%Z. Parameter choose_filter: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> bool) -> a. Axiom choose_filter_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), (exists e:a, (mem e s) /\ ((p e) = true)) -> ((p (choose s)) = true) -> ((choose_filter s p) = (choose s)). Axiom choose_filter_def1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), (exists e:a, (mem e s) /\ ((p e) = true)) -> ~ ((p (choose s)) = true) -> ((choose_filter s p) = (choose_filter (remove (choose s) s) p)). Axiom choose_filter_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), (exists e:a, (mem e s) /\ ((p e) = true)) -> ((p (choose_filter s p)) = true). Axiom choose_filter_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), (exists e:a, (mem e s) /\ ((p e) = true)) -> mem (choose_filter s p) s. Parameter my_filter: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> bool) -> set a. Axiom my_filter_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), (is_empty s) -> ((my_filter s p) = (empty : set a)). Axiom my_filter_def1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), ~ (is_empty s) -> ((p (choose s)) = true) -> ((my_filter s p) = (add (choose s) (my_filter (remove (choose s) s) p))). Axiom my_filter_def2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), ~ (is_empty s) -> ~ ((p (choose s)) = true) -> ((my_filter s p) = (my_filter (remove (choose s) s) p)). Axiom my_filter_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), forall (e:a), (mem e s) -> ((p e) = true) -> mem e (my_filter s p). Axiom my_filter_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), forall (e:a), (mem e s) -> (mem e (my_filter s p)) -> ((p e) = true). Axiom my_filter_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), forall (e:a), (mem e (my_filter s p)) -> mem e s. Axiom my_filter_spec3 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), (0%Z <= (cardinal (my_filter s p)))%Z. Axiom my_filter_spec4 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool), ((cardinal (my_filter s p)) <= (cardinal s))%Z. Axiom in_my_filter : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool) (e:a), (mem e s) -> ((p e) = true) -> mem e (my_filter s p). Axiom not_in_my_filter_set : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool) (e:a), ~ (mem e s) -> ~ (mem e (my_filter s p)). Axiom not_in_my_filter_filter : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool) (e:a), ~ ((p e) = true) -> ~ (mem e (my_filter s p)). Axiom in_my_filter_set : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool) (e:a), (mem e (my_filter s p)) -> mem e s. Axiom in_my_filter_filter : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p:a -> bool) (e:a), (mem e (my_filter s p)) -> ((p e) = true). Axiom my_filter_inter : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p1:a -> bool) (p2:a -> bool), (forall (e:a), (mem e s) -> ((p1 e) = true) -> ~ ((p2 e) = true)) -> ((inter (my_filter s p1) (my_filter s p2)) = (empty : set a)). Axiom my_filter_union : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (p1:a -> bool) (p2:a -> bool), (forall (e:a), (mem e s) -> ~ ((p1 e) = true) -> ((p2 e) = true)) -> ((union (my_filter s p1) (my_filter s p2)) = s). Axiom ind_iproduct_sup_one : forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> (1%Z <= (f k))%Z) -> (exists k:Z, ((i <= k)%Z /\ (k < j)%Z) /\ ~ ((f k) = 1%Z)) -> (1%Z < (ind_iproduct f i j))%Z. Axiom ind_isum_transl : forall (f:Z -> Z) (i:Z) (j:Z) (k:Z), ((ind_isum f i j) = (ind_isum (fun (b:Z) => (f (b + k)%Z)) (i - k)%Z (j - k)%Z)). Axiom ind_isum_transl_plus_one : forall (f:Z -> Z) (i:Z) (j:Z), ((ind_isum f i j) = (ind_isum (fun (b:Z) => (f (b - 1%Z)%Z)) (i + 1%Z)%Z (j + 1%Z)%Z)). Axiom ind_isum_transl_minus_one : forall (f:Z -> Z) (i:Z) (j:Z), ((ind_isum f i j) = (ind_isum (fun (b:Z) => (f (b + 1%Z)%Z)) (i - 1%Z)%Z (j - 1%Z)%Z)). Axiom ind_isum_scal : forall (f:Z -> Z) (i:Z) (j:Z) (a:Z), (i <= j)%Z -> ((ind_isum (fun (i1:Z) => (a * (f i1))%Z) i j) = (a * (ind_isum f i j))%Z). Axiom minus_ind_isum : forall (f:Z -> Z) (i:Z) (j:Z), (i <= j)%Z -> ((-(ind_isum f i j))%Z = (ind_isum (fun (i1:Z) => (-(f i1))%Z) i j)). Axiom minus_ind_isum_rev : forall (f:Z -> Z) (i:Z) (j:Z), (i <= j)%Z -> ((ind_isum (fun (i1:Z) => (-(f i1))%Z) i j) = (-(ind_isum f i j))%Z). Axiom ind_isum_scal_rev : forall (f:Z -> Z) (i:Z) (j:Z) (a:Z), (i <= j)%Z -> ((a * (ind_isum f i j))%Z = (ind_isum (fun (i1:Z) => (a * (f i1))%Z) i j)). Axiom ind_isum_scal_rev_right : forall (f:Z -> Z) (i:Z) (j:Z) (a:Z), (i <= j)%Z -> (((ind_isum f i j) * a)%Z = (ind_isum (fun (i1:Z) => ((f i1) * a)%Z) i j)). Axiom ind_isum_scal_right : forall (f:Z -> Z) (i:Z) (j:Z) (a:Z), (i <= j)%Z -> ((ind_isum (fun (i1:Z) => ((f i1) * a)%Z) i j) = ((ind_isum f i j) * a)%Z). Axiom ind_isum_bound : forall (f:Z -> Z) (g:Z -> Z) (i:Z) (j:Z), (i < j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) < (g k))%Z) -> ((ind_isum f i j) < (ind_isum g i j))%Z. Axiom comp_trans_equal_strict : forall (a:Z) (b:Z) (c:Z), (a <= b)%Z -> (b < c)%Z -> (a < c)%Z. Axiom transitive_inf_leq_int : forall (a:Z) (b:Z) (c:Z), (a < b)%Z -> (b <= c)%Z -> (a < c)%Z. Axiom transitive_inf_int : forall (a:Z) (b:Z) (c:Z), (a < b)%Z -> (b < c)%Z -> (a < c)%Z. Axiom compeq_trans_sum : forall (a:Z) (b:Z) (c:Z), (b <= c)%Z -> ((a + b)%Z <= (a + c)%Z)%Z. Axiom compeq_trans_sum_zero : forall (a:Z) (b:Z), (0%Z <= b)%Z -> (a <= (a + b)%Z)%Z. Axiom comp_trans_sum : forall (a:Z) (b:Z) (c:Z), (b < c)%Z -> ((a + b)%Z < (a + c)%Z)%Z. Axiom ind_isum_bound_eq : forall (f:Z -> Z) (g:Z -> Z) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) <= (g k))%Z) -> ((ind_isum f i j) <= (ind_isum g i j))%Z. Axiom ind_isum_scal_gen : forall (f:Z -> Z) (i:Z) (j:Z), forall (a:Z), ((i <= a)%Z /\ (a < j)%Z) -> ((ind_isum (fun (i1:Z) => (a * (f i1))%Z) i j) = (a * (ind_isum f i j))%Z). Axiom ind_isum_trans : forall (f:Z -> Z) (i:Z) (k:Z) (j:Z), ((i <= k)%Z /\ (k <= j)%Z) -> ((ind_isum f i j) = ((ind_isum f i k) + (ind_isum f k j))%Z). Axiom minus_out_int : forall (a:Z) (b:Z), (((-a)%Z * b)%Z = (-(a * b)%Z)%Z). Parameter power: Z -> Z -> Z. Axiom power_def : forall (e:Z) (i:Z), (0%Z <= i)%Z -> (i = 0%Z) -> ((power e i) = 1%Z). Axiom power_def1 : forall (e:Z) (i:Z), (0%Z <= i)%Z -> ~ (i = 0%Z) -> ((power e i) = (e * (power e (i - 1%Z)%Z))%Z). Axiom Power_zero : forall (i:Z), ((power i 0%Z) = 1%Z). Axiom Power_one : forall (i:Z), ((power i 1%Z) = i). Axiom power_plus_one : forall (i:Z) (x:Z), (0%Z <= x)%Z -> ((power i (x + 1%Z)%Z) = ((power i x) * i)%Z). Axiom power_sum : forall (i:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> ((power i (x + y)%Z) = ((power i x) * (power i y))%Z). Axiom power_mult : forall (i:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> ((power i (x * y)%Z) = (power (power i x) y)). Axiom Power_sum : forall (x:Z) (y:Z) (i:Z), (x >= 0%Z)%Z -> (y >= 0%Z)%Z -> ((power i (x + y)%Z) = ((power i x) * (power i y))%Z). Axiom Power_mult : forall (x:Z) (y:Z) (i:Z), (x >= 0%Z)%Z -> (y >= 0%Z)%Z -> ((power i (x * y)%Z) = (power (power i x) y)). Axiom power_to_ind_iproduct : forall (e:Z) (i:Z), (0%Z <= i)%Z -> ((power e i) = (ind_iproduct ((fun (y0:Z) (y1:Z) => (const y0 y1)) e) 0%Z i)). Axiom power_transl : forall (e:Z) (k:Z) (i:Z), (0%Z <= i)%Z -> ((power e i) = (ind_iproduct ((fun (y0:Z) (y1:Z) => (const y0 y1)) e) k (k + i)%Z)). Axiom ind_iproduct_to_power : forall (e:Z) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i <= j)%Z) -> ((ind_iproduct ((fun (y0:Z) (y1:Z) => (const y0 y1)) e) i j) = (power e (j - i)%Z)). Axiom ind_iproduct_to_power_gen : forall (e:Z), forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i <= j)%Z) -> ((ind_iproduct ((fun (y0:Z) (y1:Z) => (const y0 y1)) e) i j) = (power e (j - i)%Z)). Axiom power_sum_rev : forall (x:Z) (n:Z) (m:Z), (n >= 0%Z)%Z -> (m >= 0%Z)%Z -> (((power x n) * (power x m))%Z = (power x (n + m)%Z)). Axiom power_eq : forall (x:Z) (n:Z) (m:Z), (n = m) -> ((power x n) = (power x m)). Axiom power_eq_gen : forall (x:Z) (y:Z) (n:Z) (m:Z), (n = m) -> (x = y) -> ((power x n) = (power y m)). Axiom power_2_sum : forall (i:Z), (i >= 1%Z)%Z -> ((ind_isum (fun (k:Z) => (power 2%Z (k + 1%Z)%Z)) 0%Z i) = ((power 2%Z (i + 1%Z)%Z) - 2%Z)%Z). Axiom power_decomp : forall (i:Z), (i >= 1%Z)%Z -> ((ind_isum (fun (k:Z) => (power 2%Z (k + 1%Z)%Z)) 0%Z i) < (power 2%Z (i + 1%Z)%Z))%Z. Parameter fc2: Z -> Z -> Z. Axiom fc_def2 : forall (i:Z) (k:Z), (((1%Z <= k)%Z /\ (k < (i + 1%Z)%Z)%Z) -> (((fc2 i) k) = (power 2%Z (k - 1%Z)%Z))) /\ (~ ((1%Z <= k)%Z /\ (k < (i + 1%Z)%Z)%Z) -> (((fc2 i) k) = 0%Z)). Axiom power_decomp_minus_one : forall (i:Z), (i >= 1%Z)%Z -> ((ind_isum (fc2 i) 1%Z i) < (power 2%Z (i - 1%Z)%Z))%Z. Axiom power_decomp_ : forall (i:Z), (i >= 1%Z)%Z -> ((ind_isum (fun (k:Z) => (power 2%Z k)) 0%Z i) < (power 2%Z i))%Z. Axiom power_decomp_one : forall (i:Z), (i >= 1%Z)%Z -> ((ind_isum (fun (k:Z) => (power 2%Z (k + 1%Z)%Z)) 1%Z i) < (power 2%Z (i + 1%Z)%Z))%Z. Axiom power_decomp_one_ : forall (i:Z), (i >= 1%Z)%Z -> ((ind_isum (fun (k:Z) => (power 2%Z k)) 1%Z i) < (power 2%Z i))%Z. Axiom growing_mult : forall (n:Z) (m:Z), (0%Z <= n)%Z -> (1%Z <= m)%Z -> ((n * m)%Z >= n)%Z. Axiom strict_growing_mult : forall (n:Z) (m:Z), (1%Z < n)%Z -> (1%Z < m)%Z -> ((n * m)%Z > n)%Z. Axiom init_exp : forall (k:Z), ((power k 0%Z) = 1%Z). Axiom init_exp1 : forall (k:Z), ((power k 1%Z) = k). Axiom init_exp2 : forall (k:Z), ((power k 2%Z) = (k * k)%Z). Axiom positive_int_exp : forall (k:Z) (n:Z), (1%Z <= k)%Z -> (0%Z <= n)%Z -> ((power k n) >= 1%Z)%Z. Axiom positive_int_exp1 : forall (k:Z) (n:Z), (1%Z <= k)%Z -> (0%Z <= n)%Z -> ((power k n) > 0%Z)%Z. Axiom positive_int_exp2 : forall (k:Z) (n:Z), (1%Z <= k)%Z -> (0%Z <= n)%Z -> ((power k n) <= (power k (n + 1%Z)%Z))%Z. Axiom strict_positive_int_exp : forall (k:Z) (n:Z), (1%Z < k)%Z -> (0%Z < n)%Z -> ((power k n) > 1%Z)%Z. Axiom strict_positive_int_exp1 : forall (k:Z) (n:Z), (1%Z < k)%Z -> (0%Z < n)%Z -> ((power k (n - 1%Z)%Z) < (power k n))%Z. Axiom strict_positive_int_exp2 : forall (k:Z) (n:Z), (1%Z < k)%Z -> (0%Z < n)%Z -> ((power k n) < (power k (n + 1%Z)%Z))%Z. Axiom power_minus_one : forall (i:Z), (0%Z <= i)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) -> ((power (-1%Z)%Z i) = 1%Z). Axiom power_minus_one1 : forall (i:Z), (0%Z <= i)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) -> ((power (-1%Z)%Z i) = (-1%Z)%Z). Axiom growing_exp : forall (k:Z) (m:Z) (n:Z), (1%Z <= k)%Z -> ((0%Z <= m)%Z /\ (m <= n)%Z) -> ((power k m) <= (power k n))%Z. Axiom strict_growing_exp : forall (k:Z) (m:Z) (n:Z), (1%Z < k)%Z -> ((0%Z <= m)%Z /\ (m < n)%Z) -> ((power k m) < (power k n))%Z. Axiom unicity_exp : forall (k:Z) (m:Z) (n:Z), (1%Z < k)%Z -> (0%Z <= m)%Z -> (0%Z <= n)%Z -> ((power k m) = (power k n)) -> (m = n). Axiom unicity_exp1 : forall (k:Z) (m:Z) (n:Z), (1%Z < k)%Z -> (0%Z <= m)%Z -> (0%Z <= n)%Z -> (m = n) -> ((power k m) = (power k n)). Axiom bounded_sum_exp : forall (i:Z) (j:Z) (m:Z) (n:Z), (0%Z <= m)%Z -> (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z m))%Z) -> ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> (((i * (power 2%Z n))%Z + j)%Z < (power 2%Z (m + n)%Z))%Z. Axiom add_im_re : forall (i:complex) (j:complex), ((infix_pldt i j) = (infix_pldt (infix_pldt (t_real_part i) (t_real_part j)) (infix_asdt im (infix_pldt (t_im_part i) (t_im_part j))))). Axiom add_im_re1 : forall (i:complex) (j:complex), ((t_real_part (infix_pldt i j)) = (infix_pldt (t_real_part i) (t_real_part j))). Axiom add_im_re2 : forall (i:complex) (j:complex), ((t_im_part (infix_pldt i j)) = (infix_pldt (t_im_part i) (t_im_part j))). Axiom add_real_part : forall (i:complex) (j:complex), ((infix_pldt (t_real_part i) (t_real_part j)) = (t_real_part (infix_pldt i j))). Axiom add_im_part : forall (i:complex) (j:complex), ((infix_pldt (t_im_part i) (t_im_part j)) = (t_im_part (infix_pldt i j))). Axiom add_real_part_rev : forall (i:complex) (j:complex), ((t_real_part (infix_pldt i j)) = (infix_pldt (t_real_part i) (t_real_part j))). Axiom add_im_part_rev : forall (i:complex) (j:complex), ((t_im_part (infix_pldt i j)) = (infix_pldt (t_im_part i) (t_im_part j))). Axiom mult_distr_add_r : forall (a:complex) (b:complex) (c:complex), ((infix_asdt a (infix_pldt b c)) = (infix_pldt (infix_asdt a b) (infix_asdt a c))). Axiom mult_distr_minus : forall (a:complex) (b:complex) (c:complex), ((infix_asdt a (infix_mndt b c)) = (infix_mndt (infix_asdt a b) (infix_asdt a c))). Axiom minus_out : forall (a:complex) (b:complex), ((infix_asdt (prefix_mndt a) b) = (prefix_mndt (infix_asdt a b))). Axiom mult_distr_add_r_rev : forall (a:complex) (b:complex) (c:complex), ((infix_pldt (infix_asdt a b) (infix_asdt a c)) = (infix_asdt a (infix_pldt b c))). Axiom mult_distr_minus_rev : forall (a:complex) (b:complex) (c:complex), ((infix_mndt (infix_asdt a b) (infix_asdt a c)) = (infix_asdt a (infix_mndt b c))). Axiom div_distr_add : forall (a:complex) (b:complex) (c:complex), ~ (a = c_zero) -> ((infix_sldt (infix_pldt b c) a) = (infix_pldt (infix_sldt b a) (infix_sldt c a))). Axiom div_distr_minus : forall (a:complex) (b:complex) (c:complex), ~ (a = c_zero) -> ((infix_sldt (infix_mndt b c) a) = (infix_mndt (infix_sldt b a) (infix_sldt c a))). Axiom div_distr_add_rev : forall (a:complex) (b:complex) (c:complex), ~ (a = c_zero) -> ((infix_pldt (infix_sldt b a) (infix_sldt c a)) = (infix_sldt (infix_pldt b c) a)). Axiom div_distr_minus_rev : forall (a:complex) (b:complex) (c:complex), ~ (a = c_zero) -> ((infix_mndt (infix_sldt b a) (infix_sldt c a)) = (infix_sldt (infix_mndt b c) a)). Axiom mult_distr_add_l : forall (a:complex) (b:complex) (c:complex), ((infix_asdt (infix_pldt b c) a) = (infix_pldt (infix_asdt a b) (infix_asdt a c))). Axiom mult_distr_minus_r : forall (a:complex) (b:complex) (c:complex), ((infix_asdt a (infix_mndt b c)) = (infix_mndt (infix_asdt a b) (infix_asdt a c))). Axiom mult_distr_minus_ll : forall (a:complex) (b:complex) (c:complex), ((infix_asdt (infix_pldt (prefix_mndt b) c) a) = (infix_pldt (infix_asdt (prefix_mndt a) b) (infix_asdt a c))). Axiom mult_distr_minus_ri : forall (a:complex) (b:complex) (c:complex), ((infix_asdt (infix_mndt b c) a) = (infix_mndt (infix_asdt a b) (infix_asdt a c))). Axiom minus_distr_op : forall (a:complex) (b:complex) (c:complex), ((infix_mndt a (infix_pldt b c)) = (infix_mndt (infix_mndt a b) c)). Axiom mult_distr_minus_l : forall (a:complex) (b:complex) (c:complex), ((infix_asdt (infix_mndt b c) a) = (infix_mndt (infix_asdt a b) (infix_asdt a c))). Axiom assoc_right : forall (a:complex) (b:complex) (c:complex), ((infix_pldt a (infix_pldt b c)) = (infix_pldt (infix_pldt a b) c)). Axiom assoc_right_mult : forall (a:complex) (b:complex) (c:complex), ((infix_asdt a (infix_asdt b c)) = (infix_asdt (infix_asdt a b) c)). Axiom minus_elim : forall (a:complex) (b:complex), ((infix_mndt a b) = (infix_pldt a (prefix_mndt b))). Axiom minus_eq_t : forall (a:complex) (b:complex) (a':complex) (b':complex), (a = a') -> (b = b') -> ((infix_mndt a b) = (infix_mndt a' b')). Axiom minus_distr_elim : forall (a:complex) (b:complex) (c:complex), ((infix_mndt a (infix_pldt b c)) = (infix_pldt (infix_pldt a (prefix_mndt b)) (prefix_mndt c))). Axiom plus_minus_distr_elim : forall (a:complex) (b:complex) (c:complex), ((infix_pldt a (prefix_mndt (infix_pldt b c))) = (infix_pldt (infix_pldt a (prefix_mndt b)) (prefix_mndt c))). Axiom def_by_minus : forall (x:complex) (y:complex) (z:complex), (x = (infix_mndt y z)) -> (y = (infix_pldt x z)). Axiom switch : forall (a:complex) (b:complex) (c:complex), ((infix_pldt (infix_pldt a b) c) = (infix_pldt (infix_pldt a c) b)). Axiom meet_a_c : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) d) = (infix_pldt (infix_pldt (infix_pldt a c) b) d)). Axiom meet_a_d : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) d) = (infix_pldt (infix_pldt (infix_pldt a d) b) c)). Axiom meet_b_c : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) d) = (infix_pldt (infix_pldt (infix_pldt b c) a) d)). Axiom meet_b_d : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) d) = (infix_pldt (infix_pldt (infix_pldt b d) a) c)). Axiom meet_c_d : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) d) = (infix_pldt (infix_pldt (infix_pldt c d) a) b)). Axiom inv_add : forall (a:complex) (b:complex), ((infix_pldt (infix_pldt a (prefix_mndt a)) b) = b). Axiom switch_m : forall (a:complex) (b:complex) (c:complex), ((infix_pldt (infix_pldt a b) c) = (infix_pldt (infix_pldt a c) b)). Axiom meet_a_c_m : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) d) = (infix_pldt (infix_pldt (infix_pldt a c) b) d)). Axiom meet_a_d_m : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) d) = (infix_pldt (infix_pldt (infix_pldt a d) b) c)). Axiom meet_b_c_m : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) d) = (infix_pldt (infix_pldt (infix_pldt b c) a) d)). Axiom meet_b_d_m : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) d) = (infix_pldt (infix_pldt (infix_pldt b d) a) c)). Axiom meet_c_d_m : forall (a:complex) (b:complex) (c:complex) (d:complex), ((infix_pldt (infix_pldt (infix_pldt a b) c) d) = (infix_pldt (infix_pldt (infix_pldt c d) a) b)). Axiom t_real_part_add : forall (a:complex) (b:complex), ((t_real_part (infix_pldt a b)) = (infix_pldt (t_real_part a) (t_real_part b))). Axiom t_real_part_subs : forall (a:complex) (b:complex), ((t_real_part (infix_mndt a b)) = (infix_mndt (t_real_part a) (t_real_part b))). Axiom t_im_part_add : forall (a:complex) (b:complex), ((t_im_part (infix_pldt a b)) = (infix_pldt (t_im_part a) (t_im_part b))). Axiom t_im_part_subs : forall (a:complex) (b:complex), ((t_im_part (infix_mndt a b)) = (infix_mndt (t_im_part a) (t_im_part b))). Axiom t_real_part_real : forall (a:complex), (real_ a) -> ((t_real_part a) = a). Axiom t_real_part_im : forall (a:complex), (pure_im_ a) -> ((t_real_part a) = c_zero). Axiom im_t_im_part_im : forall (a:complex), (pure_im_ a) -> ((infix_asdt im (t_im_part a)) = a). Axiom t_im_part_im : forall (a:complex), (pure_im_ a) -> ((t_im_part a) = (infix_asdt (prefix_mndt im) a)). Axiom t_im_part_real : forall (a:complex), (real_ a) -> ((t_im_part a) = c_zero). Axiom a_div_b_mult_a : forall (a:complex) (b:complex) (c:complex) (d:complex), ~ (b = c_zero) -> ~ (c = c_zero) -> (d = (infix_sldt c_one b)) -> (a = c) -> ((infix_asdt (infix_sldt a b) (infix_sldt c_one c)) = d). Parameter nonn_part: forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (set a) -> (a -> im1) -> set a. Parameter result2: forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (a -> im1) -> a -> bool. Axiom result_def2 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (t:a -> im1) (e:a), (((result2 op1 t) e) = true) <-> ~ (neutral op1 (t e)). Axiom nonn_part_def : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), ((nonn_part op1 s t) = (filter (result2 op1 t) s)). Axiom nonn_part_spec : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), (mem e (nonn_part op1 s t)) -> mem e s. Axiom nonn_part_spec1 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), (mem e (nonn_part op1 s t)) -> ~ (neutral op1 (t e)). Axiom nonn_part_spec2 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), ((mem e s) /\ ~ (neutral op1 (t e))) -> mem e (nonn_part op1 s t). Parameter n_part: forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (set a) -> (a -> im1) -> set a. Parameter result3: forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (a -> im1) -> a -> bool. Axiom result_def3 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (t:a -> im1) (e:a), (((result3 op1 t) e) = true) <-> (neutral op1 (t e)). Axiom n_part_def : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), ((n_part op1 s t) = (filter (result3 op1 t) s)). Axiom n_part_spec : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), (mem e (n_part op1 s t)) -> mem e s. Axiom n_part_spec1 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), (mem e (n_part op1 s t)) -> neutral op1 (t e). Axiom n_part_spec2 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), ((mem e s) /\ (neutral op1 (t e))) -> mem e (n_part op1 s t). Axiom nullity_partition : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (commut op1) -> (s = (union (nonn_part op1 s t) (n_part op1 s t))). Axiom nullity_partition1 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (commut op1) -> ((inter (nonn_part op1 s t) (n_part op1 s t)) = (empty : set a)). Axiom iterate_neutral : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (iterable op1) -> (commut op1) -> (forall (a1:a), (mem a1 s) -> ((t a1) = (neutral_elt op1))) -> ((iterate op1 s t) = (neutral_elt op1)). Axiom iterate_nullity_partition : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (iterable op1) -> (commut op1) -> ((iterate op1 s t) = (iterate op1 (nonn_part op1 s t) t)). Parameter couple: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {im1:Type} {im1_WT:WhyType im1}, (a -> b -> im1) -> (a* b)%type -> im1. Axiom couple_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {im1:Type} {im1_WT:WhyType im1}, forall (f:a -> b -> im1) (o:(a* b)%type), forall (x:a) (x1:b), (o = (x, x1)) -> ((couple f o) = ((f x) x1)). Axiom null_product : forall (a:complex) (b:complex), ((infix_asdt a b) = c_zero) -> (a = c_zero) \/ (b = c_zero). Axiom couple_value : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {im1:Type} {im1_WT:WhyType im1}, forall (f:a -> b -> im1) (o:(a* b)%type), ((couple f o) = ((f (fir o)) (sec o))). Axiom couple_value_dev : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {im1:Type} {im1_WT:WhyType im1}, forall (f:a -> b -> im1) (o:(a* b)%type) (a1:a) (b1:b), (o = (a1, b1)) -> ((couple f o) = ((f a1) b1)). Axiom neutral_c_zero : neutral (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)) c_zero. Axiom neutral_c_zero1 : iterable (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)). Parameter sum: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> complex) -> complex. Axiom sum_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), ((sum s t) = (iterate (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)) s t)). Parameter eq_t: complex -> complex -> Prop. Axiom eq_t_def : forall (a:complex) (a':complex), (eq_t a a') -> (a = a'). Axiom eq_t_def1 : forall (a:complex) (a':complex), (a = a') -> eq_t a a'. Axiom sum_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), (is_empty s) -> ((sum s t) = c_zero). Axiom sum_one : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), ((cardinal s) = 1%Z) -> ((sum s t) = (t (choose s))). Axiom sum_add : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> complex) (x:b), ~ (mem x s) -> ((sum (add x s) f) = (infix_pldt (f x) (sum s f))). Axiom sum_plus_one : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> complex), ((cardinal s) > 1%Z)%Z -> ((sum s f) = (infix_pldt (f (choose s)) (sum (remove (choose s) s) f))). Axiom sum_real : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> complex), (forall (a1:a), (mem a1 s) -> real_ (f a1)) -> ((cardinal s) > 0%Z)%Z -> real_ (sum s f). Axiom map_sum_eq : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> a) (t:a -> complex), (p_injective f s) -> ((sum (map f s) t) = (sum s (fun (b1:b) => (t (f b1))))). Axiom sum_comp : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> complex) (g:b -> complex), ((sum s (fun (k:b) => (infix_pldt (f k) (g k)))) = (infix_pldt (sum s f) (sum s g))). Axiom sum_comp_rev : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> complex) (g:b -> complex), ((infix_pldt (sum s f) (sum s g)) = (sum s (fun (k:b) => (infix_pldt (f k) (g k))))). Axiom sum_iter_ : opposite_n (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)) (fun (y0:complex) (y1:complex) => (infix_mndt y0 y1)) c_zero. Axiom sum_iter_1 : opposite1 (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)) (fun (y0:complex) (y1:complex) => (infix_mndt y0 y1)). Axiom sum_iter_2 : opposite_com (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)) (fun (y0:complex) (y1:complex) => (infix_mndt y0 y1)). Axiom sum_iter_3 : inverse_tuple (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)) (fun (y0:complex) (y1:complex) => (infix_mndt y0 y1)) c_zero. Axiom neutral_zero : ((neutral_elt (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1))) = c_zero). Axiom sum_eq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> complex) (g:a -> complex), (forall (x:a), (mem x s) -> ((f x) = (g x))) -> ((sum s f) = (sum s g)). Axiom sum_eq_gen : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (f:a -> complex) (g:a -> complex), (s = s') -> (forall (x:a), (mem x s) -> ((f x) = (g x))) -> ((sum s f) = (sum s' g)). Axiom sum_disjoint_transitivity : forall {a:Type} {a_WT:WhyType a}, forall (s1:set a) (s2:set a) (t:a -> complex), ((inter s1 s2) = (empty : set a)) -> ((sum (union s1 s2) t) = (infix_pldt (sum s1 t) (sum s2 t))). Axiom sum_to_cartesian_product : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b) (f:a -> b -> complex), ((sum s1 (fun (a1:a) => (sum s2 (f a1)))) = (sum (cartesian_product s1 s2) (fun (o:(a* b)%type) => ((f (fir o)) (sec o))))). Axiom sum_from_cartesian_product : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b) (f:a -> b -> complex), ((sum (cartesian_product s1 s2) (fun (o:(a* b)%type) => ((f (fir o)) (sec o)))) = (sum s1 (fun (a1:a) => (sum s2 (f a1))))). Parameter ind_sum: (Z -> complex) -> Z -> Z -> complex. Axiom ind_sum_def : forall (f:Z -> complex) (i:Z) (j:Z), ((ind_sum f i j) = (int_iterate (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)) f i j)). Axiom ind_sum_to_int_iterate : forall (f:Z -> complex) (i:Z) (j:Z), ((ind_sum f i j) = (int_iterate (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)) f i j)). Axiom ind_sum_cardone : forall (f:Z -> complex) (i:Z) (j:Z), (j = (i + 1%Z)%Z) -> ((ind_sum f i j) = (f i)). Axiom ind_sum_right_extension : forall (f:Z -> complex) (i:Z) (j:Z), (i < j)%Z -> ((ind_sum f i j) = (infix_pldt (ind_sum f i (j - 1%Z)%Z) (f (j - 1%Z)%Z))). Axiom ind_sum_trans : forall (f:Z -> complex) (i:Z) (k:Z) (j:Z), ((i <= k)%Z /\ (k <= j)%Z) -> ((ind_sum f i j) = (infix_pldt (ind_sum f i k) (ind_sum f k j))). Axiom ind_sum_plus_one : forall (f:Z -> complex) (i:Z) (j:Z), (i < j)%Z -> ((ind_sum f i j) = (infix_pldt (f i) (ind_sum f (i + 1%Z)%Z j))). Axiom real_ind_sum : forall (f:Z -> complex) (i:Z) (j:Z), (i < j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> real_ (f k)) -> real_ (ind_sum f i j). Axiom positive_ind_sum : forall (f:Z -> complex) (i:Z) (j:Z), (i < j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> infix_lseqdt c_zero (f k)) -> infix_lseqdt c_zero (ind_sum f i j). Axiom positive_sum : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> complex), (forall (k:a), (mem k s) -> infix_lseqdt c_zero (f k)) -> infix_lseqdt c_zero (sum s f). Axiom ind_sum_eq : forall (f:Z -> complex) (g:Z -> complex) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ind_sum f i j) = (ind_sum g i j)). Parameter fc3: (Z -> complex) -> complex -> Z -> Z -> Z -> complex. Axiom fc_def3 : forall (f:Z -> complex) (g:complex) (i:Z) (j:Z) (k:Z), (((i <= k)%Z /\ (k < j)%Z) -> (((fc3 f g i j) k) = (f k))) /\ (~ ((i <= k)%Z /\ (k < j)%Z) -> (((fc3 f g i j) k) = g)). Axiom ind_sum_eq_del_bound : forall (f:Z -> complex) (g:complex) (i:Z) (j:Z), ((ind_sum (fc3 f g i j) i j) = (ind_sum f i j)). Parameter fc4: (Z -> complex) -> complex -> Z -> Z -> Z -> complex. Axiom fc_def4 : forall (f:Z -> complex) (g:complex) (i:Z) (j:Z) (k:Z), (((i <= k)%Z /\ (k < j)%Z) -> (((fc4 f g i j) k) = (f k))) /\ (~ ((i <= k)%Z /\ (k < j)%Z) -> (((fc4 f g i j) k) = g)). Axiom ind_sum_eq_del_bound_rev : forall (f:Z -> complex) (g:complex) (i:Z) (j:Z), ((ind_sum f i j) = (ind_sum (fc4 f g i j) i j)). Axiom ind_sum_eq_gen : forall (f:Z -> complex) (g:Z -> complex) (i1:Z) (j1:Z) (i2:Z) (j2:Z), (i1 = i2) -> (j1 = j2) -> (forall (k:Z), ((i1 <= k)%Z /\ (k < j1)%Z) -> ((f k) = (g k))) -> ((ind_sum f i1 j1) = (ind_sum g i2 j2)). Axiom ind_sum_eq_bound : forall (f:Z -> complex) (g:Z -> complex) (i:Z) (j:Z), (i = j) -> (forall (k:Z), ((0%Z <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ind_sum f 0%Z i) = (ind_sum g 0%Z j)). Axiom ind_sum_comp : forall (f:Z -> complex) (g:Z -> complex) (i:Z) (j:Z), ((ind_sum (fun (k:Z) => (infix_pldt (f k) (g k))) i j) = (infix_pldt (ind_sum f i j) (ind_sum g i j))). Axiom ind_sum_comp_rev : forall (f:Z -> complex) (g:Z -> complex) (i:Z) (i':Z) (j:Z) (j':Z), (i = i') -> (j = j') -> ((infix_pldt (ind_sum f i j) (ind_sum g i' j')) = (ind_sum (fun (k:Z) => (infix_pldt (f k) (g k))) i j)). Axiom ind_sum_to_iterate : forall (f:Z -> complex) (i:Z) (j:Z), ((ind_sum f i j) = (iterate (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)) (to_fset i j) f)). Axiom ind_sum_to_sum : forall (f:Z -> complex) (i:Z) (j:Z), ((ind_sum f i j) = (sum (to_fset i j) f)). Axiom map_ind_sum_eq : forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t:Z -> complex), (p_bijective f (to_fset i j) (to_fset k l)) -> ((ind_sum t k l) = (ind_sum (fun (b:Z) => (t (f b))) i j)). Axiom sum_scal : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> complex) (s:set a) (c:complex), ((sum s (fun (x:a) => (infix_asdt c (f x)))) = (infix_asdt c (sum s f))). Axiom sum_scal_right : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> complex) (s:set a) (c:complex), ((sum s (fun (x:a) => (infix_asdt (f x) c))) = (infix_asdt (sum s f) c)). Axiom sum_scal_rev_right : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> complex) (s:set a) (c:complex), ((infix_asdt (sum s f) c) = (sum s (fun (x:a) => (infix_asdt (f x) c)))). Axiom sum_scal_rev : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> complex) (s:set a) (c:complex), ((infix_asdt c (sum s f)) = (sum s (fun (x:a) => (infix_asdt c (f x))))). Axiom ind_sum_scal : forall (f:Z -> complex) (i:Z) (j:Z) (a:complex), ((ind_sum (fun (i1:Z) => (infix_asdt a (f i1))) i j) = (infix_asdt a (ind_sum f i j))). Axiom ind_sum_scal_rev : forall (f:Z -> complex) (i:Z) (j:Z) (a:complex), ((infix_asdt a (ind_sum f i j)) = (ind_sum (fun (i1:Z) => (infix_asdt a (f i1))) i j)). Axiom scal_ind_sum : forall (f:Z -> complex) (i:Z) (j:Z) (a:complex), ((ind_sum (fun (i1:Z) => (infix_asdt (f i1) a)) i j) = (infix_asdt (ind_sum f i j) a)). Axiom scal_ind_sum_rev : forall (f:Z -> complex) (i:Z) (j:Z) (a:complex), ((infix_asdt (ind_sum f i j) a) = (ind_sum (fun (i1:Z) => (infix_asdt (f i1) a)) i j)). Axiom sum_scal_gen : forall (f:Z -> complex) (s:set Z), forall (a:complex), ((sum s (fun (i:Z) => (infix_asdt a (f i)))) = (infix_asdt a (sum s f))). Axiom ind_sum_scal_gen : forall (f:Z -> complex) (i:Z) (j:Z), forall (a:complex), ((ind_sum (fun (i1:Z) => (infix_asdt a (f i1))) i j) = (infix_asdt a (ind_sum f i j))). Axiom int_int_iterate_def_empty : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z), (j <= i)%Z -> (iterable op1) -> ((int_int_iterate op1 f i j k l) = (neutral_elt op1)). Axiom int_int_iterate_def_plus_one : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z), (i < j)%Z -> (iterable op1) -> ((int_int_iterate op1 f i j k l) = ((op1 (int_iterate op1 (fun (n:Z) => ((f i) n)) k l)) (int_int_iterate op1 f (i + 1%Z)%Z j k l))). Axiom int_int_iterate_to_int_iterate : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z), (i <= j)%Z -> (iterable op1) -> ((int_int_iterate op1 f i j k l) = (int_iterate op1 (fun (a:Z) => (int_iterate op1 (f a) k l)) i j)). Axiom int_iterate_to_int_int_iterate : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z), (i <= j)%Z -> (iterable op1) -> ((int_iterate op1 (fun (a:Z) => (int_iterate op1 (f a) k l)) i j) = (int_int_iterate op1 f i j k l)). Axiom int_int_iterate_to_iterate : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z), (i <= j)%Z -> (iterable op1) -> (commut op1) -> ((int_int_iterate op1 f i j k l) = (iterate op1 (cartesian_product (to_fset i j) (to_fset k l)) (fun (o:(Z* Z)%type) => ((f (fir o)) (sec o))))). Axiom iterate_commute : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s1:set a) (s2:set b) (f:a -> b -> im1), (iterable op1) -> (commut op1) -> ((iterate op1 (cartesian_product s1 s2) (fun (o:(a* b)%type) => ((f (fir o)) (sec o)))) = (iterate op1 (cartesian_product s2 s1) (fun (o:(b* a)%type) => ((f (sec o)) (fir o))))). Axiom iterate_commute_ : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s1:set a) (s2:set b) (f:a -> b -> im1), (iterable op1) -> (commut op1) -> ((iterate op1 s1 (fun (a1:a) => (iterate op1 s2 (fun (a2:b) => ((f a1) a2))))) = (iterate op1 s2 (fun (a2:b) => (iterate op1 s1 (fun (a1:a) => ((f a1) a2)))))). Axiom int_int_iterate_commute : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z), (iterable op1) -> (commut op1) -> (i <= j)%Z -> (k <= l)%Z -> ((int_int_iterate op1 f i j k l) = (int_int_iterate op1 (fun (a:Z) (b:Z) => ((f b) a)) k l i j)). Axiom int_iterate_commute : forall {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z), (iterable op1) -> (commut op1) -> (i <= j)%Z -> (k <= l)%Z -> ((int_iterate op1 (fun (a:Z) => (int_iterate op1 (f a) k l)) i j) = (int_iterate op1 (fun (a:Z) => (int_iterate op1 (fun (b:Z) => ((f b) a)) i j)) k l)). Axiom ind_sum_commute : forall (f:Z -> Z -> complex) (i:Z) (j:Z) (k:Z) (l:Z), (i <= j)%Z -> (k <= l)%Z -> ((ind_sum (fun (k1:Z) => (ind_sum (f k1) k l)) i j) = (ind_sum (fun (k1:Z) => (ind_sum (fun (k2:Z) => ((f k2) k1)) i j)) k l)). Axiom sum_commute : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b -> complex) (sa:set a) (sb:set b), ((sum sa (fun (a1:a) => (sum sb (f a1)))) = (sum sb (fun (b1:b) => (sum sa (fun (a1:a) => ((f a1) b1)))))). Parameter non_c_zero: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> complex) -> set a. Axiom non_c_zero_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), ((non_c_zero s t) = (nonn_part (fun (y0:complex) (y1:complex) => (infix_pldt y0 y1)) s t)). Axiom non_c_zero_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), forall (e:a), (mem e (non_c_zero s t)) -> mem e s. Axiom non_c_zero_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), forall (e:a), (mem e (non_c_zero s t)) -> ~ ((t e) = c_zero). Axiom non_c_zero_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), forall (e:a), ((mem e s) /\ ~ ((t e) = c_zero)) -> mem e (non_c_zero s t). Axiom get_non_c_zero_member : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex) (e:a), (mem e (non_c_zero s t)) -> mem e s. Axiom get_non_c_zero_member1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex) (e:a), (mem e (non_c_zero s t)) -> ~ ((t e) = c_zero). Axiom set_non_c_zero_member : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex) (e:a), (mem e s) -> ~ ((t e) = c_zero) -> mem e (non_c_zero s t). Axiom set_non_c_zero_member_gen : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), forall (e:a), ((mem e s) /\ ~ ((t e) = c_zero)) -> mem e (non_c_zero s t). Axiom set_non_c_zero_member_gen_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), forall (e:a), ((mem e s) /\ ~ ((t e) = c_zero)) -> mem e (non_c_zero s t). Axiom sum_nullity_partition : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), ((sum s t) = (sum (non_c_zero s t) t)). Axiom non_null_map : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> a) (t:a -> complex), ((non_c_zero (map f s) t) = (map f (non_c_zero s (fun (b:a) => (t (f b)))))). Axiom map_sum_eq_nonnull : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> a) (t:a -> complex), (p_bijective f (non_c_zero s (fun (b:a) => (t (f b)))) (non_c_zero (map f s) t)) -> ((sum (non_c_zero (map f s) t) t) = (sum (non_c_zero s (fun (b:a) => (t (f b)))) (fun (b:a) => (t (f b))))). Axiom sum_null_but_one : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), ((cardinal (non_c_zero s t)) = 1%Z) -> ((sum s t) = (t (element (non_c_zero s t)))). Axiom sum_null : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), ((cardinal (non_c_zero s t)) = 0%Z) -> ((sum s t) = c_zero). Axiom sum_null_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), (forall (e:a), (mem e s) -> ((t e) = c_zero)) -> ((sum s t) = c_zero). Axiom sum_null_forall : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), (forall (e:a), (mem e s) -> ((t e) = c_zero)) -> ((sum s t) = c_zero). Axiom ind_sum_null : forall (t:Z -> complex) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((t k) = c_zero)) -> ((ind_sum t i j) = c_zero). Axiom sum_null_but_one_elt : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex) (elt:a), ((mem elt s) /\ ~ ((t elt) = c_zero)) -> (forall (a1:a), (mem a1 s) -> ~ (a1 = elt) -> ((t a1) = c_zero)) -> ((sum s t) = (t elt)). Axiom sum_null_but_maybe_one_elt : forall {a:Type} {a_WT:WhyType a}, forall (t:a -> complex) (s:set a) (elt:a), (mem elt s) -> (forall (k:a), (mem k s) -> ~ (k = elt) -> ((t k) = c_zero)) -> ((sum s t) = (t elt)). Axiom sum_null_but_maybe_two_elt : forall {a:Type} {a_WT:WhyType a}, forall (t:a -> complex) (s:set a) (elt:a) (elt':a), (mem elt s) -> (mem elt' s) -> ~ (elt = elt') -> (forall (k:a), (mem k s) -> ~ (k = elt) -> ~ (k = elt') -> ((t k) = c_zero)) -> ((sum s t) = (infix_pldt (t elt) (t elt'))). Axiom ind_sum_null_but_maybe_one_elt : forall (t:Z -> complex) (i:Z) (j:Z) (ind:Z), ((i <= ind)%Z /\ (ind < j)%Z) -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ~ (k = ind) -> ((t k) = c_zero)) -> ((ind_sum t i j) = (t ind)). Axiom ind_sum_null_but_maybe_two_elt : forall (t:Z -> complex) (i:Z) (j:Z) (ind:Z) (ind':Z), ((i <= ind)%Z /\ (ind < j)%Z) -> ((i <= ind')%Z /\ (ind' < j)%Z) -> ~ (ind = ind') -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ~ (k = ind) -> ~ (k = ind') -> ((t k) = c_zero)) -> ((ind_sum t i j) = (infix_pldt (t ind) (t ind'))). Axiom ind_sum_map_filter : forall (n:Z) (n':Z) (g:Z -> Z) (f:Z -> complex) (p:Z -> bool), ((0%Z <= n')%Z /\ (n' <= n)%Z) -> (p_injective g (to_fset 0%Z n')) -> (forall (k:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ~ ((p k) = true) -> ((f k) = c_zero)) -> (forall (k:Z), ((0%Z <= k)%Z /\ (k < n')%Z) -> (0%Z <= (g k))%Z /\ ((g k) < n)%Z) -> (forall (k:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((p k) = true) <-> exists ant:Z, ((0%Z <= ant)%Z /\ (ant < n')%Z) /\ (k = (g ant))) -> ((ind_sum f 0%Z n) = (ind_sum (fun (k:Z) => (f (g k))) 0%Z n')). Axiom neutral_c_one : neutral (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)) c_one. Axiom neutral_c_one1 : iterable (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)). Axiom product_iter : op_neutral_left (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)) c_one. Axiom product_iter1 : op_neutral_right (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)) c_one. Axiom product_iter2 : op_assoc (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)). Axiom product_iter3 : commut (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)). Axiom product_iter4 : iterates (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)) c_one. Parameter product: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> complex) -> complex. Axiom product_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), ((product s t) = (iterate (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)) s t)). Axiom product_eq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex) (t':a -> complex), (forall (e:a), (mem e s) -> ((t e) = (t' e))) -> ((product s t) = (product s t')). Axiom product_eq_gen : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (t:a -> complex) (t':a -> complex), (s = s') -> (forall (e:a), (mem e s) -> ((t e) = (t' e))) -> ((product s t) = (product s' t')). Axiom product_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> complex), (is_empty s) -> ((product s f) = c_one). Axiom product_iter_ : iterable (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)). Axiom add_product : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> complex) (x:a), ~ (mem x s) -> ((product (add x s) f) = (infix_asdt (f x) (product s f))). Axiom product_add : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> complex) (x:a), ~ (mem x s) -> ((product (add x s) f) = (infix_asdt (product s f) (f x))). Axiom neutral_one : ((neutral_elt (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1))) = c_one). Parameter ind_product: (Z -> complex) -> Z -> Z -> complex. Axiom ind_product_def : forall (f:Z -> complex) (i:Z) (j:Z), ((ind_product f i j) = (int_iterate (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)) f i j)). Axiom ind_product_eq : forall (f:Z -> complex) (g:Z -> complex) (i:Z) (j:Z), (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ind_product f i j) = (ind_product g i j)). Axiom ind_product_cardone : forall (f:Z -> complex) (i:Z) (j:Z), (j = (i + 1%Z)%Z) -> ((ind_product f i j) = (f i)). Axiom ind_product_eq_gen : forall (f:Z -> complex) (g:Z -> complex) (i1:Z) (j1:Z) (i2:Z) (j2:Z), (forall (k:Z), ((i1 <= k)%Z /\ (k < j1)%Z) -> ((f k) = (g k))) -> (i1 = i2) -> (j1 = j2) -> ((ind_product f i1 j1) = (ind_product g i2 j2)). Axiom ind_product_right_extension : forall (f:Z -> complex) (i:Z) (j:Z), (i < j)%Z -> ((ind_product f i j) = (infix_asdt (ind_product f i (j - 1%Z)%Z) (f (j - 1%Z)%Z))). Axiom ind_product_left_extension : forall (f:Z -> complex) (i:Z) (j:Z), (i < j)%Z -> ((ind_product f i j) = (infix_asdt (f i) (ind_product f (i + 1%Z)%Z j))). Axiom ind_product_to_product : forall (f:Z -> complex) (i:Z) (j:Z), ((ind_product f i j) = (product (to_fset i j) f)). Axiom map_product_eq : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> a) (t:a -> complex), (p_injective f s) -> ((product (map f s) t) = (product s (fun (b1:b) => (t (f b1))))). Axiom map_ind_product_eq : forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t:Z -> complex), (p_bijective f (to_fset i j) (to_fset k l)) -> ((ind_product t k l) = (ind_product (fun (b:Z) => (t (f b))) i j)). Axiom ind_product_right_extension_comm : forall (f:Z -> complex) (i:Z) (j:Z), (i < j)%Z -> ((infix_asdt (ind_product f i (j - 1%Z)%Z) (f (j - 1%Z)%Z)) = (ind_product f i j)). Axiom ind_product_eq_func : forall (i:Z) (j:Z) (f1:Z -> complex) (f2:Z -> complex), (p_injective f1 (to_fset i j)) -> (p_injective f2 (to_fset i j)) -> ((map f1 (to_fset i j)) = (map f2 (to_fset i j))) -> ((ind_product f1 i j) = (ind_product f2 i j)). Axiom ind_product_trans : forall (f:Z -> complex) (i:Z) (k:Z) (j:Z), ((i <= k)%Z /\ (k <= j)%Z) -> ((ind_product f i j) = (infix_asdt (ind_product f i k) (ind_product f k j))). Axiom ind_product_zero_pre : forall (f:Z -> complex) (i:Z) (t:Z) (j:Z), ((i <= t)%Z /\ (t < j)%Z) -> ((f t) = c_zero) -> ((ind_product f i j) = c_zero). Axiom ind_product_zero : forall (f:Z -> complex) (i:Z) (j:Z), (i <= j)%Z -> (exists t:Z, ((i <= t)%Z /\ (t < j)%Z) /\ ((f t) = c_zero)) -> ((ind_product f i j) = c_zero). Axiom ind_product_zero_elt : forall (f:Z -> complex) (i:Z) (j:Z) (t:Z), (i <= j)%Z -> ((i <= t)%Z /\ (t < j)%Z) -> ((f t) = c_zero) -> ((ind_product f i j) = c_zero). Axiom ind_product_const_c_one : forall (f:Z -> complex) (i:Z) (j:Z), (i <= j)%Z -> (forall (t:Z), ((i <= t)%Z /\ (t < j)%Z) -> ((f t) = c_one)) -> ((ind_product f i j) = c_one). Parameter nonn_part1: forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (set a) -> (a -> im1) -> set a. Parameter result4: forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (a -> im1) -> a -> bool. Axiom result_def4 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (t:a -> im1) (e:a), (((result4 op1 t) e) = true) <-> ~ (neutral op1 (t e)). Axiom nonn_part_def1 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), ((nonn_part1 op1 s t) = (filter (result4 op1 t) s)). Axiom nonn_part_spec3 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), (mem e (nonn_part1 op1 s t)) -> mem e s. Axiom nonn_part_spec4 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), (mem e (nonn_part1 op1 s t)) -> ~ (neutral op1 (t e)). Axiom nonn_part_spec5 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), ((mem e s) /\ ~ (neutral op1 (t e))) -> mem e (nonn_part1 op1 s t). Parameter n_part1: forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (set a) -> (a -> im1) -> set a. Parameter result5: forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> (a -> im1) -> a -> bool. Axiom result_def5 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (t:a -> im1) (e:a), (((result5 op1 t) e) = true) <-> (neutral op1 (t e)). Axiom n_part_def1 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), ((n_part1 op1 s t) = (filter (result5 op1 t) s)). Axiom n_part_spec3 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), (mem e (n_part1 op1 s t)) -> mem e s. Axiom n_part_spec4 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), (mem e (n_part1 op1 s t)) -> neutral op1 (t e). Axiom n_part_spec5 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), forall (e:a), ((mem e s) /\ (neutral op1 (t e))) -> mem e (n_part1 op1 s t). Axiom nullity_partition2 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (commut op1) -> (s = (union (nonn_part1 op1 s t) (n_part1 op1 s t))). Axiom nullity_partition3 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (commut op1) -> ((inter (nonn_part1 op1 s t) (n_part1 op1 s t)) = (empty : set a)). Axiom iterate_neutral1 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (iterable op1) -> (commut op1) -> (forall (a1:a), (mem a1 s) -> ((t a1) = (neutral_elt op1))) -> ((iterate op1 s t) = (neutral_elt op1)). Axiom iterate_nullity_partition1 : forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}, forall (op1:im1 -> im1 -> im1) (s:set a) (t:a -> im1), (iterable op1) -> (commut op1) -> ((iterate op1 s t) = (iterate op1 (nonn_part1 op1 s t) t)). Parameter indic: forall {a:Type} {a_WT:WhyType a}, a -> a -> complex. Axiom indic_def : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (a':a), (infix_eqeq a1 a') -> ((indic a1 a') = c_one). Axiom indic_def1 : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (a':a), ~ (infix_eqeq a1 a') -> ((indic a1 a') = c_zero). Axiom indic_spec : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (a':a), ((a1 = a') -> ((indic a1 a') = c_one)) /\ (~ (a1 = a') -> ((indic a1 a') = c_zero)). Axiom get_indic : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (a':a), ((a1 = a') -> ((indic a1 a') = c_one)) /\ (~ (a1 = a') -> ((indic a1 a') = c_zero)). Parameter indic_bool: forall {a:Type} {a_WT:WhyType a}, a -> a -> bool. Axiom indic_bool_def : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (a':a), (infix_eqeq a1 a') -> ((indic_bool a1 a') = true). Axiom indic_bool_def1 : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (a':a), ~ (infix_eqeq a1 a') -> ((indic_bool a1 a') = false). Axiom indic_bool_spec : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (a':a), ((a1 = a') -> ((indic_bool a1 a') = true)) /\ (~ (a1 = a') -> ((indic_bool a1 a') = false)). Axiom indic_comm : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (a':a), ((indic a1 a') = (indic a' a1)). Axiom indic_transl_r : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (b:a) (c:a), (b = c) -> ((indic a1 b) = (indic a1 c)). Axiom indic_transl_l : forall {a:Type} {a_WT:WhyType a}, forall (a1:a) (b:a) (c:a), (b = c) -> ((indic b a1) = (indic c a1)). Parameter indic_2: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, a -> a -> b -> b -> complex. Axiom indic_2_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (a':a) (b1:b) (b':b), (((indic_bool a1 a') = true) /\ ((indic_bool b1 b') = true)) -> ((indic_2 a1 a' b1 b') = c_one). Axiom indic_2_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (a':a) (b1:b) (b':b), ~ ((indic_bool a1 a') = true) -> ((indic_2 a1 a' b1 b') = c_zero). Axiom indic_2_def2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (a':a) (b1:b) (b':b), ~ ((indic_bool b1 b') = true) -> ((indic_2 a1 a' b1 b') = c_zero). Axiom indic_2_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (a':a) (b1:b) (b':b), ((indic_2 a1 a' b1 b') = (infix_asdt (indic a1 a') (indic b1 b'))). Axiom indic_2_spec1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (a':a) (b1:b) (b':b), ((indic_2 a1 a' b1 b') = (indic (a1, b1) (a', b'))). Axiom indic_2_if : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (i:a) (k:a) (j:b) (l:b), (((i = k) /\ (j = l)) -> ((indic_2 i k j l) = c_one)) /\ (~ ((i = k) /\ (j = l)) -> ((indic_2 i k j l) = c_zero)). Axiom indic_2_comm : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (a':a) (b1:b) (b':b), ((indic_2 a1 a' b1 b') = (indic_2 a' a1 b1 b')). Axiom indic_2_comm1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (a':a) (b1:b) (b':b), ((indic_2 a1 a' b1 b') = (indic_2 a1 a' b' b1)). Axiom indic_2_comm2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (a1:a) (a':a) (b1:b) (b':b), ((indic_2 a1 a' b1 b') = (indic_2 a' a1 b' b1)). Parameter sum_indic: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> complex) -> a -> complex. Axiom sum_indic_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex) (i:a), ((sum_indic s t i) = (sum s (fun (e:a) => (infix_asdt (t e) (indic i e))))). Parameter bool_to_c: bool -> complex. Axiom bool_to_c_def : forall (a:bool), (a = true) -> ((bool_to_c a) = c_one). Axiom bool_to_c_def1 : forall (a:bool), ~ (a = true) -> ((bool_to_c a) = c_zero). Parameter ind_sum_indic: (Z -> complex) -> Z -> Z -> Z -> complex. Axiom ind_sum_indic_def : forall (t:Z -> complex) (l:Z) (h:Z) (i:Z), (l < h)%Z -> ((ind_sum_indic t l h i) = (ind_sum (fun (e:Z) => (infix_asdt (t e) (indic i e))) l h)). Axiom ind_sum_indic_spec : forall (t:Z -> complex) (l:Z) (h:Z) (i:Z), (l < h)%Z -> ((ind_sum_indic t l h i) = (sum_indic (to_fset l h) t i)). Axiom sum_indic_t : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex) (i:a), (mem i s) -> ((sum_indic s t i) = (t i)). Axiom sum_indic_ts : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex) (i:a), (mem i s) -> ((sum s (fun (e:a) => (infix_asdt (t e) (indic i e)))) = (t i)). Axiom ind_sum_indic_t : forall (t:Z -> complex) (l:Z) (h:Z) (i:Z), ((l <= i)%Z /\ (i < h)%Z) -> ((ind_sum_indic t l h i) = (t i)). Axiom ind_sum_indic_t1 : forall (t:Z -> complex) (l:Z) (h:Z) (i:Z), ((l <= i)%Z /\ (i < h)%Z) -> ((ind_sum (fun (e:Z) => (infix_asdt (t e) (indic i e))) l h) = (t i)). Axiom ind_sum_indic_t_quant : forall (t:Z -> complex) (l:Z) (h:Z), forall (i:Z), ((l <= i)%Z /\ (i < h)%Z) -> ((ind_sum (fun (e:Z) => (infix_asdt (t e) (indic i e))) l h) = (t i)). Axiom div_plus_one : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (((int.EuclideanDivision.div i j) * j)%Z <= i)%Z. Axiom div_plus_one1 : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (i < (((int.EuclideanDivision.div i j) + 1%Z)%Z * j)%Z)%Z. Axiom mod_is_inf : forall (i:Z) (j:Z), (0%Z < j)%Z -> ((int.EuclideanDivision.mod1 i j) < j)%Z. Axiom zero_add : forall (a1:Z) (a2:Z), (a1 = 0%Z) -> ((a1 + a2)%Z = a2). Axiom add_zero : forall (a1:Z) (a2:Z), (a2 = 0%Z) -> ((a1 + a2)%Z = a1). Axiom one_mult : forall (a1:Z) (a2:Z), (a1 = 1%Z) -> ((a1 * a2)%Z = a2). Axiom mult_one : forall (a1:Z) (a2:Z), (a2 = 1%Z) -> ((a1 * a2)%Z = a1). Axiom add_eq : forall (a1:Z) (a2:Z) (b1:Z) (b2:Z), (a1 = a2) -> (b1 = b2) -> ((a1 + b1)%Z = (a2 + b2)%Z). Axiom mult_eq : forall (a1:Z) (a2:Z) (b1:Z) (b2:Z), (a1 = a2) -> (b1 = b2) -> ((a1 * b1)%Z = (a2 * b2)%Z). Axiom add_eq_inv : forall (a1:Z) (a2:Z) (b1:Z) (b2:Z), (a1 = a2) -> (b1 = b2) -> ((a1 + b1)%Z = (b2 + a2)%Z). Axiom mult_eq_inv : forall (a1:Z) (a2:Z) (b1:Z) (b2:Z), (a1 = a2) -> (b1 = b2) -> ((a1 * b1)%Z = (b2 * a2)%Z). Axiom bound_eq : forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < j)%Z) -> (i = (int.EuclideanDivision.mod1 i j)). Axiom bound_eq_rev : forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < j)%Z) -> ((int.EuclideanDivision.mod1 i j) = i). Axiom unicity_div_mod : forall (i:Z) (j:Z) (q:Z) (r:Z), (0%Z < j)%Z -> (i = ((q * j)%Z + r)%Z) -> ((0%Z <= r)%Z /\ (r < j)%Z) -> (q = (int.EuclideanDivision.div i j)). Axiom unicity_div_mod1 : forall (i:Z) (j:Z) (q:Z) (r:Z), (0%Z < j)%Z -> (i = ((q * j)%Z + r)%Z) -> ((0%Z <= r)%Z /\ (r < j)%Z) -> (r = (int.EuclideanDivision.mod1 i j)). Axiom get_div : forall (j:Z) (q:Z) (r:Z), (0%Z < j)%Z -> ((0%Z <= r)%Z /\ (r < j)%Z) -> ((int.EuclideanDivision.div ((q * j)%Z + r)%Z j) = q). Axiom positive_div : forall (i:Z) (j:Z), ((0%Z < j)%Z /\ (j < i)%Z) -> (0%Z < (int.EuclideanDivision.div i j))%Z. Axiom div_mod_sim_bound : forall (d:Z) (m:Z) (q:Z) (r:Z), ((0%Z <= d)%Z /\ (d < r)%Z) -> ((0%Z <= m)%Z /\ (m < q)%Z) -> (0%Z <= ((d * q)%Z + m)%Z)%Z. Axiom div_mod_sim_bound1 : forall (d:Z) (m:Z) (q:Z) (r:Z), ((0%Z <= d)%Z /\ (d < r)%Z) -> ((0%Z <= m)%Z /\ (m < q)%Z) -> (((d * q)%Z + m)%Z < (r * q)%Z)%Z. Axiom div_mod_sim_bound_gen_r : forall (d:Z) (q:Z) (r:Z), ((0%Z <= d)%Z /\ (d < r)%Z) -> forall (m:Z), ((0%Z <= m)%Z /\ (m < q)%Z) -> (0%Z <= ((d * q)%Z + m)%Z)%Z. Axiom div_mod_sim_bound_gen_r1 : forall (d:Z) (q:Z) (r:Z), ((0%Z <= d)%Z /\ (d < r)%Z) -> forall (m:Z), ((0%Z <= m)%Z /\ (m < q)%Z) -> (((d * q)%Z + m)%Z < (r * q)%Z)%Z. Axiom unicity_div_gen : forall (j:Z) (q:Z), (0%Z <= q)%Z -> (0%Z < j)%Z -> forall (i:Z), (0%Z <= i)%Z -> ((0%Z <= (i - (q * j)%Z)%Z)%Z /\ ((i - (q * j)%Z)%Z < j)%Z) -> (q = (int.EuclideanDivision.div i j)). Axiom unicity_div_gen1 : forall (j:Z) (q:Z), (0%Z <= q)%Z -> (0%Z < j)%Z -> forall (i:Z), (0%Z <= i)%Z -> ((0%Z <= (i - (q * j)%Z)%Z)%Z /\ ((i - (q * j)%Z)%Z < j)%Z) -> ((i - (j * q)%Z)%Z = (int.EuclideanDivision.mod1 i j)). Axiom bound_mod : forall (i:Z) (j:Z), (0%Z < j)%Z -> (0%Z <= (int.EuclideanDivision.mod1 i j))%Z. Axiom bound_mod1 : forall (i:Z) (j:Z), (0%Z < j)%Z -> ((int.EuclideanDivision.mod1 i j) < j)%Z. Axiom mod_eq : forall (a:Z) (b:Z) (d:Z), (a = b) -> ((int.EuclideanDivision.mod1 a d) = (int.EuclideanDivision.mod1 b d)). Axiom e_div_eq : forall (a:Z) (b:Z) (d:Z), (a = b) -> ((int.EuclideanDivision.div a d) = (int.EuclideanDivision.div b d)). Axiom decomp : forall (i:Z) (j:Z), ~ (0%Z = j) -> (i = ((j * (int.EuclideanDivision.div i j))%Z + (int.EuclideanDivision.mod1 i j))%Z). Axiom div_mod_eq : forall (i:Z) (j:Z) (q:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> (0%Z < q)%Z -> ((int.EuclideanDivision.div i q) = (int.EuclideanDivision.div j q)) -> ((int.EuclideanDivision.mod1 i q) = (int.EuclideanDivision.mod1 j q)) -> (i = j). Axiom mod_zero : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> ((int.EuclideanDivision.mod1 i j) = 0%Z) -> (i = (j * (int.EuclideanDivision.div i j))%Z). Axiom div_plus_quotient : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> ((int.EuclideanDivision.div (i + j)%Z j) = ((int.EuclideanDivision.div i j) + 1%Z)%Z). Axiom div_plus_fact_gen_div : forall (i:Z) (j:Z) (k:Z), (0%Z < j)%Z -> ((int.EuclideanDivision.div (i + (k * j)%Z)%Z j) = ((int.EuclideanDivision.div i j) + k)%Z). Axiom mod_plus_fact_gen_mod : forall (i:Z) (j:Z) (k:Z), (0%Z < j)%Z -> ((int.EuclideanDivision.mod1 ((k * j)%Z + i)%Z j) = (int.EuclideanDivision.mod1 i j)). Axiom mod_plus_fact_gen_mod_left : forall (i:Z) (j:Z) (k:Z), (0%Z < j)%Z -> ((int.EuclideanDivision.mod1 ((j * k)%Z + i)%Z j) = (int.EuclideanDivision.mod1 i j)). Axiom bound_div : forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z -> (0%Z <= f)%Z -> (i < (f * q)%Z)%Z -> (0%Z <= (int.EuclideanDivision.div i q))%Z. Axiom bound_div1 : forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z -> (0%Z <= f)%Z -> (i < (f * q)%Z)%Z -> (0%Z <= ((int.EuclideanDivision.div i q) * q)%Z)%Z. Axiom bound_div2 : forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z -> (0%Z <= f)%Z -> (i < (f * q)%Z)%Z -> (((int.EuclideanDivision.div i q) * q)%Z <= i)%Z. Axiom bound_div3 : forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z -> (0%Z <= f)%Z -> (i < (f * q)%Z)%Z -> (i < (q * ((int.EuclideanDivision.div i q) + 1%Z)%Z)%Z)%Z. Axiom bound_div4 : forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z -> (0%Z <= f)%Z -> (i < (f * q)%Z)%Z -> ((int.EuclideanDivision.div i q) < f)%Z. Axiom mod_upper_bound : forall (i:Z) (q:Z), (0%Z < i)%Z -> (i = q) -> ((int.EuclideanDivision.mod1 i q) = 0%Z). Axiom bound_div_gen : forall (q:Z) (f:Z), (0%Z < q)%Z -> (0%Z <= f)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (q * f)%Z)%Z) -> ((int.EuclideanDivision.div i q) < f)%Z. Axiom mod_invariant : forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z < q)%Z -> (0%Z < f)%Z -> ((int.EuclideanDivision.mod1 ((q * (f * (int.EuclideanDivision.div i (q * f)%Z))%Z)%Z + (int.EuclideanDivision.mod1 i (q * f)%Z))%Z q) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (q * f)%Z) q)). Axiom mod_inf : forall (i:Z) (q:Z), ((0%Z <= i)%Z /\ (i < q)%Z) -> ((int.EuclideanDivision.mod1 i q) = i). Axiom add_mod : forall (a:Z) (b:Z) (c:Z), (c > 0%Z)%Z -> ((int.EuclideanDivision.mod1 ((int.EuclideanDivision.mod1 a c) + (int.EuclideanDivision.mod1 b c))%Z c) = (int.EuclideanDivision.mod1 (a + b)%Z c)). Axiom add_mod_eq : forall (a:Z) (b:Z) (c:Z) (d:Z) (n:Z), (0%Z < n)%Z -> ((int.EuclideanDivision.mod1 a n) = (int.EuclideanDivision.mod1 c n)) -> ((int.EuclideanDivision.mod1 b n) = (int.EuclideanDivision.mod1 d n)) -> ((int.EuclideanDivision.mod1 (a + b)%Z n) = (int.EuclideanDivision.mod1 (c + d)%Z n)). Axiom add_mod_left : forall (a:Z) (b:Z) (c:Z), (c > 0%Z)%Z -> ((int.EuclideanDivision.mod1 ((int.EuclideanDivision.mod1 a c) + b)%Z c) = (int.EuclideanDivision.mod1 (a + b)%Z c)). Axiom simpl_add_mod_left : forall (a:Z) (b:Z) (c:Z), (c > 0%Z)%Z -> ((int.EuclideanDivision.mod1 a c) = 0%Z) -> ((int.EuclideanDivision.mod1 (a + b)%Z c) = (int.EuclideanDivision.mod1 b c)). Axiom add_mod_right : forall (a:Z) (b:Z) (c:Z), (c > 0%Z)%Z -> ((int.EuclideanDivision.mod1 (a + (int.EuclideanDivision.mod1 b c))%Z c) = (int.EuclideanDivision.mod1 (a + b)%Z c)). Axiom mod_mod_left : forall (i:Z) (j:Z) (f:Z), (0%Z < j)%Z -> (0%Z < f)%Z -> ((int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (f * j)%Z) j) = (int.EuclideanDivision.mod1 i j)). Axiom mult_mod : forall (a:Z) (b:Z) (c:Z), (c > 0%Z)%Z -> ((int.EuclideanDivision.mod1 ((int.EuclideanDivision.mod1 a c) * (int.EuclideanDivision.mod1 b c))%Z c) = (int.EuclideanDivision.mod1 (a * b)%Z c)). Axiom mod_mod_mult : forall (a:Z) (b:Z) (c:Z), (0%Z < b)%Z -> ((int.EuclideanDivision.mod1 ((int.EuclideanDivision.mod1 a b) * (int.EuclideanDivision.mod1 c b))%Z b) = (int.EuclideanDivision.mod1 (a * c)%Z b)). Axiom mod_mod_mult_rev : forall (a:Z) (b:Z) (c:Z), (0%Z < b)%Z -> ((int.EuclideanDivision.mod1 (a * c)%Z b) = (int.EuclideanDivision.mod1 ((int.EuclideanDivision.mod1 a b) * (int.EuclideanDivision.mod1 c b))%Z b)). Axiom mod_mod_i : forall (i:Z) (j:Z), (0%Z < j)%Z -> ((int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i j) j) = (int.EuclideanDivision.mod1 i j)). Axiom binary_prod : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> ((int.EuclideanDivision.mod1 ((int.EuclideanDivision.mod1 i 2%Z) * (int.EuclideanDivision.mod1 j 2%Z))%Z 2%Z) = (int.EuclideanDivision.mod1 (i * j)%Z 2%Z)). Axiom mod_minus : forall (a:Z) (b:Z) (c:Z), (0%Z < b)%Z -> ((int.EuclideanDivision.mod1 a b) = c) -> ((int.EuclideanDivision.mod1 (-a)%Z b) = (int.EuclideanDivision.mod1 (-c)%Z b)). Axiom mult_mod_left : forall (a:Z) (b:Z) (c:Z), (c > 0%Z)%Z -> ((int.EuclideanDivision.mod1 ((int.EuclideanDivision.mod1 a c) * b)%Z c) = (int.EuclideanDivision.mod1 (a * b)%Z c)). Axiom mult_mod_right : forall (a:Z) (b:Z) (c:Z), (c > 0%Z)%Z -> ((int.EuclideanDivision.mod1 (a * (int.EuclideanDivision.mod1 b c))%Z c) = (int.EuclideanDivision.mod1 (a * b)%Z c)). Axiom mod_mod_right : forall (i:Z) (j:Z) (f:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < f)%Z -> ((int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (j * f)%Z) j) = (int.EuclideanDivision.mod1 i j)). Axiom mod_mod_rev : forall (i:Z) (j:Z) (f:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < f)%Z -> ((int.EuclideanDivision.mod1 i j) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (j * f)%Z) j)). Axiom mod_mod_rev1 : forall (i:Z) (j:Z) (f:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < f)%Z -> ((int.EuclideanDivision.mod1 i j) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (f * j)%Z) j)). Axiom mod_mod_plus : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> ((int.EuclideanDivision.mod1 i j) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (j + j)%Z) j)). Axiom mod_mod_add_left : forall (a:Z) (b:Z) (c:Z), (0%Z < c)%Z -> ((int.EuclideanDivision.mod1 ((int.EuclideanDivision.mod1 a c) + b)%Z c) = (int.EuclideanDivision.mod1 (a + b)%Z c)). Axiom mod_mod_add_right : forall (a:Z) (b:Z) (c:Z), (0%Z < c)%Z -> ((int.EuclideanDivision.mod1 (a + (int.EuclideanDivision.mod1 b c))%Z c) = (int.EuclideanDivision.mod1 (a + b)%Z c)). Axiom mod_mod_add_left_rev : forall (a:Z) (b:Z) (c:Z), (0%Z < c)%Z -> ((int.EuclideanDivision.mod1 (a + b)%Z c) = (int.EuclideanDivision.mod1 ((int.EuclideanDivision.mod1 a c) + b)%Z c)). Axiom mod_mod_add_right_rev : forall (a:Z) (b:Z) (c:Z), (0%Z < c)%Z -> ((int.EuclideanDivision.mod1 (a + b)%Z c) = (int.EuclideanDivision.mod1 (a + (int.EuclideanDivision.mod1 b c))%Z c)). Axiom mult_assoc1 : forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z < q)%Z -> (0%Z < f)%Z -> ((q * (f * (int.EuclideanDivision.div i (q * f)%Z))%Z)%Z = ((q * f)%Z * (int.EuclideanDivision.div i (q * f)%Z))%Z). Axiom div_div1 : forall (i:Z) (j:Z) (k:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < k)%Z -> ((int.EuclideanDivision.div (int.EuclideanDivision.div i k) j) = (int.EuclideanDivision.div i (k * j)%Z)). Axiom div_div2 : forall (i:Z) (j:Z) (k:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < k)%Z -> ((int.EuclideanDivision.div (int.EuclideanDivision.div i k) j) = (int.EuclideanDivision.div i (j * k)%Z)). Axiom compat_order_div : forall (i:Z) (i':Z) (j:Z), ((0%Z <= i)%Z /\ (i <= i')%Z) -> (0%Z < j)%Z -> ((int.EuclideanDivision.div i j) <= (int.EuclideanDivision.div i' j))%Z. Axiom mod_div : forall (i:Z) (j:Z) (k:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < k)%Z -> ((int.EuclideanDivision.div (int.EuclideanDivision.mod1 i (j * k)%Z) j) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.div i j) k)). Axiom inf_mul : forall (ia:Z) (ib:Z) (a:Z) (b:Z), ((0%Z <= ia)%Z /\ (ia < a)%Z) -> ((0%Z <= ib)%Z /\ (ib < b)%Z) -> (((a * ib)%Z + ia)%Z < (a * b)%Z)%Z. Axiom inf_mul1 : forall (ia:Z) (ib:Z) (a:Z) (b:Z), ((0%Z <= ia)%Z /\ (ia < a)%Z) -> ((0%Z <= ib)%Z /\ (ib < b)%Z) -> (((ib * a)%Z + ia)%Z < (b * a)%Z)%Z. Axiom inf_mul_gen : forall (n:Z) (v:Z) (p:Z), ((0%Z <= p)%Z /\ (p < v)%Z) -> forall (k:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> (((k * v)%Z + p)%Z < (n * v)%Z)%Z. Axiom inf_mul_gen_b : forall (n:Z) (v:Z) (p:Z), ((0%Z <= p)%Z /\ (p < n)%Z) -> forall (k:Z), ((0%Z <= k)%Z /\ (k < v)%Z) -> (((p * v)%Z + k)%Z < (n * v)%Z)%Z. Axiom inf_mul_comm : forall (i:Z) (bi:Z) (quot:Z) (rest:Z), ((0%Z <= i)%Z /\ (i < bi)%Z) -> (0%Z < rest)%Z -> (0%Z < quot)%Z -> (bi = (quot * rest)%Z) -> ((int.EuclideanDivision.mod1 i rest) < rest)%Z. Axiom indic_div_mod : forall (i:Z) (j:Z) (q:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> (0%Z < q)%Z -> ((indic i j) = (infix_asdt (indic (int.EuclideanDivision.mod1 i q) (int.EuclideanDivision.mod1 j q)) (indic (int.EuclideanDivision.div i q) (int.EuclideanDivision.div j q)))). Axiom indic_div_mod_gen : forall (q:Z), (0%Z < q)%Z -> forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (0%Z <= j)%Z) -> ((indic i j) = (infix_asdt (indic (int.EuclideanDivision.mod1 i q) (int.EuclideanDivision.mod1 j q)) (indic (int.EuclideanDivision.div i q) (int.EuclideanDivision.div j q)))). Axiom set_inf : True. Axiom set_infeq : True. Axiom bounded_cycle : forall (a:Z) (b:Z) (c:Z) (d:Z), (0%Z <= a)%Z -> (0%Z < b)%Z -> ((0%Z <= d)%Z /\ (d < b)%Z) -> (0%Z < c)%Z -> ((int.EuclideanDivision.div ((a * b)%Z + d)%Z (b * c)%Z) = (int.EuclideanDivision.div a c)). Axiom div_mod_minus : forall (a:Z) (b:Z), (0%Z < b)%Z -> (0%Z < a)%Z -> ((int.EuclideanDivision.mod1 (-a)%Z b) = (b - (int.EuclideanDivision.mod1 a b))%Z). Axiom mod_mod_iproduct : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> Z) (b:Z), (0%Z < b)%Z -> ((int.EuclideanDivision.mod1 (iproduct s (fun (i:a) => (int.EuclideanDivision.mod1 (f i) b))) b) = (int.EuclideanDivision.mod1 (iproduct s f) b)). Axiom ind_isum_mod_eq : forall (f:Z -> Z) (g:Z -> Z) (i:Z) (j:Z) (n:Z), (0%Z < n)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((int.EuclideanDivision.mod1 (f k) n) = (int.EuclideanDivision.mod1 (g k) n))) -> ((int.EuclideanDivision.mod1 (ind_isum f i j) n) = (int.EuclideanDivision.mod1 (ind_isum g i j) n)). Parameter binary: (Z -> Z) -> Prop. Axiom binary_def : forall (t:Z -> Z), (binary t) -> forall (k:Z), (0%Z <= (t k))%Z. Axiom binary_def1 : forall (t:Z -> Z), (binary t) -> forall (k:Z), ((t k) < 2%Z)%Z. Axiom binary_def2 : forall (t:Z -> Z), (forall (k:Z), (0%Z <= (t k))%Z /\ ((t k) < 2%Z)%Z) -> binary t. Axiom set_binary : forall (t:Z -> Z), (forall (k:Z), (0%Z <= (t k))%Z /\ ((t k) < 2%Z)%Z) -> binary t. Axiom get_binary : forall (t:Z -> Z), (binary t) -> forall (k:Z), (0%Z <= (t k))%Z. Axiom get_binary1 : forall (t:Z -> Z), (binary t) -> forall (k:Z), ((t k) < 2%Z)%Z. Parameter shift: forall {a:Type} {a_WT:WhyType a}, (Z -> a) -> Z -> Z -> a. Axiom shift_def : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (i:Z) (k:Z), ((shift f i k) = (f (k + i)%Z)). Axiom shift_value : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (i:Z) (k:Z), ((shift f i k) = (f (k + i)%Z)). Axiom shiftz : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (k:Z), ((shift f 0%Z k) = (f k)). Axiom shiftz_gen : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (i:Z) (k:Z), (i = 0%Z) -> ((shift f i k) = (f k)). Axiom shiftz_quant : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a), ((((fun (y0:Z -> a) (y1:Z) (y2:Z) => (shift y0 y1 y2)) f) 0%Z) = f). Axiom shiftz_quant_rev : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a), (f = (((fun (y0:Z -> a) (y1:Z) (y2:Z) => (shift y0 y1 y2)) f) 0%Z)). Parameter concat_fun: forall {a:Type} {a_WT:WhyType a}, (Z -> a) -> (Z -> a) -> Z -> Z -> a. Axiom concat_fun_def : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (g:Z -> a) (i:Z) (k:Z), (k < i)%Z -> ((concat_fun f g i k) = (f k)). Axiom concat_fun_def1 : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (g:Z -> a) (i:Z) (k:Z), ~ (k < i)%Z -> ((concat_fun f g i k) = (g (k - i)%Z)). Axiom shift_add : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (i:Z) (j:Z) (k:Z), ((shift (((fun (y0:Z -> a) (y1:Z) (y2:Z) => (shift y0 y1 y2)) f) j) i k) = (shift f (i + j)%Z k)). Axiom concat_fun_value : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (g:Z -> a) (i:Z) (k:Z), ((k < i)%Z -> ((concat_fun f g i k) = (f k))) /\ (~ (k < i)%Z -> ((concat_fun f g i k) = (g (k - i)%Z))). Axiom concat_eq : forall {a:Type} {a_WT:WhyType a}, forall (f1:Z -> a) (g1:Z -> a) (f2:Z -> a) (g2:Z -> a) (i1:Z) (i2:Z) (k:Z), (forall (l:Z), (l < i1)%Z -> ((f1 l) = (f2 l))) -> (forall (l:Z), (l >= 0%Z)%Z -> ((g1 l) = (g2 l))) -> (i1 = i2) -> ((concat_fun f1 g1 i1 k) = (concat_fun f2 g2 i2 k)). Parameter mod_func: forall {a:Type} {a_WT:WhyType a}, (Z -> a) -> Z -> Z -> a. Axiom mod_func_def : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (k:Z) (i:Z), (k > 0%Z)%Z -> ((mod_func f k i) = (f (int.EuclideanDivision.mod1 i k))). Axiom mod_func_inf : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (k:Z) (i:Z), (k > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < k)%Z) -> ((mod_func f k i) = (f i)). Axiom shift_mod : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (k:Z) (i:Z), (k > 0%Z)%Z -> ((mod_func f k i) = (shift (((fun (y0:Z -> a) (y1:Z) (y2:Z) => (mod_func y0 y1 y2)) f) k) k i)). Axiom shift_mod_rev : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> a) (k:Z) (i:Z), (k > 0%Z)%Z -> ((shift (((fun (y0:Z -> a) (y1:Z) (y2:Z) => (mod_func y0 y1 y2)) f) k) k i) = (mod_func f k i)). Parameter head_bit: Z -> Z -> Z. Axiom head_bit_def : forall (i:Z) (k:Z), (k > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> ((head_bit i k) = (int.EuclideanDivision.div i (power 2%Z (k - 1%Z)%Z))). Axiom head_bit_spec : forall (i:Z) (k:Z), (k > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> (0%Z <= (head_bit i k))%Z. Axiom head_bit_spec1 : forall (i:Z) (k:Z), (k > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> ((head_bit i k) <= 1%Z)%Z. Parameter tail_bits: Z -> Z -> Z. Axiom tail_bits_def : forall (i:Z) (k:Z), (k > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> ((tail_bits i k) = (int.EuclideanDivision.mod1 i (power 2%Z (k - 1%Z)%Z))). Axiom tail_bits_spec : forall (i:Z) (k:Z), (k > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> (0%Z <= (tail_bits i k))%Z. Axiom tail_bits_spec1 : forall (i:Z) (k:Z), (k > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> ((tail_bits i k) <= (power 2%Z (k - 1%Z)%Z))%Z. Parameter ht_to_int: Z -> Z -> Z -> Z. Axiom ht_to_int_def : forall (hi:Z) (ti:Z) (k:Z), (0%Z < k)%Z -> ((0%Z <= hi)%Z /\ (hi < 2%Z)%Z) -> ((0%Z <= ti)%Z /\ (ti < (power 2%Z (k - 1%Z)%Z))%Z) -> ((ht_to_int hi ti k) = ((hi * (power 2%Z (k - 1%Z)%Z))%Z + ti)%Z). Axiom head_tail_inv : forall (i:Z) (k:Z), (k > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> ((ht_to_int (head_bit i k) (tail_bits i k) k) = i). Axiom ht_to_int_head : forall (i:Z) (ti:Z) (k:Z), (k > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> ((0%Z <= ti)%Z /\ (ti < (power 2%Z (k - 1%Z)%Z))%Z) -> ((head_bit (ht_to_int (head_bit i k) ti k) k) = (head_bit i k)). Axiom ht_to_int_tail : forall (hi:Z) (i:Z) (k:Z), (k > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> ((0%Z <= hi)%Z /\ (hi < 2%Z)%Z) -> ((tail_bits (ht_to_int hi (tail_bits i k) k) k) = (tail_bits i k)). Axiom concat_fun_bin_i : forall (f:Z -> Z) (g:Z -> Z) (i:Z) (k:Z), (binary f) -> (binary g) -> (0%Z <= (concat_fun f g i k))%Z. Axiom concat_fun_bin_i1 : forall (f:Z -> Z) (g:Z -> Z) (i:Z) (k:Z), (binary f) -> (binary g) -> ((concat_fun f g i k) < 2%Z)%Z. Axiom shift_bin_i : forall (f:Z -> Z) (i:Z) (k:Z), (binary f) -> (0%Z <= (shift f i k))%Z. Axiom shift_bin_i1 : forall (f:Z -> Z) (i:Z) (k:Z), (binary f) -> ((shift f i k) < 2%Z)%Z. Axiom concat_fun_bin : forall (f:Z -> Z) (g:Z -> Z) (i:Z), (binary f) -> (binary g) -> binary ((((fun (y0:Z -> Z) (y1:Z -> Z) (y2:Z) (y3:Z) => (concat_fun y0 y1 y2 y3)) f) g) i). Axiom mod_func_bin : forall (f:Z -> Z) (k:Z), (k > 0%Z)%Z -> (binary f) -> binary (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (mod_func y0 y1 y2)) f) k). Axiom shift_bin : forall (f:Z -> Z) (i:Z), (binary f) -> binary (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) f) i). Axiom binary_comp : forall (f:Z -> Z) (g:Z -> Z), (binary f) -> binary (fun (x:Z) => (f (g x))). Axiom set_is_all_binary : forall (t:Z -> Z), (forall (k:Z), (0%Z <= (t k))%Z /\ ((t k) < 2%Z)%Z) -> binary t. Parameter nary_length: Z -> Z -> Z. Axiom nary_length_spec : forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z -> (0%Z < i)%Z -> ((power n ((nary_length i n) - 1%Z)%Z) <= i)%Z. Axiom nary_length_spec1 : forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z -> (0%Z < i)%Z -> (i < (power n (nary_length i n)))%Z. Axiom nary_length_spec2 : forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z -> (i < n)%Z -> ((nary_length i n) = 1%Z). Axiom nary_length_spec3 : forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z -> ((nary_length i n) >= 1%Z)%Z. Axiom nary_length_spec4 : forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z -> (i = (int.EuclideanDivision.mod1 i (power n (nary_length i n)))). Parameter binary_length: Z -> Z. Axiom binary_length_def : forall (i:Z), (0%Z <= i)%Z -> ((binary_length i) = (nary_length i 2%Z)). Axiom binary_length_spec : forall (i:Z), (0%Z <= i)%Z -> (0%Z < i)%Z -> ((power 2%Z ((binary_length i) - 1%Z)%Z) <= i)%Z. Axiom binary_length_spec1 : forall (i:Z), (0%Z <= i)%Z -> (0%Z < i)%Z -> (i < (power 2%Z (binary_length i)))%Z. Axiom binary_length_spec2 : forall (i:Z), (0%Z <= i)%Z -> (i < 2%Z)%Z -> ((binary_length i) = 1%Z). Axiom binary_length_spec3 : forall (i:Z), (0%Z <= i)%Z -> ((binary_length i) >= 1%Z)%Z. Axiom binary_length_spec4 : forall (i:Z), (0%Z <= i)%Z -> (i = (int.EuclideanDivision.mod1 i (power 2%Z (binary_length i)))). Axiom set_binary_length : forall (i:Z) (k:Z), (0%Z <= i)%Z -> (0%Z <= k)%Z -> ~ (0%Z < i)%Z -> ~ (i < 2%Z)%Z -> (k = (binary_length i)). Axiom set_binary_length1 : forall (i:Z) (k:Z), (0%Z <= i)%Z -> (0%Z <= k)%Z -> ~ (0%Z < i)%Z -> (k = 1%Z) -> (k = (binary_length i)). Axiom set_binary_length2 : forall (i:Z) (k:Z), (0%Z <= i)%Z -> (0%Z <= k)%Z -> (((power 2%Z (k - 1%Z)%Z) <= i)%Z /\ (i < (power 2%Z k))%Z) -> ~ (i < 2%Z)%Z -> (k = (binary_length i)). Axiom set_binary_length3 : forall (i:Z) (k:Z), (0%Z <= i)%Z -> (0%Z <= k)%Z -> (((power 2%Z (k - 1%Z)%Z) <= i)%Z /\ (i < (power 2%Z k))%Z) -> (k = 1%Z) -> (k = (binary_length i)). Axiom set_binary_length_b : forall (i:Z) (k:Z), (0%Z <= i)%Z -> (0%Z < k)%Z -> (i < (power 2%Z k))%Z -> ((binary_length i) <= k)%Z. Axiom bitvec : Type. Parameter bitvec_WhyType : WhyType bitvec. Existing Instance bitvec_WhyType. Parameter value: bitvec -> Z -> Z. Parameter length: bitvec -> Z. Axiom bitvec'invariant : forall (self:bitvec), (0%Z <= (length self))%Z. Axiom bitvec'invariant1 : forall (self:bitvec), forall (i:Z), ((0%Z <= i)%Z /\ (i < (length self))%Z) -> (0%Z <= ((value self) i))%Z. Axiom bitvec'invariant2 : forall (self:bitvec), forall (i:Z), ((0%Z <= i)%Z /\ (i < (length self))%Z) -> (((value self) i) < 2%Z)%Z. Axiom bitvec'invariant3 : forall (self:bitvec), forall (i:Z), ~ (0%Z <= i)%Z -> (((value self) i) = 0%Z). Axiom bitvec'invariant4 : forall (self:bitvec), forall (i:Z), ~ (i < (length self))%Z -> (((value self) i) = 0%Z). Parameter bvlength: (Z -> Z) -> Z -> Prop. Axiom bvlength_def : forall (f:Z -> Z) (i:Z), (bvlength f i) -> forall (k:Z), ((0%Z <= k)%Z /\ (k < i)%Z) -> (0%Z <= (f k))%Z. Axiom bvlength_def1 : forall (f:Z -> Z) (i:Z), (bvlength f i) -> forall (k:Z), ((0%Z <= k)%Z /\ (k < i)%Z) -> ((f k) < 2%Z)%Z. Axiom bvlength_def2 : forall (f:Z -> Z) (i:Z), (forall (k:Z), ((0%Z <= k)%Z /\ (k < i)%Z) -> (0%Z <= (f k))%Z /\ ((f k) < 2%Z)%Z) -> bvlength f i. Axiom binary_mult : forall (a:Z) (b:Z), ((int.EuclideanDivision.mod1 (a * b)%Z 2%Z) = ((int.EuclideanDivision.mod1 a 2%Z) * (int.EuclideanDivision.mod1 b 2%Z))%Z). Parameter getbv: bitvec -> Z -> Z. Axiom getbv_def : forall (a:bitvec), ((getbv a) = (value a)). Axiom getbv_spec : forall (a:bitvec), binary (getbv a). Axiom getbv_spec1 : forall (a:bitvec), forall (i:Z), (((getbv a) i) = ((value a) i)). Parameter to_bool: Z -> bool. Axiom to_bool_def : forall (i:Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ~ (i = 0%Z) -> ((to_bool i) = true). Axiom to_bool_def1 : forall (i:Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> (i = 0%Z) -> ((to_bool i) = false). Axiom getbv_bound : forall (bv:bitvec) (i:Z), (0%Z <= ((getbv bv) i))%Z. Axiom getbv_bound1 : forall (bv:bitvec) (i:Z), (((getbv bv) i) < 2%Z)%Z. Axiom getbv_eq : forall (bvx:bitvec) (bvy:bitvec) (i:Z), (bvx = bvy) -> (((getbv bvx) i) = ((getbv bvy) i)). Axiom getbv_eq_gen : forall (bvx:bitvec) (bvy:bitvec) (i:Z) (j:Z), (bvx = bvy) -> (i = j) -> (((getbv bvx) i) = ((getbv bvy) j)). Parameter setbv: (Z -> Z) -> Z -> Z -> Z -> Z. Axiom setbv_def : forall (bv:Z -> Z) (i:Z) (j:Z), let result6 := setbv bv i j in forall (k:Z), ((k = i) -> ((result6 k) = j)) /\ (~ (k = i) -> ((result6 k) = (bv k))). Axiom setbv_spec : forall (bv:Z -> Z) (i:Z) (j:Z), forall (k:Z), ~ (k = i) -> (((setbv bv i j) k) = (bv k)). Axiom setbv_spec1 : forall (bv:Z -> Z) (i:Z) (j:Z), (((setbv bv i j) i) = j). Parameter setbv_int: (Z -> Z) -> (Z -> Z) -> Z -> Z -> Z -> Z. Axiom setbv_int_def : forall (bv1:Z -> Z) (bv2:Z -> Z) (i:Z) (j:Z), let result6 := setbv_int bv1 bv2 i j in forall (k:Z), (((i < k)%Z /\ (k <= j)%Z) -> ((result6 k) = (bv2 (k - i)%Z))) /\ (~ ((i < k)%Z /\ (k <= j)%Z) -> ((result6 k) = (bv1 k))). Axiom setbv_int_spec : forall (bv1:Z -> Z) (bv2:Z -> Z) (i:Z) (j:Z), forall (k:Z), ((i < k)%Z /\ (k <= j)%Z) -> (((setbv_int bv1 bv2 i j) k) = (bv2 (k - i)%Z)). Axiom setbv_int_spec1 : forall (bv1:Z -> Z) (bv2:Z -> Z) (i:Z) (j:Z), forall (k:Z), (k <= i)%Z -> (((setbv_int bv1 bv2 i j) k) = (bv1 k)). Axiom setbv_int_spec2 : forall (bv1:Z -> Z) (bv2:Z -> Z) (i:Z) (j:Z), forall (k:Z), (j < k)%Z -> (((setbv_int bv1 bv2 i j) k) = (bv1 k)). Axiom set_bvlength : forall (bv:bitvec) (i:Z), (forall (k:Z), ((1%Z <= k)%Z /\ (k < i)%Z) -> (0%Z <= ((getbv bv) k))%Z /\ (((getbv bv) k) < 2%Z)%Z) -> bvlength (getbv bv) i. Axiom null_product_bitvec : forall (x:bitvec) (n:Z), (n = (length x)) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv x) i) = 1%Z)) -> ((ind_iproduct (getbv x) 0%Z n) = 1%Z). Axiom non_null_product_bitvec : forall (x:bitvec) (n:Z), (n = (length x)) -> ~ (forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv x) i) = 1%Z)) -> ((ind_iproduct (getbv x) 0%Z n) = 0%Z). Axiom null_product_bitvec_inv : forall (x:bitvec) (n:Z), (n = (length x)) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv x) i) = 0%Z)) -> ((ind_iproduct (fun (i:Z) => (1%Z - ((getbv x) i))%Z) 0%Z n) = 1%Z). Axiom non_null_product_bitvec_inv : forall (x:bitvec) (n:Z), (n = (length x)) -> ~ (forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv x) i) = 0%Z)) -> ((ind_iproduct (fun (i:Z) => (1%Z - ((getbv x) i))%Z) 0%Z n) = 0%Z). Axiom null_product_bitvec_rev : forall (x:bitvec) (n:Z), (n = (length x)) -> ((ind_iproduct (getbv x) 0%Z n) = 1%Z) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv x) i) = 1%Z). Axiom non_null_product_bitvec_rev : forall (x:bitvec) (n:Z), (n = (length x)) -> ((ind_iproduct (getbv x) 0%Z n) = 0%Z) -> ~ (forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv x) i) = 1%Z)). Axiom null_product_bitvec_inv_rev : forall (x:bitvec) (n:Z), (n = (length x)) -> ((ind_iproduct (fun (i:Z) => (1%Z - ((getbv x) i))%Z) 0%Z n) = 1%Z) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv x) i) = 0%Z). Axiom inter1 : forall (x:bitvec) (n:Z) (k:Z), (n = (length x)) -> ((ind_iproduct (fun (i:Z) => (1%Z - ((getbv x) i))%Z) 0%Z n) = 0%Z) -> ((0%Z <= k)%Z /\ (k <= n)%Z) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv x) i) = 0%Z)) -> ((ind_iproduct (fun (i:Z) => (1%Z - ((getbv x) i))%Z) 0%Z k) = 1%Z). Axiom non_null_product_bitvec_inv_rev : forall (x:bitvec) (n:Z), (n = (length x)) -> ((ind_iproduct (fun (i:Z) => (1%Z - ((getbv x) i))%Z) 0%Z n) = 0%Z) -> ~ (forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv x) i) = 0%Z)). Axiom set_flength : forall (f:Z -> Z) (i:Z), (forall (k:Z), ((0%Z <= k)%Z /\ (k < i)%Z) -> (0%Z <= (f k))%Z /\ ((f k) < 2%Z)%Z) -> bvlength f i. Axiom get_bvlength : forall (f:Z -> Z) (i:Z), (bvlength f i) -> forall (k:Z), ((0%Z <= k)%Z /\ (k < i)%Z) -> (0%Z <= (f k))%Z. Axiom get_bvlength1 : forall (f:Z -> Z) (i:Z), (bvlength f i) -> forall (k:Z), ((0%Z <= k)%Z /\ (k < i)%Z) -> ((f k) < 2%Z)%Z. Axiom set_bv_to : forall (f:Z -> Z) (i:Z), (0%Z < i)%Z -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < i)%Z) -> (0%Z <= (f j))%Z /\ ((f j) <= 1%Z)%Z) -> bvlength f i. Axiom set_in_range_val : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> (0%Z <= ((getbv bv) i))%Z. Axiom set_in_range_val1 : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> (((getbv bv) i) < 2%Z)%Z. Axiom bvlengthm : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> bvlength (getbv bv) i. Parameter in_range: bitvec -> Z -> Prop. Axiom in_range_def : forall (bv:bitvec) (r:Z), (in_range bv r) -> (0%Z <= r)%Z. Axiom in_range_def1 : forall (bv:bitvec) (r:Z), (in_range bv r) -> (r < (length bv))%Z. Axiom in_range_def2 : forall (bv:bitvec) (r:Z), ((0%Z <= r)%Z /\ (r < (length bv))%Z) -> in_range bv r. Axiom binary_bv : forall (bv:bitvec) (i:Z), (in_range bv i) -> (0%Z <= ((getbv bv) i))%Z. Axiom binary_bv1 : forall (bv:bitvec) (i:Z), (in_range bv i) -> (((getbv bv) i) <= 1%Z)%Z. Axiom equal_bv : forall (m:bitvec) (n:bitvec), (m = n) -> ((length m) = (length n)). Axiom equal_bv1 : forall (m:bitvec) (n:bitvec), (m = n) -> forall (i:Z), (in_range m i) -> (((getbv m) i) = ((getbv n) i)). Axiom equal_bv2 : forall (m:bitvec) (n:bitvec), (((length m) = (length n)) /\ forall (i:Z), (in_range m i) -> (((getbv m) i) = ((getbv n) i))) -> (m = n). Axiom set_equal_bv : forall (bv:bitvec) (bv':bitvec), ((length bv) = (length bv')) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> (((getbv bv) i) = ((getbv bv') i))) -> (bv = bv'). Axiom get_equal_bv : forall (bv:bitvec) (bv':bitvec), (bv = bv') -> ((length bv) = (length bv')). Axiom get_equal_bv1 : forall (bv:bitvec) (bv':bitvec), (bv = bv') -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> (((getbv bv) i) = ((getbv bv') i)). Parameter make_bv: (Z -> Z) -> Z -> bitvec. Axiom make_bv_spec : forall (f:Z -> Z) (s:Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> (0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> (s >= 0%Z)%Z -> ((length (make_bv f s)) = s). Axiom make_bv_spec1 : forall (f:Z -> Z) (s:Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> (0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> (s >= 0%Z)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> (((getbv (make_bv f s)) i) = (f i)). Axiom make_bv_spec2 : forall (f:Z -> Z) (s:Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> (0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> (s >= 0%Z)%Z -> forall (i:Z), ~ (0%Z <= i)%Z -> (((getbv (make_bv f s)) i) = 0%Z). Axiom make_bv_spec3 : forall (f:Z -> Z) (s:Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> (0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> (s >= 0%Z)%Z -> forall (i:Z), ~ (i < s)%Z -> (((getbv (make_bv f s)) i) = 0%Z). Parameter make_bv_m: (Z -> Z) -> Z -> bitvec. Axiom make_bv_m_def : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> ((make_bv_m f s) = (make_bv (fun (k:Z) => (int.EuclideanDivision.mod1 (f k) 2%Z)) s)). Axiom make_bv_m_spec : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> ((length (make_bv_m f s)) = s). Axiom make_bv_m_spec1 : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> forall (i:Z), bvlength (getbv (make_bv_m f s)) i. Axiom make_bv_m_spec2 : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> forall (k:Z), ((0%Z <= k)%Z /\ (k < s)%Z) -> (((getbv (make_bv_m f s)) k) = (int.EuclideanDivision.mod1 (f k) 2%Z)). Axiom make_bv_m_spec3 : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> forall (k:Z), ~ (0%Z <= k)%Z -> (((getbv (make_bv_m f s)) k) = 0%Z). Axiom make_bv_m_spec4 : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> forall (k:Z), ~ (k < s)%Z -> (((getbv (make_bv_m f s)) k) = 0%Z). Parameter bitvec_null: bitvec. Axiom bitvec_null_def : (bitvec_null = (make_bv (fun (i:Z) => 0%Z) 0%Z)). Axiom assert_make_bv_no_bound : forall (f:Z -> Z) (s:Z) (i:Z), (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < s)%Z) -> (0%Z <= (f i1))%Z /\ ((f i1) < 2%Z)%Z) -> ((1%Z <= i)%Z /\ (i <= s)%Z) -> (((getbv (make_bv f 0%Z)) i) = 0%Z). Axiom make_bv_length : forall (f:Z -> Z) (s:Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> (0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> (s >= 0%Z)%Z -> ((length (make_bv f s)) = s). Axiom assert_make_bv : forall (f:Z -> Z) (s:Z) (i:Z), (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < s)%Z) -> (0%Z <= (f i1))%Z /\ ((f i1) < 2%Z)%Z) -> (0%Z <= s)%Z -> (((0%Z <= i)%Z /\ (i < s)%Z) -> (((getbv (make_bv f s)) i) = (f i))) /\ (~ ((0%Z <= i)%Z /\ (i < s)%Z) -> (((getbv (make_bv f s)) i) = 0%Z)). Axiom assert_make_m : forall (f:Z -> Z) (s:Z) (i:Z), (s >= 0%Z)%Z -> (((0%Z <= i)%Z /\ (i < s)%Z) -> (((getbv (make_bv_m f s)) i) = (int.EuclideanDivision.mod1 (f i) 2%Z))) /\ (~ ((0%Z <= i)%Z /\ (i < s)%Z) -> (((getbv (make_bv_m f s)) i) = 0%Z)). Axiom make_bv_eq : forall (f:Z -> Z) (f':Z -> Z) (n:Z) (n':Z), (n >= 0%Z)%Z -> (n = n') -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> ((f i) = (f' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> ((make_bv f n) = (make_bv f' n')). Axiom assert_make_bv_b : forall (f:Z -> Z) (s:Z) (i:Z), (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < s)%Z) -> (0%Z <= (f i1))%Z /\ ((f i1) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < s)%Z) -> (((getbv (make_bv f s)) i) = (f i)). Axiom assert_make_m_b : forall (f:Z -> Z) (s:Z) (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> (s >= 0%Z)%Z -> (((getbv (make_bv_m f s)) i) = (int.EuclideanDivision.mod1 (f i) 2%Z)). Axiom make_m_bv_length : forall (f:Z -> Z) (s:Z) (i:Z), (s >= 0%Z)%Z -> bvlength (getbv (make_bv_m f s)) i. Axiom make_m_length : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> ((length (make_bv_m f s)) = s). Axiom set_equal_bv_make : forall (f:Z -> Z) (g:Z -> Z) (s:Z), (forall (i:Z), (0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> (s >= 0%Z)%Z -> (forall (i:Z), ((f i) = (g i))) -> ((make_bv f s) = (make_bv g s)). Axiom set_equal_bv_make_ : forall (f:Z -> Z) (g:Z -> Z) (s:Z), (s >= 0%Z)%Z -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> (0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> ((f i) = (g i))) -> ((make_bv f s) = (make_bv g s)). Axiom set_equal_bv_m_make : forall (f:Z -> Z) (g:Z -> Z) (s:Z), (s >= 0%Z)%Z -> (forall (i:Z), ((int.EuclideanDivision.mod1 (f i) 2%Z) = (int.EuclideanDivision.mod1 (g i) 2%Z))) -> ((make_bv_m f s) = (make_bv_m g s)). Axiom make_bv_itself : forall (x:bitvec) (n:Z), ((length x) = n) -> ((make_bv (fun (i:Z) => ((getbv x) i)) n) = x). Parameter head: bitvec -> Z. Axiom head_def : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> ((head bv) = ((getbv bv) 0%Z)). Axiom head_spec : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> (0%Z <= (head bv))%Z. Axiom head_spec1 : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> ((head bv) <= 1%Z)%Z. Parameter makes_bv: (Z -> Z) -> Z -> bitvec. Parameter result6: (Z -> Z) -> Z -> Z. Axiom result_def6 : forall (f:Z -> Z) (i:Z), (((0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> (((result6 f) i) = (f i))) /\ (~ ((0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> (((result6 f) i) = 0%Z)). Axiom makes_bv_def : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> ((makes_bv f s) = (make_bv (result6 f) s)). Axiom makes_bv_spec : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> ((length (makes_bv f s)) = s). Axiom makes_bv_spec1 : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> ((0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> (((getbv (makes_bv f s)) i) = (f i)). Axiom makes_bv_spec2 : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> (0%Z <= (f i))%Z /\ ((f i) < 2%Z)%Z) -> ((makes_bv f s) = (make_bv f s)). Axiom makes_bv_spec3 : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> forall (i:Z), ~ (0%Z <= i)%Z -> (((getbv (makes_bv f s)) i) = 0%Z). Axiom makes_bv_spec4 : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> forall (i:Z), ~ (i < s)%Z -> (((getbv (makes_bv f s)) i) = 0%Z). Axiom assert_makes_bv_c : forall (f:Z -> Z) (s:Z) (i:Z), (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < s)%Z) -> (0%Z <= (f i1))%Z /\ ((f i1) < 2%Z)%Z) -> (0%Z <= s)%Z -> (((0%Z <= i)%Z /\ (i < s)%Z) -> (((getbv (makes_bv f s)) i) = (f i))) /\ (~ ((0%Z <= i)%Z /\ (i < s)%Z) -> (((getbv (makes_bv f s)) i) = 0%Z)). Axiom assert_makes_bv_b : forall (f:Z -> Z) (s:Z) (i:Z), (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < s)%Z) -> (0%Z <= (f i1))%Z /\ ((f i1) < 2%Z)%Z) -> (0%Z <= s)%Z -> ((0%Z <= i)%Z /\ (i < s)%Z) -> (((getbv (makes_bv f s)) i) = (f i)). Axiom assert_makes_bv : forall (f:Z -> Z) (s:Z) (i:Z), (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < s)%Z) -> (0%Z <= (f i1))%Z /\ ((f i1) < 2%Z)%Z) -> (0%Z <= s)%Z -> ((((0%Z <= i)%Z /\ (i < s)%Z) /\ (0%Z <= (f i))%Z) -> (((getbv (makes_bv f s)) i) = (f i))) /\ (~ (((0%Z <= i)%Z /\ (i < s)%Z) /\ (0%Z <= (f i))%Z) -> (((getbv (makes_bv f s)) i) = 0%Z)). Axiom makes_bv_length : forall (f:Z -> Z) (s:Z), (s >= 0%Z)%Z -> ((length (makes_bv f s)) = s). Parameter tail: bitvec -> bitvec. Axiom tail_def : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> ((tail bv) = (make_bv (fun (i:Z) => ((getbv bv) (i + 1%Z)%Z)) ((length bv) - 1%Z)%Z)). Axiom tail_spec : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> ((length (tail bv)) = ((length bv) - 1%Z)%Z). Axiom tail_spec1 : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> forall (i:Z), (in_range (tail bv) i) -> (((getbv (tail bv)) i) = ((getbv bv) (i + 1%Z)%Z)). Parameter concat_l: bitvec -> Z -> bitvec. Parameter result7: bitvec -> Z -> Z -> Z. Axiom result_def7 : forall (bv:bitvec) (i:Z) (k:Z), ((k = 0%Z) -> (((result7 bv i) k) = i)) /\ (~ (k = 0%Z) -> (((result7 bv i) k) = ((getbv bv) (k - 1%Z)%Z))). Axiom concat_l_def : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i <= 1%Z)%Z) -> ((concat_l bv i) = (make_bv (result7 bv i) ((length bv) + 1%Z)%Z)). Axiom concat_l_spec : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i <= 1%Z)%Z) -> ((length (concat_l bv i)) = ((length bv) + 1%Z)%Z). Axiom concat_l_spec1 : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i <= 1%Z)%Z) -> (((getbv (concat_l bv i)) 0%Z) = i). Axiom concat_l_spec2 : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i <= 1%Z)%Z) -> forall (j:Z), (in_range bv j) -> (((getbv (concat_l bv i)) (j + 1%Z)%Z) = ((getbv bv) j)). Axiom concat_l_value : forall (bv:bitvec) (i:Z) (k:Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ((k = 0%Z) -> (((getbv (concat_l bv i)) k) = i)) /\ (~ (k = 0%Z) -> (((0%Z < k)%Z /\ (k <= ((length bv) + 1%Z)%Z)%Z) -> (((getbv (concat_l bv i)) k) = ((getbv bv) (k - 1%Z)%Z))) /\ (~ ((0%Z < k)%Z /\ (k <= ((length bv) + 1%Z)%Z)%Z) -> (((getbv (concat_l bv i)) k) = 0%Z))). Axiom concat_l_value_b : forall (bv:bitvec) (i:Z) (k:Z), ((0%Z <= k)%Z /\ (k < ((length bv) + 1%Z)%Z)%Z) -> ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ((k = 0%Z) -> (((getbv (concat_l bv i)) k) = i)) /\ (~ (k = 0%Z) -> (((getbv (concat_l bv i)) k) = ((getbv bv) (k - 1%Z)%Z))). Axiom concat_ht : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> (bv = (concat_l (tail bv) (head bv))). Axiom concat_ht_union : forall (bv:bitvec), ((length bv) >= 2%Z)%Z -> ~ (bv = (concat_l (tail bv) 0%Z)) -> (bv = (concat_l (tail bv) 1%Z)). Parameter bv_to_int: bitvec -> Z. Parameter result8: bitvec -> Z -> Z. Axiom result_def8 : forall (bv:bitvec) (k:Z), ((in_range bv k) -> (((result8 bv) k) = (((getbv bv) k) * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z)) /\ (~ (in_range bv k) -> (((result8 bv) k) = 1%Z)). Axiom bv_to_int_def : forall (bv:bitvec), ((bv_to_int bv) = (ind_isum (result8 bv) 0%Z (length bv))). Axiom bv_to_int_spec : forall (bv:bitvec), ((bv_to_int bv) = (ind_isum (fun (k:Z) => (((getbv bv) k) * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z) 0%Z (length bv))). Axiom bv_to_int_spec1 : forall (bv:bitvec), (0%Z <= (bv_to_int bv))%Z. Axiom bv_to_int_eq : forall (bv1:bitvec) (bv2:bitvec), (bv1 = bv2) -> ((bv_to_int bv1) = (bv_to_int bv2)). Axiom bv_to_int_sum : forall (bv:bitvec), ((bv_to_int bv) = (ind_isum (fun (k:Z) => (((getbv bv) k) * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z) 0%Z (length bv))). Axiom bv_to_int_sum_inv : forall (bv:bitvec), ((bv_to_int bv) = (ind_isum (fun (k:Z) => (((getbv bv) (((length bv) - 1%Z)%Z - k)%Z) * (power 2%Z k))%Z) 0%Z (length bv))). Axiom bv_to_int_sum_opp : forall (bv:bitvec), ((-(bv_to_int bv))%Z = (ind_isum (fun (k:Z) => ((-((getbv bv) k))%Z * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z) 0%Z (length bv))). Axiom bv_to_int_onebit : forall (bv:bitvec), ((length bv) = 1%Z) -> ((bv_to_int bv) = ((getbv bv) 0%Z)). Axiom ind_isum_bv_rev : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i <= (length bv))%Z) -> ((ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) i (length bv)) = (ind_isum (fun (l:Z) => (((getbv bv) (((length bv) - 1%Z)%Z - l)%Z) * (power 2%Z l))%Z) 0%Z ((length bv) - i)%Z)). Axiom ind_isum_bin_rev : forall (f:Z -> Z) (n:Z) (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (binary f) -> ((ind_isum (fun (l:Z) => ((f l) * (power 2%Z ((n - 1%Z)%Z - l)%Z))%Z) i n) = (ind_isum (fun (l:Z) => ((f ((n - 1%Z)%Z - l)%Z) * (power 2%Z l))%Z) 0%Z (n - i)%Z)). Axiom ind_isum_bin_rev_z : forall (f:Z -> Z) (n:Z), (0%Z <= n)%Z -> (binary f) -> ((ind_isum (fun (l:Z) => ((f l) * (power 2%Z ((n - 1%Z)%Z - l)%Z))%Z) 0%Z n) = (ind_isum (fun (l:Z) => ((f ((n - 1%Z)%Z - l)%Z) * (power 2%Z l))%Z) 0%Z n)). Axiom bv_to_int_sum_rev : forall (bv:bitvec), ((ind_isum (fun (k:Z) => (((getbv bv) (((length bv) - 1%Z)%Z - k)%Z) * (power 2%Z k))%Z) 0%Z (length bv)) = (bv_to_int bv)). Axiom ind_isum_bv_bound_growing : forall (bv:bitvec) (i:Z), ((0%Z < i)%Z /\ (i < (length bv))%Z) -> ((ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z l))%Z) 0%Z i) < (power 2%Z i))%Z. Axiom ind_isum_bv_bound : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> ((ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) i (length bv)) < (power 2%Z ((length bv) - i)%Z))%Z. Axiom ind_isum_bin_bound : forall (f:Z -> Z) (n:Z) (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (binary f) -> ((ind_isum (fun (l:Z) => ((f l) * (power 2%Z ((n - 1%Z)%Z - l)%Z))%Z) i n) < (power 2%Z (n - i)%Z))%Z. Axiom bv_to_int_bound : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> ((bv_to_int bv) < (power 2%Z (length bv)))%Z. Parameter power_: Z -> Z -> Z. Axiom power__def : forall (e:Z) (i:Z), (i >= 0%Z)%Z -> ((power_ e i) = (power e i)). Axiom power__def1 : forall (e:Z) (i:Z), ~ (i >= 0%Z)%Z -> ((power_ e i) = 0%Z). Axiom power_to_ : forall (i:Z) (x:Z), (0%Z <= x)%Z -> ((power i x) = (power_ i x)). Axiom power_no_ : forall (i:Z) (x:Z), (0%Z <= x)%Z -> ((power_ i x) = (power i x)). Axiom power__plus_one : forall (i:Z) (x:Z), (0%Z <= x)%Z -> ((power_ i (x + 1%Z)%Z) = ((power_ i x) * i)%Z). Axiom power__eq : forall (e:Z) (e':Z) (i:Z) (i':Z), (e = e') -> (i = i') -> ((power_ e i) = (power_ e' i')). Axiom power__sum : forall (i:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> ((power_ i (x + y)%Z) = ((power_ i x) * (power_ i y))%Z). Axiom power__sum_rev : forall (i:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> (((power_ i x) * (power_ i y))%Z = (power_ i (x + y)%Z)). Axiom power__mult : forall (i:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> ((power_ i (x * y)%Z) = (power_ (power_ i x) y)). Axiom Power_zero_ : forall (i:Z), ((power_ i 0%Z) = 1%Z). Axiom Power_one_ : forall (i:Z), ((power_ i 1%Z) = i). Axiom Power_sum_ : forall (x:Z) (y:Z) (i:Z), (0%Z <= x)%Z -> (y >= 0%Z)%Z -> ((power_ i (x + y)%Z) = ((power_ i x) * (power_ i y))%Z). Axiom Power_mult_ : forall (x:Z) (y:Z) (i:Z), (x >= 0%Z)%Z -> (y >= 0%Z)%Z -> ((power i (x * y)%Z) = (power (power i x) y)). Axiom Power_pos_ : forall (i:Z), (i >= 0%Z)%Z -> ((power_ i 0%Z) > 0%Z)%Z. Axiom Power_pos_gen_ : forall (i:Z) (j:Z), (i > 0%Z)%Z -> (j >= 0%Z)%Z -> (0%Z < (power_ i j))%Z. Axiom power_two_ : forall (x:Z), (0%Z <= x)%Z -> ((power_ x 2%Z) = (x * x)%Z). Axiom power_plus_one_two : forall (x:Z), (0%Z <= x)%Z -> ((power_ 2%Z (x + 1%Z)%Z) = ((power_ 2%Z x) + (power_ 2%Z x))%Z). Axiom growing_right_power_ : forall (a:Z) (b:Z) (i:Z), (0%Z <= i)%Z -> ((0%Z <= a)%Z /\ (a <= b)%Z) -> ((power_ a i) <= (power_ b i))%Z. Axiom power_of_one_ : forall (a:Z) (b:Z), (0%Z <= b)%Z -> (a = 1%Z) -> ((power_ a b) = 1%Z). Axiom bound_power_ : forall (i:Z) (a:Z) (k:Z) (n:Z), (0%Z < a)%Z -> ((0%Z < k)%Z /\ (k <= n)%Z) -> ((0%Z <= i)%Z /\ (i < (power_ a n))%Z) -> ((int.EuclideanDivision.div i (power_ a (n - k)%Z)) < (power_ a k))%Z. Axiom power_inf : forall (a:Z) (n:Z) (n':Z), (1%Z < a)%Z -> ((0%Z < n)%Z /\ (n < n')%Z) -> ((power_ a n) < (power_ a n'))%Z. Axiom power_leq : forall (a:Z) (n:Z) (n':Z), (0%Z <= a)%Z -> ((0%Z < n)%Z /\ (n <= n')%Z) -> ((power_ a n) <= (power_ a n'))%Z. Axiom power_rises : forall (a:Z) (n:Z), (1%Z < a)%Z -> (1%Z < n)%Z -> (a < (power_ a n))%Z. Axiom int_expo_rises : forall (a:Z) (n:Z), (1%Z < a)%Z -> (1%Z <= n)%Z -> (n < (power_ a n))%Z. Axiom bound_power_2 : forall (i:Z) (n:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z (n + 1%Z)%Z))%Z) -> ((int.EuclideanDivision.div i (power_ 2%Z n)) < 2%Z)%Z. Parameter polysquare: Z -> Z -> Z -> Z -> Z. Axiom polysquare_def : forall (n:Z) (a2:Z) (a1:Z) (a0:Z), (0%Z < n)%Z -> (0%Z <= a2)%Z -> (0%Z <= a1)%Z -> (0%Z <= a0)%Z -> ((polysquare n a2 a1 a0) = (((a2 * (power_ n 2%Z))%Z + (a1 * n)%Z)%Z + a0)%Z). Axiom polysquare_spec : forall (n:Z) (a2:Z) (a1:Z) (a0:Z), (0%Z < n)%Z -> (0%Z <= a2)%Z -> (0%Z <= a1)%Z -> (0%Z <= a0)%Z -> (0%Z <= (polysquare n a2 a1 a0))%Z. Axiom polysquare_leq_trans : forall (n:Z) (a2:Z) (a1:Z) (a0:Z) (b2:Z) (b1:Z) (b0:Z) (pa:Z) (pb:Z) (ps:Z), (0%Z < n)%Z -> (0%Z <= a2)%Z -> (0%Z <= a1)%Z -> (0%Z <= a0)%Z -> (0%Z <= b2)%Z -> (0%Z <= b1)%Z -> (0%Z <= b0)%Z -> (pa <= (polysquare n a2 a1 a0))%Z -> (pb <= (polysquare n b2 b1 b0))%Z -> (ps <= (pa + pb)%Z)%Z -> (ps <= (polysquare n (a2 + b2)%Z (a1 + b1)%Z (a0 + b0)%Z))%Z. Axiom polysquare_leq_trans_sc : forall (n:Z) (a2:Z) (a1:Z) (a0:Z) (b2:Z) (b1:Z) (b0:Z) (pa:Z) (sc:Z) (ps:Z), (0%Z < n)%Z -> (0%Z <= a2)%Z -> (0%Z <= a1)%Z -> (0%Z <= a0)%Z -> (0%Z <= sc)%Z -> ((sc * a2)%Z <= b2)%Z -> ((sc * a1)%Z <= b1)%Z -> ((sc * a0)%Z <= b0)%Z -> (pa <= (polysquare n a2 a1 a0))%Z -> (ps <= (sc * pa)%Z)%Z -> (ps <= (polysquare n b2 b1 b0))%Z. Axiom polysquare_update : forall (na:Z) (nb:Z) (a2:Z) (a1:Z) (a0:Z) (pa:Z), ((0%Z < na)%Z /\ (na <= nb)%Z) -> (0%Z <= a2)%Z -> (0%Z <= a1)%Z -> (0%Z <= a0)%Z -> (pa <= (polysquare na a2 a1 a0))%Z -> (pa <= (polysquare nb a2 a1 a0))%Z. Axiom power__minus_one : forall (i:Z), (0%Z <= i)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) -> ((power_ (-1%Z)%Z i) = (-1%Z)%Z). Axiom power__minus_one1 : forall (i:Z), (0%Z <= i)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) -> ((power_ (-1%Z)%Z i) = 1%Z). Axiom real : forall (x:complex), (real_ x) -> (x = (r_to_c (real_part x))). Axiom pure_im : forall (x:complex), (pure_im_ x) -> (x = (infix_asdt im (r_to_c (im_part x)))). Axiom im_dec : ((real_part im) = 0%R). Axiom im_dec1 : ((im_part im) = 1%R). Axiom c_one_dec : ((real_part c_one) = 1%R). Axiom c_one_dec1 : ((im_part c_one) = 0%R). Axiom c_zero_dec : ((real_part c_zero) = 0%R). Axiom c_zero_dec1 : ((im_part c_zero) = 0%R). Axiom ttwo_dec : ((real_part ttwo) = 2%R). Axiom ttwo_dec1 : ((im_part ttwo) = 0%R). Parameter i_to_c: Z -> complex. Axiom i_to_c_def : forall (i:Z), ((i_to_c i) = (r_to_c (from_int i))). Axiom i_to_c_spec : forall (i:Z), real_ (i_to_c i). Axiom i_to_c_zero : ((i_to_c 0%Z) = c_zero). Axiom i_to_c_surj : forall (i:Z) (j:Z), ~ (i = j) -> ~ ((i_to_c i) = (i_to_c j)). Axiom i_to_c_eq : forall (i:Z) (j:Z), (i = j) -> ((i_to_c i) = (i_to_c j)). Axiom i_to_c_inf : forall (i:Z) (j:Z), (i < j)%Z -> infix_lsdt (i_to_c i) (i_to_c j). Axiom i_to_c_nzero : forall (i:Z), ~ (i = 0%Z) -> ~ ((i_to_c i) = c_zero). Axiom i_to_c_one : ((i_to_c 1%Z) = c_one). Axiom i_to_c_add : forall (i:Z) (j:Z), ((infix_pldt (i_to_c i) (i_to_c j)) = (i_to_c (i + j)%Z)). Axiom i_to_c_add_rev : forall (i:Z) (j:Z), ((i_to_c (i + j)%Z) = (infix_pldt (i_to_c i) (i_to_c j))). Axiom i_to_c_ttwo : ((i_to_c 2%Z) = ttwo). Axiom i_to_c_pos : forall (a:Z), (0%Z <= a)%Z -> infix_lseqdt c_zero (i_to_c a). Axiom i_to_c_minus : forall (a:Z), ((i_to_c (-a)%Z) = (prefix_mndt (i_to_c a))). Axiom i_to_c_strict_pos : forall (a:Z), (0%Z < a)%Z -> infix_lsdt c_zero (i_to_c a). Axiom i_to_c_mult_pos : forall (i:Z) (j:Z), (0%Z <= j)%Z -> ((infix_asdt (i_to_c i) (i_to_c j)) = (i_to_c (i * j)%Z)). Axiom i_to_c_mult : forall (i:Z) (j:Z), ((infix_asdt (i_to_c i) (i_to_c j)) = (i_to_c (i * j)%Z)). Axiom i_to_c_mult_rev : forall (i:Z) (j:Z), ((i_to_c (i * j)%Z) = (infix_asdt (i_to_c i) (i_to_c j))). Axiom i_to_c_mult_assoc : forall (x:complex) (i:Z) (j:Z), ((infix_asdt x (i_to_c (i * j)%Z)) = (infix_asdt (infix_asdt x (i_to_c i)) (i_to_c j))). Axiom i_to_c_mult_assoc_rev : forall (x:complex) (i:Z) (j:Z), ((infix_asdt (infix_asdt x (i_to_c i)) (i_to_c j)) = (infix_asdt x (i_to_c (i * j)%Z))). Axiom i_to_c_sub : forall (i:Z) (j:Z), ((infix_mndt (i_to_c i) (i_to_c j)) = (i_to_c (i - j)%Z)). Axiom i_to_c_opp : forall (i:Z), ((i_to_c (-i)%Z) = (prefix_mndt (i_to_c i))). Axiom i_to_c_div : forall (i:Z) (j:Z), ~ (j = 0%Z) -> ((infix_sldt (i_to_c (i * j)%Z) (i_to_c j)) = (i_to_c i)). Axiom i_to_c_minus_mult : forall (i:Z) (j:Z), ((infix_asdt (i_to_c (-i)%Z) (i_to_c j)) = (infix_asdt (i_to_c i) (i_to_c (-j)%Z))). Axiom i_to_c_div_leq_c_one : forall (a:Z) (b:Z), ((0%Z <= a)%Z /\ (a < b)%Z) -> infix_lseqdt (infix_sldt (i_to_c a) (i_to_c b)) c_one. Axiom compat_i_to_c_infeq : forall (a:Z) (b:Z), (a <= b)%Z -> infix_lseqdt (i_to_c a) (i_to_c b). Axiom compat_i_to_c_inf : forall (a:Z) (b:Z), (a < b)%Z -> infix_lsdt (i_to_c a) (i_to_c b). Axiom compat_i_to_c_supeq : forall (a:Z) (b:Z), (a >= b)%Z -> infix_gteqdt (i_to_c a) (i_to_c b). Axiom compat_i_to_c_sup : forall (a:Z) (b:Z), (a > b)%Z -> infix_gtdt (i_to_c a) (i_to_c b). Axiom positive_int_squrt : forall (i:Z), (i > 0%Z)%Z -> infix_gtdt (square_rt (i_to_c i)) c_zero. Axiom non_null_int_squrt : forall (i:Z), (i > 0%Z)%Z -> ~ ((square_rt (i_to_c i)) = c_zero). Axiom ind_sum_constant : forall (f:Z -> complex) (valu:complex) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = valu)) -> ((ind_sum f i j) = (infix_asdt valu (i_to_c (j - i)%Z))). Axiom ind_sum_constant_from_z : forall (f:Z -> complex) (valu:complex) (j:Z), (0%Z <= j)%Z -> (forall (k:Z), ((0%Z <= k)%Z /\ (k < j)%Z) -> ((f k) = valu)) -> ((ind_sum f 0%Z j) = (infix_asdt valu (i_to_c j))). Axiom sum_constant : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex) (x:complex), (forall (e:a), (mem e s) -> ((t e) = x)) -> ((sum s t) = (infix_asdt (i_to_c (cardinal s)) x)). Axiom ind_sum_constant_case : forall (n:Z) (t:Z -> complex) (p:Z -> bool) (x:complex) (y:complex) (k1:Z), (0%Z <= n)%Z -> ((cardinal (my_filter (to_fset 0%Z n) p)) = k1) -> (forall (e:Z), ((0%Z <= e)%Z /\ (e < n)%Z) -> ((p e) = true) -> ((t e) = x)) -> (forall (e:Z), ((0%Z <= e)%Z /\ (e < n)%Z) -> ~ ((p e) = true) -> ((t e) = y)) -> ((ind_sum t 0%Z n) = (infix_pldt (infix_asdt (i_to_c k1) x) (infix_asdt (i_to_c (n - k1)%Z) y))). Axiom sum_const_one : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (t:a -> complex), (forall (e:a), (mem e s) -> ((t e) = c_one)) -> ((sum s t) = (i_to_c (cardinal s))). Axiom abs_eqinf : forall (x:Z) (y:Z), ((x <= y)%Z /\ (y <= 0%Z)%Z) -> ((ZArith.BinInt.Z.abs x) >= (ZArith.BinInt.Z.abs y))%Z. Axiom abs_inf : forall (x:Z) (y:Z), ((0%Z < x)%Z /\ ((x < y)%Z /\ (y <= 0%Z)%Z)) -> ((ZArith.BinInt.Z.abs x) > (ZArith.BinInt.Z.abs y))%Z. Axiom abs_eqsup : forall (x:Z) (y:Z), ((0%Z >= x)%Z /\ (x >= y)%Z) -> ((ZArith.BinInt.Z.abs x) <= (ZArith.BinInt.Z.abs y))%Z. Axiom abs_sup : forall (x:Z) (y:Z), ((0%Z >= x)%Z /\ (x > y)%Z) -> ((ZArith.BinInt.Z.abs x) < (ZArith.BinInt.Z.abs y))%Z. Axiom inv_negeq : forall (x:Z), (0%Z >= x)%Z -> ((ZArith.BinInt.Z.abs x) >= 0%Z)%Z. Axiom inv_neg1 : forall (x:Z), (0%Z > x)%Z -> ((ZArith.BinInt.Z.abs x) > 0%Z)%Z. Parameter cpower: complex -> Z -> complex. Axiom Cpower_zero : forall (i:complex), ((cpower i 0%Z) = c_one). Axiom Cpower_one : forall (i:complex), ((cpower i 1%Z) = i). Axiom Cpower_sum : forall (i:complex), forall (n:Z) (m:Z), ~ (i = c_zero) -> ((cpower i (n + m)%Z) = (infix_asdt (cpower i n) (cpower i m))). Axiom Cpower_sum1 : forall (i:complex), forall (n:Z) (m:Z), ~ (n = (-m)%Z) -> ((cpower i (n + m)%Z) = (infix_asdt (cpower i n) (cpower i m))). Axiom zero_poower : forall (e:Z), ~ (e = 0%Z) -> ((cpower c_zero e) = c_zero). Axiom cpower_ttwo_two : ((cpower ttwo 2%Z) = (i_to_c 4%Z)). Parameter squarert_two: complex. Axiom squarert_two_def : (squarert_two = (square_rt ttwo)). Axiom real_squarert_two : real_ squarert_two. Axiom squarertTwo : ((cpower squarert_two 2%Z) = ttwo). Axiom complete_rt_two : forall (a:complex), (a = (infix_sldt squarert_two ttwo)) -> ((infix_asdt squarert_two a) = c_one). Axiom cpower_sum : forall (x:complex) (n:Z) (m:Z), ~ (x = c_zero) -> ((cpower x (n + m)%Z) = (infix_asdt (cpower x n) (cpower x m))). Axiom cpower_sum1 : forall (x:complex) (n:Z) (m:Z), ~ (n = (-m)%Z) -> ((cpower x (n + m)%Z) = (infix_asdt (cpower x n) (cpower x m))). Axiom cpower_one : forall (x:complex) (n:Z), (n = 1%Z) -> ((cpower x n) = x). Axiom cpower_two : forall (x:complex) (n:Z), (n = 2%Z) -> ((cpower x n) = (infix_asdt x x)). Axiom cpower_two_rev : forall (x:complex), ((infix_asdt x x) = (cpower x 2%Z)). Axiom cpower_sum_rev : forall (x:complex) (n:Z) (m:Z), ~ (x = c_zero) -> ((infix_asdt (cpower x n) (cpower x m)) = (cpower x (n + m)%Z)). Axiom cpower_sum_rev1 : forall (x:complex) (n:Z) (m:Z), ~ (n = (-m)%Z) -> ((infix_asdt (cpower x n) (cpower x m)) = (cpower x (n + m)%Z)). Axiom cpower_plus_one : forall (e:complex) (i:Z), ~ (e = c_zero) -> ((cpower e (i + 1%Z)%Z) = (infix_asdt (cpower e i) e)). Axiom cpower_plus_one1 : forall (e:complex) (i:Z), ~ (i = (-1%Z)%Z) -> ((cpower e (i + 1%Z)%Z) = (infix_asdt (cpower e i) e)). Axiom cpower_zero : forall (e:complex), ((cpower e 0%Z) = c_one). Axiom cpower_eq : forall (e:complex) (e':complex) (i:Z) (i':Z), (e = e') -> (i = i') -> ((cpower e i) = (cpower e' i')). Axiom cpower_inv : forall (e:complex) (i:Z), ~ (e = c_zero) -> ((infix_asdt (cpower e i) (cpower e (-i)%Z)) = c_one). Axiom compat_cpower_leq : forall (a:complex) (b:complex) (i:Z), ((infix_lseqdt c_zero a) /\ (infix_lseqdt a b)) -> (0%Z <= i)%Z -> infix_lseqdt c_zero (cpower a i). Axiom compat_cpower_leq1 : forall (a:complex) (b:complex) (i:Z), ((infix_lseqdt c_zero a) /\ (infix_lseqdt a b)) -> (0%Z <= i)%Z -> infix_lseqdt (cpower a i) (cpower b i). Axiom cpower_inv_rew : forall (e:complex) (i:Z), ~ (e = c_zero) -> ((cpower e i) = (infix_sldt c_one (cpower e (-i)%Z))). Axiom inv_cpower : forall (e:complex) (i:Z), ~ ((cpower e i) = c_zero) -> ((infix_sldt c_one (cpower e i)) = (cpower e (-i)%Z)). Axiom cpower_div : forall (x:complex) (y:complex) (n:Z), (0%Z <= n)%Z -> ~ (y = c_zero) -> ((cpower (infix_sldt x y) n) = (infix_sldt (cpower x n) (cpower y n))). Axiom cpower_div_rev : forall (x:complex) (y:complex) (n:Z), (0%Z <= n)%Z -> ~ (y = c_zero) -> ((infix_sldt (cpower x n) (cpower y n)) = (cpower (infix_sldt x y) n)). Axiom cpower_pi_bound_square_inv : infix_lseqdt (infix_sldt (i_to_c 4%Z) (cpower pi 2%Z)) c_one. Axiom cpower_mult_split : forall (x:complex) (y:complex) (m:Z), (0%Z <= m)%Z -> ((cpower (infix_asdt x y) m) = (infix_asdt (cpower x m) (cpower y m))). Axiom not_cpower_zero : forall (e:complex) (i:Z), ~ (e = c_zero) -> ~ ((cpower e i) = c_zero). Axiom cpower_inv_out : forall (x:complex) (y:complex), (infix_lsdt c_zero y) -> ((infix_asdt (cpower (infix_asdt (infix_sldt c_one (square_rt y)) x) 2%Z) y) = (cpower x 2%Z)). Axiom squarert_inv : forall (x:complex), (infix_lsdt c_zero x) -> ((infix_sldt c_one (square_rt x)) = (square_rt (infix_sldt c_one x))). Axiom squarert_inv_rev : forall (x:complex), (infix_lsdt c_zero x) -> ((square_rt (infix_sldt c_one x)) = (infix_sldt c_one (square_rt x))). Axiom cpower_squarert_two : forall (i:Z), (0%Z <= i)%Z -> ((cpower squarert_two i) = (square_rt (i_to_c (power_ 2%Z i)))). Axiom cpower_square_rt_raise : forall (x:complex) (y:complex), (infix_lsdt c_zero y) -> ((cpower (infix_sldt x (square_rt y)) 2%Z) = (infix_sldt (infix_asdt (cpower x 2%Z) c_one) y)). Axiom cpower_subst : forall (x:complex) (n:Z) (m:Z), ~ (x = c_zero) -> ((infix_asdt (infix_sldt c_one (cpower x n)) (cpower x m)) = (cpower x (m - n)%Z)). Axiom cpower_c_one_pos : forall (m:Z), (m >= 0%Z)%Z -> ((cpower c_one m) = c_one). Axiom mult_cpower : forall (x:complex) (x':complex) (i:Z), (0%Z <= i)%Z -> ((infix_asdt (cpower x i) (cpower x' i)) = (cpower (infix_asdt x x') i)). Axiom mult_cpower_rev : forall (x:complex) (x':complex) (i:Z), (0%Z <= i)%Z -> ((cpower (infix_asdt x x') i) = (infix_asdt (cpower x i) (cpower x' i))). Axiom cpower_iterate : forall (e:complex) (i:Z), (0%Z <= i)%Z -> ((cpower e i) = (int_iterate (fun (y0:complex) (y1:complex) => (infix_asdt y0 y1)) ((fun (y0:complex) (y1:Z) => (const y0 y1)) e) 0%Z i)). Axiom cpower_modulus : forall (x:complex) (n:Z), (0%Z <= n)%Z -> ((modulus (cpower x n)) = (cpower (modulus x) n)). Axiom cpower_modulus1 : forall (x:complex) (n:Z), (0%Z <= n)%Z -> (n > 0%Z)%Z -> (infix_lsdt (modulus x) c_one) -> infix_lsdt (modulus (cpower x n)) c_one. Axiom cpower_modulus2 : forall (x:complex) (n:Z), (0%Z <= n)%Z -> (n > 0%Z)%Z -> ((modulus x) = c_one) -> ((modulus (cpower x n)) = c_one). Axiom cpower_modulus3 : forall (x:complex) (n:Z), (0%Z <= n)%Z -> (n > 0%Z)%Z -> (infix_gtdt (modulus x) c_one) -> infix_gtdt (modulus (cpower x n)) c_one. Axiom cpower_modulus4 : forall (x:complex) (n:Z), (0%Z <= n)%Z -> (n > 0%Z)%Z -> (infix_lsdt (modulus (cpower x n)) c_one) -> infix_lsdt (modulus x) c_one. Axiom cpower_modulus5 : forall (x:complex) (n:Z), (0%Z <= n)%Z -> (n > 0%Z)%Z -> ((modulus (cpower x n)) = c_one) -> ((modulus x) = c_one). Axiom cpower_modulus6 : forall (x:complex) (n:Z), (0%Z <= n)%Z -> (n > 0%Z)%Z -> (infix_gtdt (modulus (cpower x n)) c_one) -> infix_gtdt (modulus x) c_one. Axiom cpower_mult_pre : forall (x:complex) (n:Z) (m:Z), (0%Z <= m)%Z -> ((cpower x (n * m)%Z) = (cpower (cpower x n) m)). Axiom cpower_mult : forall (x:complex) (n:Z) (m:Z), ((cpower x (n * m)%Z) = (cpower (cpower x n) m)). Axiom cpower_mult_rev : forall (x:complex) (n:Z) (m:Z), ((cpower (cpower x n) m) = (cpower x (n * m)%Z)). Axiom non_zero_cpower_pos : forall (i:complex) (n:Z), ~ (i = c_zero) -> (n >= 0%Z)%Z -> ~ ((cpower i n) = c_zero). Axiom inv_cpower_ : forall (e:complex) (i:Z), ~ (e = c_zero) -> ((infix_sldt c_one (cpower e i)) = (cpower e (-i)%Z)). Axiom zero_cpower_pos : forall (n:Z), (n > 0%Z)%Z -> ((cpower c_zero n) = c_zero). Axiom zero_cpower : forall (n:Z), ~ (n = 0%Z) -> ((cpower c_zero n) = c_zero). Axiom non_zero_cpower : forall (i:complex) (n:Z), ~ (i = c_zero) -> ~ ((cpower i n) = c_zero). Axiom real_cpower_pos : forall (elt:complex) (i:Z), (real_ elt) -> (0%Z <= i)%Z -> real_ (cpower elt i). Axiom real_cpower : forall (elt:complex) (i:Z), (real_ elt) -> real_ (cpower elt i). Axiom real_cpower_is_pos : forall (elt:complex) (i:Z), (real_ elt) -> (infix_lseqdt c_zero elt) -> (0%Z <= i)%Z -> infix_lseqdt c_zero (cpower elt i). Axiom real_cpower_is_strict_pos : forall (elt:complex) (i:Z), (real_ elt) -> (infix_lsdt c_zero elt) -> (0%Z <= i)%Z -> infix_lsdt c_zero (cpower elt i). Axiom real_modulus_square : forall (x:complex), (real_ x) -> ((cpower (modulus x) 2%Z) = (cpower x 2%Z)). Axiom real_modulus_pos : forall (x:complex), (real_ x) -> (infix_gteqdt x c_zero) -> ((modulus x) = x). Parameter conjugate: complex -> complex. Axiom conjugate_def : forall (i:complex), ((conjugate i) = (infix_mndt (t_real_part i) (infix_asdt im (t_im_part i)))). Axiom real_part_conjugate : forall (i:complex), ((t_real_part (conjugate i)) = (t_real_part i)). Axiom im_part_conjugate : forall (i:complex), ((t_im_part (conjugate i)) = (prefix_mndt (t_im_part i))). Axiom invol_conjugate : forall (i:complex), ((conjugate (conjugate i)) = i). Axiom add_conjugate : forall (i:complex) (j:complex), ((conjugate (infix_pldt i j)) = (infix_pldt (conjugate i) (conjugate j))). Axiom add_own_conjugate : forall (i:complex), ((infix_pldt i (conjugate i)) = (infix_asdt ttwo (t_real_part i))). Axiom itself_times_conjugate : forall (i:complex), real_ (infix_asdt i (conjugate i)). Axiom itself_times_conjugate1 : forall (i:complex), ((infix_asdt i (conjugate i)) = (infix_pldt (infix_asdt (t_real_part i) (t_real_part i)) (infix_asdt (t_im_part i) (t_im_part i)))). Axiom conjugate_to_modulus : forall (i:complex), ((modulus i) = (square_rt (infix_asdt i (conjugate i)))). Axiom conjugate_times_itself_pos : forall (i:complex), infix_lseqdt c_zero (infix_asdt i (conjugate i)). Axiom sum_conjugate : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> complex), ((conjugate (sum s f)) = (sum s (fun (x:a) => (conjugate (f x))))). Axiom conjugate_module_one : forall (i:complex), ((modulus i) = c_one) -> ((conjugate i) = (inv i)). Axiom conjugate_module_one_rev : forall (i:complex), ~ (i = c_zero) -> ((conjugate i) = (inv i)) -> ((modulus i) = c_one). Axiom conjugate_real : forall (i:complex), (real_ i) -> ((conjugate i) = i). Axiom conjugate_real_gen : forall (i:complex), (real_ i) -> ((conjugate i) = i). Axiom conjugate_one : forall (x:complex), (x = c_one) -> ((conjugate x) = c_one). Axiom conjugate_c_zero : forall (x:complex), (x = c_zero) -> ((conjugate x) = c_zero). Axiom conjugate_indic : forall {a:Type} {a_WT:WhyType a}, forall (i:a) (j:a), ((conjugate (indic i j)) = (indic i j)). Axiom conjugate_indic_rev : forall {a:Type} {a_WT:WhyType a}, forall (i:a) (j:a), ((indic i j) = (conjugate (indic i j))). Axiom conjugate_indic_gen_int : forall (i:Z) (j:Z), ((conjugate (indic i j)) = (indic i j)). Axiom conjugate_pure_im : forall (i:complex), (pure_im_ i) -> ((conjugate i) = (prefix_mndt i)). Axiom conjugate_im : ((conjugate im) = (prefix_mndt im)). Axiom conjugate_value : forall (c:complex) (a:complex) (b:complex), (real_ a) -> (real_ b) -> (c = (infix_pldt a (infix_asdt im b))) -> ((conjugate c) = (infix_mndt a (infix_asdt im b))). Axiom conjugate_minus_value : forall (c:complex) (a:complex) (b:complex), (real_ a) -> (real_ b) -> (c = (infix_mndt a (infix_asdt im b))) -> ((conjugate c) = (infix_pldt a (infix_asdt im b))). Axiom prod_conjugate : forall (a:complex) (b:complex), ((infix_asdt a (conjugate b)) = (infix_pldt (infix_pldt (infix_asdt (t_real_part a) (t_real_part b)) (infix_asdt (t_im_part a) (t_im_part b))) (infix_asdt im (infix_mndt (infix_asdt (t_real_part b) (t_im_part a)) (infix_asdt (t_im_part b) (t_real_part a)))))). Axiom mult_conjugate : forall (a:complex) (b:complex), ((conjugate (infix_asdt a b)) = (infix_asdt (conjugate a) (conjugate b))). Axiom conjugate_prod : forall (a:complex) (b:complex), ((infix_asdt (conjugate a) b) = (infix_pldt (infix_pldt (infix_asdt (t_real_part a) (t_real_part b)) (infix_asdt (t_im_part a) (t_im_part b))) (infix_asdt im (infix_mndt (infix_asdt (t_real_part a) (t_im_part b)) (infix_asdt (t_real_part b) (t_im_part a)))))). Axiom conj_conj_prod : forall (a:complex) (b:complex), ((conjugate (infix_asdt (conjugate a) b)) = (infix_asdt a (conjugate b))). Axiom conj_prod_conj : forall (a:complex) (b:complex), ((conjugate (infix_asdt a (conjugate b))) = (infix_asdt (conjugate a) b)). Axiom itself_prod_conjugate_modulus_one : forall (a:complex), ((modulus a) = c_one) -> ((infix_asdt a (conjugate a)) = c_one). Axiom conjugate_prod_itself_modulus_one : forall (a:complex), ((modulus a) = c_one) -> ((infix_asdt a (conjugate a)) = c_one). Axiom modulus_opposite : forall (a:complex), (real_ a) -> (infix_lseqdt c_zero a) -> ((modulus a) = (modulus (prefix_mndt a))). Axiom modulus_conjugate : forall (a:complex), ((modulus a) = (modulus (conjugate a))). Axiom modulus_pos1 : forall (a:complex), (real_ a) -> (infix_lseqdt c_zero a) -> ((modulus a) = a). Axiom modulus_neg : forall (a:complex), (real_ a) -> (infix_lseqdt a c_zero) -> ((modulus a) = (prefix_mndt a)). Axiom inv_rewrite : forall (x:complex), ~ (x = c_zero) -> ((infix_sldt c_one x) = (infix_sldt (conjugate x) (cpower (modulus x) 2%Z))). Axiom inv_rewrite1 : forall (x:complex), ~ (x = c_zero) -> ((infix_sldt c_one x) = (infix_asdt (conjugate x) (infix_sldt c_one (cpower (modulus x) 2%Z)))). Axiom inv_modulus : forall (x:complex), ~ (x = c_zero) -> ((modulus (infix_sldt c_one x)) = (infix_sldt c_one (modulus x))). Axiom div_modulus : forall (x:complex) (y:complex), ~ (x = c_zero) -> ((modulus (infix_sldt y x)) = (infix_sldt (modulus y) (modulus x))). Axiom square_frac_modulus : forall (x:complex) (y:complex), ~ (y = c_zero) -> ((cpower (modulus (infix_sldt x y)) 2%Z) = (infix_sldt (cpower (modulus x) 2%Z) (cpower (modulus y) 2%Z))). Axiom modulus_one_decomp : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < (power_ 2%Z n))%Z) -> ((modulus (infix_pldt (infix_sldt (square_rt (i_to_c ((power_ 2%Z n) - k)%Z)) (square_rt (i_to_c (power_ 2%Z n)))) (infix_asdt im (infix_sldt (square_rt (i_to_c k)) (square_rt (i_to_c (power_ 2%Z n))))))) = c_one). Axiom modulus_one_decomp_add : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < (power_ 2%Z n))%Z) -> ((infix_pldt (modulus (infix_sldt (square_rt (i_to_c ((power_ 2%Z n) - k)%Z)) (square_rt (i_to_c (power_ 2%Z n))))) (modulus (infix_sldt (square_rt (i_to_c k)) (square_rt (i_to_c (power_ 2%Z n)))))) = c_one). Axiom extract_2_sq_modulus : forall (x:complex) (y:complex) (a:complex), ~ (a = c_zero) -> ~ (y = c_zero) -> ((infix_sldt (cpower (modulus x) 2%Z) (cpower (modulus y) 2%Z)) = (infix_sldt (infix_asdt a (cpower (modulus x) 2%Z)) (infix_asdt a (cpower (modulus y) 2%Z)))). Axiom cpower_2_modulus_simpl : forall (x:complex) (y:complex) (z:complex), ~ (x = c_zero) -> ~ (y = c_zero) -> ~ (z = c_zero) -> ((infix_sldt (cpower (modulus (infix_asdt x y)) 2%Z) (cpower (modulus (infix_asdt z y)) 2%Z)) = (infix_sldt (cpower (modulus x) 2%Z) (cpower (modulus z) 2%Z))). Axiom cpower_div_leq_one : forall (a:complex) (b:complex) (i:Z), ((infix_lseqdt c_zero a) /\ (infix_lseqdt a b)) -> (infix_lsdt c_zero b) -> (0%Z <= i)%Z -> infix_lseqdt c_zero (infix_sldt (cpower a i) (cpower b i)). Axiom cpower_div_leq_one1 : forall (a:complex) (b:complex) (i:Z), ((infix_lseqdt c_zero a) /\ (infix_lseqdt a b)) -> (infix_lsdt c_zero b) -> (0%Z <= i)%Z -> infix_lseqdt (infix_sldt (cpower a i) (cpower b i)) c_one. Axiom cpower_cpower : forall (x:complex) (a:Z) (b:Z), ((cpower (cpower x a) b) = (cpower x (a * b)%Z)). Axiom pre_cond_int_ : forall (a:complex) (b:complex) (c:complex), (infix_lsdt a b) -> (infix_lsdt c_zero c) -> infix_lsdt (infix_asdt a c) (infix_asdt b c). Axiom growing_mult1 : forall (n:complex) (m:complex), (infix_lseqdt c_zero n) -> (infix_lseqdt c_one m) -> infix_lseqdt n (infix_asdt n m). Axiom strict_growing_mult_pos : forall (n:complex) (m:complex), (infix_lsdt c_one n) -> (infix_lsdt c_one m) -> infix_lsdt n (infix_asdt n m). Axiom init_exp3 : forall (k:complex), ((cpower k 0%Z) = c_one). Axiom init_exp4 : forall (k:complex), ((cpower k 1%Z) = k). Axiom init_exp5 : forall (k:complex), ((cpower k 2%Z) = (infix_asdt k k)). Axiom int_exp_pos : forall (k:complex) (n:Z), (infix_lseqdt c_one k) -> (0%Z <= n)%Z -> infix_gteqdt (cpower k n) c_one. Axiom int_exp_pos1 : forall (k:complex) (n:Z), (infix_lseqdt c_one k) -> (0%Z <= n)%Z -> infix_gtdt (cpower k n) c_zero. Axiom int_exp_pos2 : forall (k:complex) (n:Z), (infix_lseqdt c_one k) -> (0%Z <= n)%Z -> infix_lseqdt (cpower k n) (cpower k (n + 1%Z)%Z). Axiom strict_int_exp_pos : forall (k:complex) (n:Z), (infix_lsdt c_one k) -> (0%Z < n)%Z -> infix_gtdt (cpower k n) c_one. Axiom strict_int_exp_pos1 : forall (k:complex) (n:Z), (infix_lsdt c_one k) -> (0%Z < n)%Z -> infix_lsdt (cpower k (n - 1%Z)%Z) (cpower k n). Axiom strict_int_exp_pos2 : forall (k:complex) (n:Z), (infix_lsdt c_one k) -> (0%Z < n)%Z -> infix_lsdt (cpower k n) (cpower k (n + 1%Z)%Z). Axiom strict_int_exp_neg : forall (k:complex) (n:Z), (infix_lsdt c_one k) -> (n < 0%Z)%Z -> infix_lsdt (cpower k n) c_one. Axiom strict_int_exp_neg1 : forall (k:complex) (n:Z), (infix_lsdt c_one k) -> (n < 0%Z)%Z -> infix_lsdt (cpower k (n - 1%Z)%Z) (cpower k n). Axiom strict_int_exp_neg2 : forall (k:complex) (n:Z), (infix_lsdt c_one k) -> (n < 0%Z)%Z -> infix_lsdt (cpower k n) (cpower k (n + 1%Z)%Z). Axiom int_exp_neg : forall (k:complex) (n:Z), (infix_lseqdt c_one k) -> (n < 0%Z)%Z -> infix_lseqdt (cpower k n) c_one. Axiom int_exp_neg1 : forall (k:complex) (n:Z), (infix_lseqdt c_one k) -> (n < 0%Z)%Z -> infix_gtdt (cpower k n) c_zero. Axiom int_exp_neg2 : forall (k:complex) (n:Z), (infix_lseqdt c_one k) -> (n < 0%Z)%Z -> infix_lseqdt (cpower k n) (cpower k (n + 1%Z)%Z). Axiom positive_exp : forall (k:complex) (m:Z), (infix_lseqdt c_one k) -> infix_lsdt c_zero (cpower k m). Axiom growing_exp_pos : forall (k:complex) (m:Z) (n:Z), (infix_lseqdt c_one k) -> ((0%Z <= m)%Z /\ (m <= n)%Z) -> infix_lseqdt (cpower k m) (cpower k n). Axiom growing_exp1 : forall (k:complex) (m:Z) (n:Z), (infix_lseqdt c_one k) -> (m <= n)%Z -> infix_lseqdt (cpower k m) (cpower k n). Axiom growing_exp_arg : forall (k:complex) (k':complex) (n:Z), ((infix_lseqdt c_zero k) /\ (infix_lseqdt k k')) -> (0%Z <= n)%Z -> infix_lseqdt (cpower k n) (cpower k' n). Axiom strict_growing_exp1 : forall (k:complex) (m:Z) (n:Z), (infix_lsdt c_one k) -> (m < n)%Z -> infix_lsdt (cpower k m) (cpower k n). Axiom cpower_comm_pos : forall (x:complex) (y:complex) (n:Z), (infix_lseqdt c_one x) -> (infix_lseqdt c_one y) -> (0%Z <= n)%Z -> ((cpower (infix_asdt x y) n) = (infix_asdt (cpower x n) (cpower y n))). Axiom cpower_comm : forall (x:complex) (y:complex) (n:Z), (infix_lseqdt c_one x) -> (infix_lseqdt c_one y) -> ((cpower (infix_asdt x y) n) = (infix_asdt (cpower x n) (cpower y n))). Axiom unicity_exp2 : forall (k:complex) (m:Z) (n:Z), (infix_lsdt c_one k) -> ((cpower k m) = (cpower k n)) -> (m = n). Axiom unicity_exp3 : forall (k:complex) (m:Z) (n:Z), (infix_lsdt c_one k) -> (m = n) -> ((cpower k m) = (cpower k n)). Axiom cpower_i_to_c : forall (a:Z) (b:Z), (0%Z <= b)%Z -> ((i_to_c (power_ a b)) = (cpower (i_to_c a) b)). Axiom cpower_i_to_c_rev : forall (a:Z) (b:Z), (0%Z <= b)%Z -> ((cpower (i_to_c a) b) = (i_to_c (power_ a b))). Axiom geometric_series : forall (a:complex) (q:complex) (n:Z), (1%Z <= n)%Z -> ~ (c_one = q) -> ((sum (to_fset 0%Z n) (fun (i:Z) => (infix_asdt a (cpower q i)))) = (infix_sldt (infix_asdt a (infix_mndt c_one (cpower q n))) (infix_mndt c_one q))). Axiom ind_geometric_series_r : forall (a:complex) (q:complex) (n:Z), (n >= 1%Z)%Z -> ~ (c_one = q) -> ((ind_sum (fun (i:Z) => (infix_asdt a (cpower q i))) 0%Z n) = (infix_sldt (infix_asdt a (infix_mndt c_one (cpower q n))) (infix_mndt c_one q))). Axiom ind_geometric_series : forall (q:complex) (n:Z), (n >= 1%Z)%Z -> ~ (c_one = q) -> ((ind_sum (fun (i:Z) => (cpower q i)) 0%Z n) = (infix_sldt (infix_mndt c_one (cpower q n)) (infix_mndt c_one q))). Axiom geometric_series_init_one : forall (q:complex) (n:Z), (n >= 1%Z)%Z -> ~ (c_one = q) -> ((sum (to_fset 0%Z n) (fun (i:Z) => (cpower q i))) = (infix_sldt (infix_mndt c_one (cpower q n)) (infix_mndt c_one q))). Axiom geometric_series_c_one : forall (a:complex) (q:complex) (n:Z), (1%Z <= n)%Z -> (q = c_one) -> ((sum (to_fset 0%Z n) (fun (i:Z) => (infix_asdt a (cpower q i)))) = (infix_asdt a (i_to_c n))). Axiom geometric_series_c_one_init_one : forall (q:complex) (n:Z), (1%Z <= n)%Z -> (q = c_one) -> ((sum (to_fset 0%Z n) (fun (i:Z) => (cpower q i))) = (i_to_c n)). Axiom positive_cpower_2 : forall (x:complex), (real_ x) -> ~ (c_zero = x) -> infix_lsdt c_zero (cpower x 2%Z). Axiom positive_cpower_2_mod : forall (x:complex), infix_lseqdt c_zero (cpower (modulus x) 2%Z). Axiom cpower_2_mod_non_null : forall (x:complex), ~ (x = c_zero) -> infix_lsdt c_zero (cpower (modulus x) 2%Z). Axiom cpower_2_mod_mult_non_null : forall (x:complex) (y:complex), ~ (x = c_zero) -> ~ (y = c_zero) -> infix_lsdt c_zero (cpower (modulus x) 2%Z). Axiom growing_cpower_2 : forall (x:complex) (y:complex), ((infix_lseqdt c_zero x) /\ (infix_lseqdt x y)) -> infix_lseqdt (cpower x 2%Z) (cpower y 2%Z). Axiom cpower_incr_power_2 : forall (k:Z), (0%Z <= k)%Z -> ((cpower (i_to_c (power_ 2%Z k)) 2%Z) = (i_to_c (power_ 2%Z (2%Z * k)%Z))). Axiom cpower_modulus_incr_power_2 : forall (k:Z), (0%Z <= k)%Z -> ((cpower (modulus (i_to_c (power_ 2%Z k))) 2%Z) = (i_to_c (power_ 2%Z (2%Z * k)%Z))). Axiom cpower_modulus_supeq : forall (x:complex) (y:complex) (i:Z), (i >= 1%Z)%Z -> (infix_gteqdt (modulus x) (modulus y)) -> infix_gteqdt (cpower (modulus x) i) (cpower (modulus y) i). Axiom cpower_modulus_div_simpl : forall (x:complex) (y:complex) (z:complex) (i:Z), (i >= 1%Z)%Z -> (infix_lseqdt c_zero x) -> (infix_lsdt c_zero y) -> (infix_lsdt c_zero z) -> ((infix_sldt (cpower x i) (cpower y i)) = (infix_sldt (cpower (modulus (infix_asdt x z)) i) (cpower (modulus (infix_asdt y z)) i))). Axiom cpower_two_modulus_div_simpl : forall (x:complex) (y:complex) (z:complex), (real_ x) -> (real_ y) -> (real_ z) -> ~ (c_zero = y) -> ~ (c_zero = z) -> ((infix_sldt (cpower x 2%Z) (cpower y 2%Z)) = (infix_sldt (cpower (modulus (infix_asdt x z)) 2%Z) (cpower (modulus (infix_asdt y z)) 2%Z))). Parameter exp: complex -> complex. Parameter e: complex. Axiom e_def : (e = (exp c_one)). Axiom e_mod : forall (x:complex), ((modulus (exp x)) = c_one). Axiom e_diff_c_zero : forall (x:complex), ~ ((exp x) = c_zero). Axiom Exp_one : real_ (exp c_one). Axiom Exp_zero : ((exp c_zero) = c_one). Axiom Exp_sum : forall (x:complex) (y:complex), ((exp (infix_pldt x y)) = (infix_asdt (exp x) (exp y))). Axiom exp_one : real_ e. Axiom Exp_quarter_pi : ((exp (infix_sldt (infix_asdt im pi) (i_to_c 4%Z))) = (infix_pldt (infix_sldt squarert_two ttwo) (infix_asdt im (infix_sldt squarert_two ttwo)))). Axiom exp_sum : forall (x:complex) (y:complex), ((exp (infix_pldt x y)) = (infix_asdt (exp x) (exp y))). Axiom exp_eq : forall (t1:complex) (t2:complex), (t1 = t2) -> ((exp t1) = (exp t2)). Axiom exp_sum_rev : forall (x:complex) (y:complex), ((infix_asdt (exp x) (exp y)) = (exp (infix_pldt x y))). Axiom exp_inv : forall (i:complex), ~ ((exp i) = c_zero) -> ((exp (prefix_mndt i)) = (infix_sldt c_one (exp i))). Axiom exp_inv_rev : forall (i:complex), ~ ((exp i) = c_zero) -> ((infix_sldt c_one (exp i)) = (exp (prefix_mndt i))). Axiom exp_mult_pre : forall (x:complex) (y:Z), (y >= 0%Z)%Z -> ((exp (infix_asdt x (i_to_c y))) = (cpower (exp x) y)). Axiom exp_mult : forall (x:complex) (y:Z), ((exp (infix_asdt x (i_to_c y))) = (cpower (exp x) y)). Axiom cpower_to_exp : forall (x:complex) (y:Z), ((cpower (exp x) y) = (exp (infix_asdt x (i_to_c y)))). Axiom exp_h_pi : ((exp (infix_sldt (infix_asdt im pi) ttwo)) = im). Parameter two_pi_i: complex. Axiom two_pi_i_def : (two_pi_i = (infix_asdt (infix_asdt im pi) ttwo)). Axiom exp_pi : ((exp (infix_asdt im pi)) = (prefix_mndt c_one)). Axiom exp_two_pi : ((exp two_pi_i) = c_one). Axiom exp_two_pi_mul : forall (k:Z), ((exp (infix_asdt (i_to_c k) two_pi_i)) = c_one). Axiom exp_two_pi_mul_den : forall (k:Z) (l:Z), ~ (k = 0%Z) -> ((exp (infix_sldt (infix_asdt (i_to_c (k * l)%Z) two_pi_i) (i_to_c k))) = c_one). Axiom exp_two_pi_mul_den_add : forall (k:Z) (l:Z) (m:Z), ((exp (infix_asdt (i_to_c ((k * m)%Z + l)%Z) two_pi_i)) = (exp (infix_asdt (i_to_c l) two_pi_i))). Axiom angle : Type. Parameter angle_WhyType : WhyType angle. Existing Instance angle_WhyType. Parameter ang_inv: angle -> angle. Parameter ang_add: angle -> angle -> angle. Parameter ang_meas: angle -> complex. Axiom ang_meas_spec : forall (o:angle), infix_lseqdt c_zero (ang_meas o). Axiom ang_meas_spec1 : forall (o:angle), infix_lsdt (ang_meas o) c_one. Axiom real_ang_meas : forall (o:angle), real_ (ang_meas o). Parameter real_to_ang: complex -> angle. Parameter ang_zero: angle. Axiom Assoc2 : forall (x:angle) (y:angle) (z:angle), ((ang_add (ang_add x y) z) = (ang_add x (ang_add y z))). Axiom Unit_def_l1 : forall (x:angle), ((ang_add ang_zero x) = x). Axiom Unit_def_r1 : forall (x:angle), ((ang_add x ang_zero) = x). Axiom Inv_def_l1 : forall (x:angle), ((ang_add (ang_inv x) x) = ang_zero). Axiom Inv_def_r1 : forall (x:angle), ((ang_add x (ang_inv x)) = ang_zero). Axiom Comm2 : forall (x:angle) (y:angle), ((ang_add x y) = (ang_add y x)). Axiom Real_To_Ang_one : forall (phi:complex), (real_ phi) -> ((real_to_ang c_one) = ang_zero). Axiom Real_To_Ang_inv : forall (phi:complex), (real_ phi) -> ((ang_inv (real_to_ang phi)) = (real_to_ang (prefix_mndt phi))). Axiom Real_To_Ang_add : forall (phi:complex) (phi':complex), (real_ phi) -> (real_ phi') -> ((ang_add (real_to_ang phi) (real_to_ang phi')) = (real_to_ang (infix_pldt phi phi'))). Axiom meas_value : forall (phi:complex), (real_ phi) -> ((infix_lseqdt c_zero phi) /\ (infix_lsdt phi c_one)) -> ((ang_meas (real_to_ang phi)) = phi). Axiom Equal_angle : forall (o:angle) (o':angle), ((exp (infix_asdt two_pi_i (ang_meas o))) = (exp (infix_asdt two_pi_i (ang_meas o')))) -> (o = o'). Axiom Equal_angle1 : forall (o:angle) (o':angle), (o = o') -> ((exp (infix_asdt two_pi_i (ang_meas o))) = (exp (infix_asdt two_pi_i (ang_meas o')))). Axiom set_equal_angle_meas : forall (o:angle) (o':angle), (o = o') -> ((ang_meas o) = (ang_meas o')). Axiom get_equal_angle_meas : forall (o:angle) (o':angle), ((ang_meas o) = (ang_meas o')) -> (o = o'). Axiom meas_real_to_ang : forall (o:angle), ((real_to_ang (ang_meas o)) = o). Axiom meas_real_to_ang_rev : forall (o:angle), (o = (real_to_ang (ang_meas o))). Axiom ang_add_rev : forall (o:angle) (o':angle), ((ang_add o o') = (ang_add o' o)). Axiom real_to_ang_zero : ((real_to_ang c_zero) = ang_zero). Parameter ang_exp: angle -> complex. Axiom ang_exp_def : forall (o:angle), ((ang_exp o) = (exp (infix_asdt two_pi_i (ang_meas o)))). Axiom ang_exp_spec : forall (o:angle), ~ ((ang_exp o) = c_zero). Axiom set_equal_angle_exp : forall (o:angle) (o':angle), (o = o') -> ((ang_exp o) = (ang_exp o')). Axiom get_equal_angle_exp : forall (o:angle) (o':angle), ((ang_exp o) = (ang_exp o')) -> (o = o'). Axiom meas_value_plus_one : forall (phi:complex), (real_ phi) -> ((exp (infix_asdt two_pi_i (ang_meas (real_to_ang phi)))) = (exp (infix_asdt two_pi_i (infix_pldt (ang_meas (real_to_ang phi)) c_one)))). Axiom ang_exp_pi_over_four : ((ang_exp (real_to_ang (infix_sldt c_one (i_to_c 8%Z)))) = (infix_pldt (infix_sldt squarert_two ttwo) (infix_asdt im (infix_sldt squarert_two ttwo)))). Axiom ang_exp_pi_over_two : ((ang_exp (real_to_ang (infix_sldt c_one (i_to_c 4%Z)))) = im). Axiom ang_exp_pi : ((ang_exp (real_to_ang (infix_sldt c_one (i_to_c 2%Z)))) = (prefix_mndt c_one)). Axiom real_to_ang_c_one : ((real_to_ang c_one) = ang_zero). Axiom set_ang_meas_eq : forall (o:angle) (o':angle), (o = o') -> ((ang_meas o) = (ang_meas o')). Axiom get_ang_meas_eq : forall (o:angle) (o':angle), ((ang_meas o) = (ang_meas o')) -> (o = o'). Axiom ang_exp_zero : ((ang_exp ang_zero) = c_one). Axiom ang_exp_two_pi : ((ang_exp (real_to_ang (i_to_c 1%Z))) = c_one). Axiom ang_exp_c_one : ((ang_exp (real_to_ang c_one)) = c_one). Axiom ang_meas_add_inf_c_one : forall (o:angle) (o':angle), (infix_lsdt (infix_pldt (ang_meas o) (ang_meas o')) c_one) -> ((ang_meas (ang_add o o')) = (infix_pldt (ang_meas o) (ang_meas o'))). Axiom set_ang_exp_eq : forall (o:angle) (o':angle), (o = o') -> ((ang_exp o) = (ang_exp o')). Axiom get_ang_exp_meas_eq : forall (o:angle) (o':angle), ((ang_exp o) = (ang_exp o')) -> ((ang_meas o) = (ang_meas o')). Axiom get_ang_exp_eq : forall (o:angle) (o':angle), ((ang_exp o) = (ang_exp o')) -> (o = o'). Axiom ang_meas_zero : ((ang_meas ang_zero) = c_zero). Axiom real_to_ang_add_one : forall (x:complex), (real_ x) -> ((real_to_ang (infix_pldt x c_one)) = (real_to_ang x)). Parameter truncate: R -> Z. Axiom Truncate_int : forall (i:Z), ((truncate (BuiltIn.IZR i)) = i). Axiom Truncate_down_pos : forall (x:R), (x >= 0%R)%R -> ((BuiltIn.IZR (truncate x)) <= x)%R. Axiom Truncate_down_pos1 : forall (x:R), (x >= 0%R)%R -> (x < (BuiltIn.IZR ((truncate x) + 1%Z)%Z))%R. Axiom Truncate_up_neg : forall (x:R), (x <= 0%R)%R -> ((BuiltIn.IZR ((truncate x) - 1%Z)%Z) < x)%R. Axiom Truncate_up_neg1 : forall (x:R), (x <= 0%R)%R -> (x <= (BuiltIn.IZR (truncate x)))%R. Axiom Real_of_truncate : forall (x:R), ((x - 1%R)%R <= (BuiltIn.IZR (truncate x)))%R. Axiom Real_of_truncate1 : forall (x:R), ((BuiltIn.IZR (truncate x)) <= (x + 1%R)%R)%R. Axiom Truncate_monotonic : forall (x:R) (y:R), (x <= y)%R -> ((truncate x) <= (truncate y))%Z. Axiom Truncate_monotonic_int1 : forall (x:R) (i:Z), (x <= (BuiltIn.IZR i))%R -> ((truncate x) <= i)%Z. Axiom Truncate_monotonic_int2 : forall (x:R) (i:Z), ((BuiltIn.IZR i) <= x)%R -> (i <= (truncate x))%Z. Parameter floor: R -> Z. Parameter ceil: R -> Z. Axiom Floor_int : forall (i:Z), ((floor (BuiltIn.IZR i)) = i). Axiom Ceil_int : forall (i:Z), ((ceil (BuiltIn.IZR i)) = i). Axiom Floor_down : forall (x:R), ((BuiltIn.IZR (floor x)) <= x)%R. Axiom Floor_down1 : forall (x:R), (x < (BuiltIn.IZR ((floor x) + 1%Z)%Z))%R. Axiom Ceil_up : forall (x:R), ((BuiltIn.IZR ((ceil x) - 1%Z)%Z) < x)%R. Axiom Ceil_up1 : forall (x:R), (x <= (BuiltIn.IZR (ceil x)))%R. Axiom Floor_monotonic : forall (x:R) (y:R), (x <= y)%R -> ((floor x) <= (floor y))%Z. Axiom Ceil_monotonic : forall (x:R) (y:R), (x <= y)%R -> ((ceil x) <= (ceil y))%Z. Parameter int_part: complex -> complex. Axiom int_part_def : forall (x:complex), (real_ x) -> ((int_part x) = (i_to_c (floor (real_part x)))). Axiom int_part_spec : forall (x:complex), (real_ x) -> real_ (int_part x). Axiom int_part_spec1 : forall (x:complex), (real_ x) -> exists i:Z, ((int_part x) = (i_to_c i)). Axiom int_part_spec2 : forall (x:complex), (real_ x) -> infix_lseqdt (int_part x) x. Axiom int_part_spec3 : forall (x:complex), (real_ x) -> infix_lsdt x (infix_pldt (int_part x) c_one). Parameter int_part_int: complex -> Z. Axiom int_part_int_def : forall (x:complex), (real_ x) -> ((int_part_int x) = (floor (real_part x))). Axiom int_part_int_spec : forall (x:complex), (real_ x) -> ((i_to_c (int_part_int x)) = (int_part x)). Axiom int_part_int_spec1 : forall (x:complex), (real_ x) -> infix_lseqdt (i_to_c (int_part_int x)) x. Axiom int_part_int_spec2 : forall (x:complex), (real_ x) -> infix_lsdt x (infix_pldt (i_to_c (int_part_int x)) c_one). Parameter dec_part: complex -> complex. Axiom dec_part_def : forall (x:complex), (real_ x) -> ((dec_part x) = (infix_mndt x (int_part x))). Axiom dec_part_spec : forall (x:complex), (real_ x) -> real_ (dec_part x). Axiom dec_part_spec1 : forall (x:complex), (real_ x) -> exists i:Z, ((dec_part x) = (infix_mndt x (i_to_c i))). Axiom dec_part_spec2 : forall (x:complex), (real_ x) -> infix_lseqdt c_zero (dec_part x). Axiom dec_part_spec3 : forall (x:complex), (real_ x) -> infix_lsdt (dec_part x) c_one. Axiom dec_part_decomp : forall (x:complex), (real_ x) -> (x = (infix_pldt (dec_part x) (int_part x))). Axiom dec_part_decomp_rev : forall (x:complex), (real_ x) -> ((infix_pldt (dec_part x) (int_part x)) = x). Axiom dec_part_decomp_int : forall (x:complex), (real_ x) -> (x = (infix_pldt (dec_part x) (i_to_c (int_part_int x)))). Axiom dec_part_decomp_int_rev : forall (x:complex), (real_ x) -> ((infix_pldt (dec_part x) (i_to_c (int_part_int x))) = x). Axiom ang_exp_add_b : forall (o:angle) (o':angle), (infix_lsdt (infix_pldt (ang_meas o) (ang_meas o')) c_one) -> ((ang_exp (ang_add o o')) = (infix_asdt (ang_exp o) (ang_exp o'))). Axiom ang_exp_add_b_rev : forall (o:angle) (o':angle), (infix_lsdt (infix_pldt (ang_meas o) (ang_meas o')) c_one) -> ((infix_asdt (ang_exp o) (ang_exp o')) = (ang_exp (ang_add o o'))). Axiom real_to_ang_add : forall (x:complex) (x':complex), (real_ x) -> (real_ x') -> ((real_to_ang (infix_pldt x x')) = (ang_add (real_to_ang x) (real_to_ang x'))). Axiom real_to_ang_add_rev : forall (x:complex) (x':complex), (real_ x) -> (real_ x') -> ((ang_add (real_to_ang x) (real_to_ang x')) = (real_to_ang (infix_pldt x x'))). Axiom ang_inv_add : forall (o:angle) (o':angle), ((ang_inv (ang_add o o')) = (ang_add (ang_inv o) (ang_inv o'))). Axiom ang_inv_add_rev : forall (o:angle) (o':angle), ((ang_add (ang_inv o) (ang_inv o')) = (ang_inv (ang_add o o'))). Axiom ang_exp_add_pre : forall (o:angle) (o':angle), (infix_lseqdt c_one (infix_pldt (ang_meas o) (ang_meas o'))) -> (infix_lseqdt (ang_meas o) (ang_meas o')) -> ((ang_exp (ang_add o o')) = (infix_asdt (ang_exp o) (ang_exp o'))). Axiom ang_exp_add : forall (o:angle) (o':angle), ((ang_exp (ang_add o o')) = (infix_asdt (ang_exp o) (ang_exp o'))). Axiom ang_meas_add : forall (o:angle) (o':angle), ((real_to_ang (ang_meas (ang_add o o'))) = (ang_add o o')). Axiom ang_exp_add_rev : forall (o:angle) (o':angle), ((infix_asdt (ang_exp o) (ang_exp o')) = (ang_exp (ang_add o o'))). Axiom real_to_ang_int_pre : forall (k:Z), (0%Z <= k)%Z -> ((ang_exp (real_to_ang (i_to_c k))) = c_one). Axiom real_to_ang_int : forall (k:Z), ((ang_exp (real_to_ang (i_to_c k))) = c_one). Axiom real_to_ang_int_ : forall (k:Z), ((real_to_ang (i_to_c k)) = ang_zero). Axiom real_to_ang_value_add : forall (phi:complex) (k:Z), ((infix_lseqdt c_zero phi) /\ (infix_lsdt phi c_one)) -> ((ang_exp (real_to_ang (infix_pldt phi (i_to_c k)))) = (exp (infix_asdt two_pi_i phi))). Axiom real_to_ang_value : forall (phi:complex), (real_ phi) -> ((ang_exp (real_to_ang phi)) = (exp (infix_asdt two_pi_i phi))). Axiom ang_exp_zero_ : ((ang_exp ang_zero) = c_one). Parameter ang_mult_int_: angle -> Z -> angle. Axiom ang_mult_int__def : forall (theta:angle) (i:Z), (0%Z <= i)%Z -> (i = 0%Z) -> ((ang_mult_int_ theta i) = ang_zero). Axiom ang_mult_int__def1 : forall (theta:angle) (i:Z), (0%Z <= i)%Z -> ~ (i = 0%Z) -> ((ang_mult_int_ theta i) = (ang_add (ang_mult_int_ theta (i - 1%Z)%Z) theta)). Axiom ang_mult_int__spec : forall (theta:angle) (i:Z), (0%Z <= i)%Z -> ((ang_mult_int_ theta i) = (real_to_ang (infix_asdt (ang_meas theta) (i_to_c i)))). Parameter ang_mult_int: angle -> Z -> angle. Axiom ang_mult_int_def : forall (theta:angle) (i:Z), (0%Z <= i)%Z -> ((ang_mult_int theta i) = (ang_mult_int_ theta i)). Axiom ang_mult_int_def1 : forall (theta:angle) (i:Z), ~ (0%Z <= i)%Z -> ((ang_mult_int theta i) = (ang_inv (ang_mult_int_ theta (-i)%Z))). Axiom ang_mult_int_to_real_to_ang : forall (theta:angle) (i:Z), ((ang_mult_int theta i) = (real_to_ang (infix_asdt (ang_meas theta) (i_to_c i)))). Axiom ang_mult_int_plus_one_pos : forall (theta:angle) (i:Z), (0%Z < i)%Z -> ((ang_mult_int theta i) = (ang_add (ang_mult_int theta (i - 1%Z)%Z) theta)). Axiom ang_mult_int_inv : forall (theta:angle) (i:Z), (i < 0%Z)%Z -> ((ang_mult_int theta i) = (ang_inv (ang_mult_int theta (-i)%Z))). Axiom real_to_ang_eq : forall (phi:complex) (phi':complex), (real_ phi) -> (phi = phi') -> ((real_to_ang phi) = (real_to_ang phi')). Axiom set_equal_angle_by_exp : forall (o:angle) (o':angle), ((ang_exp o) = (ang_exp o')) -> (o = o'). Axiom real_to_ang_int_dec_part : forall (x:complex), (real_ x) -> ((real_to_ang x) = (real_to_ang (dec_part x))). Axiom set_equal_exp_by_ang : forall (o:angle) (o':angle), (o = o') -> ((ang_exp o) = (ang_exp o')). Parameter int_to_ang: Z -> Z -> angle. Axiom int_to_ang_def : forall (k:Z) (n:Z), (n >= 0%Z)%Z -> ((int_to_ang k n) = (real_to_ang (infix_sldt (i_to_c k) (i_to_c (power_ 2%Z n))))). Axiom int_to_ang_spec : forall (k:Z) (n:Z), (n >= 0%Z)%Z -> ((int_to_ang k n) = (real_to_ang (infix_sldt (i_to_c (int.EuclideanDivision.mod1 k (power_ 2%Z n))) (i_to_c (power_ 2%Z n))))). Axiom int_to_ang_spec1 : forall (k:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= k)%Z /\ (k < (power_ 2%Z n))%Z) -> ((ang_meas (int_to_ang k n)) = (infix_sldt (i_to_c k) (i_to_c (power_ 2%Z n)))). Axiom real_to_ang_inv : forall (x:complex), (real_ x) -> ((real_to_ang (prefix_mndt x)) = (ang_inv (real_to_ang x))). Axiom real_to_ang_inv_rev : forall (x:complex), (real_ x) -> ((ang_inv (real_to_ang x)) = (real_to_ang (prefix_mndt x))). Axiom involutive_ang_inv : forall (o:angle), ((ang_inv (ang_inv o)) = o). Axiom Real_To_Ang_inv_add : forall (phi:complex), (real_ phi) -> ((ang_add (real_to_ang phi) (real_to_ang (prefix_mndt phi))) = ang_zero). Axiom Real_To_Ang_up : forall (phi:complex), (real_ phi) -> ((real_to_ang phi) = (real_to_ang (infix_pldt c_one phi))). Axiom real_To_Ang_cyclic_pos : forall (phi:complex) (k:Z), (real_ phi) -> (0%Z <= k)%Z -> ((real_to_ang phi) = (real_to_ang (infix_pldt (i_to_c k) phi))). Axiom real_To_Ang_cyclic_neg : forall (phi:complex) (k:Z), (real_ phi) -> (0%Z <= k)%Z -> ((real_to_ang (infix_mndt (i_to_c k) phi)) = (real_to_ang (prefix_mndt phi))). Axiom real_to_ang_equiv : forall (x:complex) (x':complex), (real_ x) -> (exists k:Z, (x' = (infix_pldt x (i_to_c k)))) -> ((real_to_ang x) = (real_to_ang x')). Axiom Real_zero_n : ((real_to_ang c_zero) = ang_zero). Axiom real_ang_mult_pos : forall (phi:complex) (i:Z), (real_ phi) -> (0%Z <= i)%Z -> ((ang_mult_int (real_to_ang phi) i) = (real_to_ang (infix_asdt phi (i_to_c i)))). Axiom real_ang_mult : forall (phi:complex) (i:Z), (real_ phi) -> ((ang_mult_int (real_to_ang phi) i) = (real_to_ang (infix_asdt phi (i_to_c i)))). Axiom real_to_ang_down_cucles : forall (phi:complex) (x:complex), (real_ phi) -> (x = c_one) -> ((real_to_ang (infix_mndt phi x)) = (real_to_ang phi)). Parameter odd: Z -> bool. Axiom odd_def : forall (n:Z), ((int.EuclideanDivision.mod1 n 2%Z) = 1%Z) -> ((odd n) = true). Axiom odd_def1 : forall (n:Z), ~ ((int.EuclideanDivision.mod1 n 2%Z) = 1%Z) -> ((odd n) = false). Axiom odd_spec : forall (n:Z), ((odd n) = true) -> (n = ((2%Z * (int.EuclideanDivision.div n 2%Z))%Z + 1%Z)%Z). Axiom odd_spec1 : forall (n:Z), ((odd n) = false) -> (n = (2%Z * (int.EuclideanDivision.div n 2%Z))%Z). Parameter even: Z -> bool. Axiom even_def : forall (n:Z), ((int.EuclideanDivision.mod1 n 2%Z) = 0%Z) -> ((even n) = true). Axiom even_def1 : forall (n:Z), ~ ((int.EuclideanDivision.mod1 n 2%Z) = 0%Z) -> ((even n) = false). Axiom even_spec : forall (n:Z), ((even n) = true) -> ~ ((odd n) = true). Axiom even_spec1 : forall (n:Z), ~ ((odd n) = true) -> ((even n) = true). Axiom even_to_mod : forall (n:Z), ((even n) = true) -> ((int.EuclideanDivision.mod1 n 2%Z) = 0%Z). Axiom even_minus_one : forall (n:Z), (0%Z < n)%Z -> ((even n) = true) -> ((odd (n - 1%Z)%Z) = true). Axiom odd_minus_one : forall (n:Z), (0%Z < n)%Z -> ((odd n) = true) -> ((even (n - 1%Z)%Z) = true). Axiom even_opp : forall (n:Z), ((even n) = true) -> ((even (-n)%Z) = true). Axiom odd_opp : forall (n:Z), ((odd n) = true) -> ((odd (-n)%Z) = true). Axiom odd_to_mod : forall (n:Z), ((odd n) = true) -> ((int.EuclideanDivision.mod1 n 2%Z) = 1%Z). Axiom even_or_odd : forall (n:Z), ((even n) = true) \/ ((odd n) = true). Axiom cpower_minus_c_one : forall (n:Z), (0%Z <= n)%Z -> ((even n) = true) -> ((cpower (prefix_mndt c_one) n) = c_one). Axiom cpower_minus_c_one1 : forall (n:Z), (0%Z <= n)%Z -> ((odd n) = true) -> ((cpower (prefix_mndt c_one) n) = (prefix_mndt c_one)). Axiom cpower_minus_c_one_even : forall (n:Z), (0%Z <= n)%Z -> ((even n) = true) -> ((cpower (prefix_mndt c_one) n) = c_one). Axiom cpower_minus_c_one_odd : forall (n:Z), (0%Z <= n)%Z -> ((odd n) = true) -> ((cpower (prefix_mndt c_one) n) = (prefix_mndt c_one)). Axiom iproduct_extract_const : forall (s:set Z) (f:Z -> Z) (a:Z), ((iproduct s (fun (i:Z) => (a * (f i))%Z)) = ((power_ a (cardinal s)) * (iproduct s f))%Z). Axiom not_null_powers_squarert_two : forall (i:Z), (0%Z <= i)%Z -> ~ ((cpower squarert_two i) = c_zero). Parameter pos_coeff: complex. Axiom pos_coeff_def : (pos_coeff = (infix_sldt c_one squarert_two)). Axiom real_pos_coeff : real_ pos_coeff. Parameter neg_coeff: complex. Axiom neg_coeff_def : (neg_coeff = (infix_sldt (prefix_mndt c_one) squarert_two)). Axiom coeffs : (neg_coeff = (prefix_mndt pos_coeff)). Parameter mop: Z -> complex. Axiom mop_def : forall (i:Z), (0%Z <= i)%Z -> ((mop i) = (cpower (prefix_mndt c_one) i)). Axiom minus_one_power_values : forall (i:Z), (0%Z <= i)%Z -> ((even i) = true) -> ((mop i) = c_one). Axiom minus_one_power_values1 : forall (i:Z), (0%Z <= i)%Z -> ((odd i) = true) -> ((mop i) = (prefix_mndt c_one)). Axiom factors_mop : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> ((mop (i + j)%Z) = (infix_asdt (mop i) (mop j))). Axiom factors_mop_rev : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> ((infix_asdt (mop i) (mop j)) = (mop (i + j)%Z)). Parameter pow_inv_sqrt_2: Z -> complex. Axiom pow_inv_sqrt_2_def : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_sqrt_2 i) = (cpower pos_coeff i)). Axiom pow_inv_sqrt_2_spec : forall (i:Z), (0%Z <= i)%Z -> real_ (pow_inv_sqrt_2 i). Axiom pow_inv_sqrt_2_spec1 : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_sqrt_2 i) = (infix_sldt c_one (square_rt (i_to_c (power 2%Z i))))). Axiom pow_inv_sqrt_2_add : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> ((pow_inv_sqrt_2 (i + j)%Z) = (infix_asdt (pow_inv_sqrt_2 i) (pow_inv_sqrt_2 j))). Parameter pow_inv_2: Z -> complex. Axiom pow_inv_2_def : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_2 i) = (infix_sldt c_one (i_to_c (power 2%Z i)))). Axiom pow_inv_2_spec : forall (i:Z), (0%Z <= i)%Z -> real_ (pow_inv_2 i). Axiom pow_inv_2_spec1 : forall (i:Z), (0%Z <= i)%Z -> infix_gtdt (pow_inv_2 i) c_zero. Axiom pow_inv_2_spec2 : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_2 i) = (pow_inv_sqrt_2 (2%Z * i)%Z)). Axiom pow_inv_2_spec3 : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_2 i) = (infix_asdt (pow_inv_sqrt_2 i) (pow_inv_sqrt_2 i))). Axiom pow_inv_2_leq_c_one : forall (i:Z), (0%Z <= i)%Z -> infix_lseqdt (pow_inv_2 i) c_one. Axiom pow_inv_2_inf_c_one : forall (i:Z), (1%Z <= i)%Z -> infix_lsdt (pow_inv_2 i) c_one. Axiom cpower_pow_inv_2 : forall (i:Z) (k:Z), (1%Z <= i)%Z -> (1%Z <= k)%Z -> ((cpower (pow_inv_2 i) k) = (pow_inv_2 (i * k)%Z)). Axiom cpower_pow_inv_sqrt_2 : forall (i:Z) (k:Z), (1%Z <= i)%Z -> (1%Z <= k)%Z -> ((cpower (pow_inv_sqrt_2 i) k) = (pow_inv_sqrt_2 (i * k)%Z)). Axiom cpower_2_pow_inv_sqrt_2 : forall (i:Z), (1%Z <= i)%Z -> ((cpower (pow_inv_sqrt_2 i) 2%Z) = (pow_inv_2 i)). Axiom pow_inv_2_subst : forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i <= j)%Z) -> ((infix_asdt (pow_inv_2 i) (cpower ttwo j)) = (cpower ttwo (j - i)%Z)). Axiom pow_inv_2_ : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_2 i) = (infix_sldt c_one (i_to_c (power_ 2%Z i)))). Axiom pow_inv_sqrt_2_2_add : ((infix_pldt (pow_inv_sqrt_2 1%Z) (pow_inv_sqrt_2 1%Z)) = squarert_two). Axiom pow_inv_2_cpower : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_2 i) = (infix_sldt c_one (cpower ttwo i))). Axiom matrix : forall (a:Type), Type. Parameter matrix_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (matrix a). Existing Instance matrix_WhyType. Parameter elts: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> Z -> Z -> a. Parameter rows: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> Z. Parameter columns: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> Z. Axiom matrix'invariant : forall {a:Type} {a_WT:WhyType a}, forall (self:matrix a), (0%Z < (rows self))%Z. Axiom matrix'invariant1 : forall {a:Type} {a_WT:WhyType a}, forall (self:matrix a), (0%Z < (columns self))%Z. Parameter valid_index: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> Z -> Z -> Prop. Axiom valid_index_def : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), (valid_index a1 r c) -> (0%Z <= r)%Z. Axiom valid_index_def1 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), (valid_index a1 r c) -> (r < (rows a1))%Z. Axiom valid_index_def2 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), (valid_index a1 r c) -> (0%Z <= c)%Z. Axiom valid_index_def3 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), (valid_index a1 r c) -> (c < (columns a1))%Z. Axiom valid_index_def4 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), (((0%Z <= r)%Z /\ (r < (rows a1))%Z) /\ ((0%Z <= c)%Z /\ (c < (columns a1))%Z)) -> valid_index a1 r c. Parameter equal_size: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> (matrix a) -> Prop. Axiom equal_size_def : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (b:matrix a), (equal_size a1 b) -> ((rows a1) = (rows b)). Axiom equal_size_def1 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (b:matrix a), (equal_size a1 b) -> ((columns a1) = (columns b)). Axiom equal_size_def2 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (b:matrix a), (((rows a1) = (rows b)) /\ ((columns a1) = (columns b))) -> equal_size a1 b. Parameter get: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> Z -> Z -> a. Axiom get_def : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), ((get a1 r c) = (((elts a1) r) c)). Axiom get_spec : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), ((get a1 r c) = (((elts a1) r) c)). Axiom elts_eq : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (b:matrix a), (a1 = b) -> ((elts a1) = (elts b)). Axiom elts_inst_eq : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (b:matrix a) (i:Z) (j:Z), (a1 = b) -> ((0%Z <= i)%Z /\ (i < (rows a1))%Z) -> ((0%Z <= j)%Z /\ (j < (columns a1))%Z) -> ((((elts a1) i) j) = (((elts b) i) j)). Parameter make: forall {a:Type} {a_WT:WhyType a}, Z -> Z -> a -> matrix a. Axiom make_spec : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (v:a), ((r > 0%Z)%Z /\ (c > 0%Z)%Z) -> ((rows (make r c v)) = r). Axiom make_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (v:a), ((r > 0%Z)%Z /\ (c > 0%Z)%Z) -> ((columns (make r c v)) = c). Axiom make_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (v:a), ((r > 0%Z)%Z /\ (c > 0%Z)%Z) -> forall (i:Z) (j:Z), (((0%Z <= i)%Z /\ (i < r)%Z) /\ ((0%Z <= j)%Z /\ (j < c)%Z)) -> ((get (make r c v) i j) = v). Axiom equality : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), (m = n) -> ((rows m) = (rows n)). Axiom equality1 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), (m = n) -> ((columns m) = (columns n)). Axiom equality2 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), (m = n) -> forall (i:Z) (j:Z), (valid_index m i j) -> ((get m i j) = (get n i j)). Axiom equality3 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), ((((rows m) = (rows n)) /\ ((columns m) = (columns n))) /\ forall (i:Z) (j:Z), (valid_index m i j) -> ((get m i j) = (get n i j))) -> (m = n). Axiom make_value : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (i:Z) (j:Z) (v:a), ((r > 0%Z)%Z /\ (c > 0%Z)%Z) -> ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> ((get (make r c v) i j) = v). Parameter mat_indices: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> set (Z* Z)%type. Axiom mat_indices_def : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), ((mat_indices m) = (cartesian_product (to_fset 0%Z (rows m)) (to_fset 0%Z (columns m)))). Axiom mat_indices_spec : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), forall (o:(Z* Z)%type), (mem o (mat_indices m)) -> (0%Z <= (fir o))%Z. Axiom mat_indices_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), forall (o:(Z* Z)%type), (mem o (mat_indices m)) -> ((fir o) < (rows m))%Z. Axiom mat_indices_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), forall (o:(Z* Z)%type), (mem o (mat_indices m)) -> (0%Z <= (sec o))%Z. Axiom mat_indices_spec3 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), forall (o:(Z* Z)%type), (mem o (mat_indices m)) -> ((sec o) < (columns m))%Z. Axiom mat_indices_spec4 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), forall (o:(Z* Z)%type), ((0%Z <= (fir o))%Z /\ ((fir o) < (rows m))%Z) -> ((0%Z <= (sec o))%Z /\ ((sec o) < (columns m))%Z) -> mem o (mat_indices m). Axiom mat_indices_spec5 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), forall (i:Z) (j:Z), (valid_index m i j) -> mem (i, j) (mat_indices m). Axiom mat_indices_spec6 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), forall (i:Z) (j:Z), (mem (i, j) (mat_indices m)) -> valid_index m i j. Parameter set1: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> Z -> Z -> a -> matrix a. Axiom set_spec : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (v:a), (valid_index a1 r c) -> ((rows (set1 a1 r c v)) = (rows a1)). Axiom set_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (v:a), (valid_index a1 r c) -> ((columns (set1 a1 r c v)) = (columns a1)). Axiom set_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (v:a), (valid_index a1 r c) -> forall (i:Z) (j:Z), (valid_index a1 i j) -> (((i = r) /\ (j = c)) -> ((get (set1 a1 r c v) i j) = v)) /\ (~ ((i = r) /\ (j = c)) -> ((get (set1 a1 r c v) i j) = (get a1 i j))). Axiom set_spec3 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (v:a), (valid_index a1 r c) -> ((get (set1 a1 r c v) r c) = v). Axiom set_spec4 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (v:a), (valid_index a1 r c) -> forall (i:Z) (j:Z), (valid_index (set1 a1 r c v) i j) -> ~ (i = r) -> ((get (set1 a1 r c v) i j) = (get a1 i j)). Axiom set_spec5 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (v:a), (valid_index a1 r c) -> forall (i:Z) (j:Z), (valid_index (set1 a1 r c v) i j) -> ~ (j = c) -> ((get (set1 a1 r c v) i j) = (get a1 i j)). Axiom set_valid_index : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows a1))%Z) -> ((0%Z <= j)%Z /\ (j < (columns a1))%Z) -> valid_index a1 i j. Axiom get_valid_index : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), ((rows a1) = r) -> ((columns a1) = c) -> forall (i:Z) (j:Z), (valid_index a1 i j) -> (0%Z <= i)%Z. Axiom get_valid_index1 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), ((rows a1) = r) -> ((columns a1) = c) -> forall (i:Z) (j:Z), (valid_index a1 i j) -> (i < r)%Z. Axiom get_valid_index2 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), ((rows a1) = r) -> ((columns a1) = c) -> forall (i:Z) (j:Z), (valid_index a1 i j) -> (0%Z <= j)%Z. Axiom get_valid_index3 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z), ((rows a1) = r) -> ((columns a1) = c) -> forall (i:Z) (j:Z), (valid_index a1 i j) -> (j < c)%Z. Axiom get_valid_index_params : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (i:Z) (j:Z), ((rows a1) = r) -> ((columns a1) = c) -> (valid_index a1 i j) -> (0%Z <= i)%Z. Axiom get_valid_index_params1 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (i:Z) (j:Z), ((rows a1) = r) -> ((columns a1) = c) -> (valid_index a1 i j) -> (i < r)%Z. Axiom get_valid_index_params2 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (i:Z) (j:Z), ((rows a1) = r) -> ((columns a1) = c) -> (valid_index a1 i j) -> (0%Z <= j)%Z. Axiom get_valid_index_params3 : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (i:Z) (j:Z), ((rows a1) = r) -> ((columns a1) = c) -> (valid_index a1 i j) -> (j < c)%Z. Axiom set_values : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (v:a), (valid_index a1 r c) -> forall (i:Z) (j:Z), (valid_index a1 i j) -> (((i = r) /\ (j = c)) -> ((get (set1 a1 r c v) i j) = v)) /\ (~ ((i = r) /\ (j = c)) -> ((get (set1 a1 r c v) i j) = (get a1 i j))). Axiom set_rows : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (v:a), (valid_index a1 r c) -> ((rows (set1 a1 r c v)) = (rows a1)). Axiom set_columns : forall {a:Type} {a_WT:WhyType a}, forall (a1:matrix a) (r:Z) (c:Z) (v:a), (valid_index a1 r c) -> ((columns (set1 a1 r c v)) = (columns a1)). Parameter make_func: forall {a:Type} {a_WT:WhyType a}, Z -> Z -> (Z -> Z -> a) -> matrix a. Axiom make_func_spec : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a), (r > 0%Z)%Z -> (c > 0%Z)%Z -> ((elts (make_func r c f)) = f). Axiom make_func_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a), (r > 0%Z)%Z -> (c > 0%Z)%Z -> ((rows (make_func r c f)) = r). Axiom make_func_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a), (r > 0%Z)%Z -> (c > 0%Z)%Z -> ((columns (make_func r c f)) = c). Axiom make_func_spec3 : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a), (r > 0%Z)%Z -> (c > 0%Z)%Z -> forall (i:Z) (j:Z), ((get (make_func r c f) i j) = ((f i) j)). Parameter make_f: forall {a:Type} {a_WT:WhyType a}, Z -> Z -> (Z -> Z -> a) -> matrix a. Axiom make_f_def : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a), (r > 0%Z)%Z -> (c > 0%Z)%Z -> ((make_f r c f) = (make_func r c f)). Axiom make_f_spec : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a), (r > 0%Z)%Z -> (c > 0%Z)%Z -> ((rows (make_f r c f)) = r). Axiom make_f_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a), (r > 0%Z)%Z -> (c > 0%Z)%Z -> ((columns (make_f r c f)) = c). Axiom make_f_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a), (r > 0%Z)%Z -> (c > 0%Z)%Z -> forall (i:Z) (j:Z), ((get (make_f r c f) i j) = ((f i) j)). Axiom assert_make : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> ((get (make_f r c f) i j) = ((f i) j)). Axiom assert_make_r : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a), (0%Z < r)%Z -> (0%Z < c)%Z -> ((rows (make_f r c f)) = r). Axiom assert_make_c : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a), (0%Z < r)%Z -> (0%Z < c)%Z -> ((columns (make_f r c f)) = c). Parameter to_indexes: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> set (Z* Z)%type. Axiom to_indexes_def : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), ((to_indexes m) = (cartesian_product (to_fset 0%Z (rows m)) (to_fset 0%Z (columns m)))). Axiom to_indexes_spec : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), ((cardinal (to_indexes m)) = ((rows m) * (columns m))%Z). Axiom set_to_indexes_mem : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> mem (i, j) (to_indexes m). Axiom get_to_indexes_mem : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (o:(Z* Z)%type), (mem o (to_indexes m)) -> (0%Z <= (fir o))%Z. Axiom get_to_indexes_mem1 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (o:(Z* Z)%type), (mem o (to_indexes m)) -> ((fir o) < (rows m))%Z. Axiom get_to_indexes_mem2 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (o:(Z* Z)%type), (mem o (to_indexes m)) -> (0%Z <= (sec o))%Z. Axiom get_to_indexes_mem3 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (o:(Z* Z)%type), (mem o (to_indexes m)) -> ((sec o) < (columns m))%Z. Parameter equal: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> (matrix a) -> Prop. Axiom equal_def : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), (equal m n) -> infix_eqeq m n. Axiom equal_def1 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), (infix_eqeq m n) -> equal m n. Axiom mat_equality : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> (forall (i:Z) (j:Z), (valid_index m i j) -> ((get m i j) = (get n i j))) -> equal m n. Parameter square: forall {a:Type} {a_WT:WhyType a}, (matrix a) -> Prop. Axiom square_def : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), (square m) -> ((rows m) = (columns m)). Axiom square_def1 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), ((rows m) = (columns m)) -> square m. Axiom equal_sym : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), (equal m n) -> equal n m. Axiom equal_sym1 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), (equal n m) -> equal m n. Axiom equal_rex : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a), equal m m. Axiom equal_trans : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a) (o:matrix a), (equal m n) -> (equal n o) -> equal m o. Axiom set_equal_mat : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> (forall (i:Z) (j:Z), (valid_index m i j) -> ((get m i j) = (get n i j))) -> (m = n). Axiom set_equal_mat_make : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a) (g:Z -> Z -> a), (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> (((f i) j) = ((g i) j))) -> ((make_f r c f) = (make_f r c g)). Axiom set_equal_mat_make_t : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (r':Z) (c:Z) (c':Z) (f:Z -> Z -> a) (g:Z -> Z -> a), (0%Z < r)%Z -> (0%Z < c)%Z -> (r = r') -> (c = c') -> (forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> (((f i) j) = ((g i) j))) -> ((make_f r c f) = (make_f r' c' g)). Axiom get_equal_mat : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), (m = n) -> ((rows m) = (rows n)). Axiom get_equal_mat1 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), (m = n) -> ((columns m) = (columns n)). Axiom get_equal_mat2 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix a) (n:matrix a), (m = n) -> forall (i:Z) (j:Z), (valid_index m i j) -> ((get m i j) = (get n i j)). Axiom equal_functions : forall {a:Type} {a_WT:WhyType a}, forall (r:Z) (c:Z) (f:Z -> Z -> a) (g:Z -> Z -> a), (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (i:Z) (j:Z), (((0%Z <= i)%Z /\ (i < r)%Z) /\ ((0%Z <= j)%Z /\ (j < c)%Z)) -> (((f i) j) = ((g i) j))) -> ((make_f r c f) = (make_f r c g)). Axiom equal_functions_mat : forall {a:Type} {a_WT:WhyType a}, forall (f:Z -> Z -> a) (m:matrix a), (forall (i:Z) (j:Z), (((0%Z <= i)%Z /\ (i < (rows m))%Z) /\ ((0%Z <= j)%Z /\ (j < (columns m))%Z)) -> (((f i) j) = (get m i j))) -> (m = (make_f (rows m) (columns m) f)). Parameter null_mat: (matrix complex) -> Prop. Axiom null_mat_def : forall (a:matrix complex), (null_mat a) -> forall (i:Z) (j:Z), (valid_index a i j) -> ((get a i j) = c_zero). Axiom null_mat_def1 : forall (a:matrix complex), (forall (i:Z) (j:Z), (valid_index a i j) -> ((get a i j) = c_zero)) -> null_mat a. Axiom set_null_mat : forall (a:matrix complex), (forall (i:Z) (j:Z), (valid_index a i j) -> ((get a i j) = c_zero)) -> null_mat a. Axiom get_null_mat : forall (a:matrix complex), (null_mat a) -> forall (i:Z) (j:Z), (valid_index a i j) -> ((get a i j) = c_zero). Axiom power_minus_one2 : forall (i:Z), (i >= 0%Z)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) -> ((power (-1%Z)%Z i) = 1%Z). Axiom power_minus_one3 : forall (i:Z), (i >= 0%Z)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) -> ((power (-1%Z)%Z i) = (-1%Z)%Z). Parameter kth_right: Z -> Z -> Z -> (Z -> Z) -> Z. Axiom kth_right_def : forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z -> (forall (l:Z), (((h - k)%Z <= l)%Z /\ (l < h)%Z) -> (0%Z < (f l))%Z) -> ((kth_right i k h f) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.div i (ind_iproduct f ((h - k)%Z + 1%Z)%Z h)) (f (h - k)%Z))). Axiom kth_right_spec : forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z -> (forall (l:Z), (((h - k)%Z <= l)%Z /\ (l < h)%Z) -> (0%Z < (f l))%Z) -> (0%Z <= (kth_right i k h f))%Z. Axiom kth_right_spec1 : forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z -> (forall (l:Z), (((h - k)%Z <= l)%Z /\ (l < h)%Z) -> (0%Z < (f l))%Z) -> ((kth_right i k h f) < (f (h - k)%Z))%Z. Axiom kth_right_eq : forall (i:Z) (k:Z) (h:Z) (f:Z -> Z) (g:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z -> (forall (l:Z), (((h - k)%Z <= l)%Z /\ (l <= h)%Z) -> (0%Z < (f l))%Z) -> (forall (l:Z), (((h - k)%Z <= l)%Z /\ (l <= h)%Z) -> ((f l) = (g l))) -> ((kth_right i k h f) = (kth_right i k h g)). Axiom kth_right_trans : forall (i:Z) (k:Z) (h:Z) (t:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z -> (forall (l:Z), (0%Z < (f l))%Z) -> (0%Z <= h)%Z -> (0%Z <= t)%Z -> ((kth_right (int.EuclideanDivision.div i (ind_iproduct f h (h + t)%Z)) k h f) = (kth_right i (k + t)%Z (h + t)%Z f)). Parameter kth_left: Z -> Z -> Z -> Z -> (Z -> Z) -> Z. Axiom kth_left_def : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (forall (ind:Z), ((l <= ind)%Z /\ (ind < h)%Z) -> (0%Z < (f ind))%Z) -> ((kth_left i k l h f) = (kth_right i (((h - l)%Z - k)%Z + 1%Z)%Z h f)). Axiom kth_left_spec : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (forall (ind:Z), ((l <= ind)%Z /\ (ind < h)%Z) -> (0%Z < (f ind))%Z) -> ((kth_left i k l h f) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.div i (ind_iproduct f (l + k)%Z h)) (f ((l + k)%Z - 1%Z)%Z))). Axiom kth_left_spec1 : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (forall (ind:Z), ((l <= ind)%Z /\ (ind < h)%Z) -> (0%Z < (f ind))%Z) -> (0%Z <= (kth_left i k l h f))%Z. Axiom kth_left_spec2 : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (forall (ind:Z), ((l <= ind)%Z /\ (ind < h)%Z) -> (0%Z < (f ind))%Z) -> ((kth_left i k l h f) < (f ((l + k)%Z - 1%Z)%Z))%Z. Axiom kth_left_eq : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z) (g:Z -> Z), (0%Z <= i)%Z -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (0%Z <= l)%Z -> (forall (ind:Z), ((l <= ind)%Z /\ (ind < h)%Z) -> ((f ind) = (g ind)) /\ ((g ind) > 0%Z)%Z) -> ((kth_left i k l h f) = (kth_left i k l h g)). Axiom kth_left_to_mod_div : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (forall (ind:Z), ((l <= ind)%Z /\ (ind <= h)%Z) -> ((f ind) > 0%Z)%Z) -> ((kth_left i k l h f) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.div i (ind_iproduct f (l + k)%Z h)) (f ((l + k)%Z - 1%Z)%Z))). Axiom kth_left_trans : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z -> ((1%Z <= k)%Z /\ (k < (h - l)%Z)%Z) -> (forall (ind:Z), ((l <= ind)%Z /\ (ind <= h)%Z) -> ((f ind) > 0%Z)%Z) -> ((kth_left i k l h f) = (kth_left (int.EuclideanDivision.div i (f (h - 1%Z)%Z)) k l (h - 1%Z)%Z f)). Axiom div_isum_exponents : forall (i:Z) (k:Z) (n:Z) (m:Z), (0%Z <= i)%Z -> (0%Z < k)%Z -> (0%Z <= n)%Z -> (0%Z <= m)%Z -> ((power k (n + m)%Z) = ((power k n) * (power k m))%Z). Axiom div_isum_exponents1 : forall (i:Z) (k:Z) (n:Z) (m:Z), (0%Z <= i)%Z -> (0%Z < k)%Z -> (0%Z <= n)%Z -> (0%Z <= m)%Z -> ((power k (n + 1%Z)%Z) = ((power k n) * k)%Z). Axiom div_isum_exponents2 : forall (i:Z) (k:Z) (n:Z) (m:Z), (0%Z <= i)%Z -> (0%Z < k)%Z -> (0%Z <= n)%Z -> (0%Z <= m)%Z -> ((power k 1%Z) = k). Axiom div_isum_exponents3 : forall (i:Z) (k:Z) (n:Z) (m:Z), (0%Z <= i)%Z -> (0%Z < k)%Z -> (0%Z <= n)%Z -> (0%Z <= m)%Z -> ((int.EuclideanDivision.div (int.EuclideanDivision.div i (power k n)) (power k m)) = (int.EuclideanDivision.div i (power k (n + m)%Z))). Axiom div_isum_exponents4 : forall (i:Z) (k:Z) (n:Z) (m:Z), (0%Z <= i)%Z -> (0%Z < k)%Z -> (0%Z <= n)%Z -> (0%Z <= m)%Z -> ((int.EuclideanDivision.div (int.EuclideanDivision.div i (power k n)) k) = (int.EuclideanDivision.div i (power k (n + 1%Z)%Z))). Parameter divp: Z -> Z -> Z. Axiom divp_def : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> ((divp i j) = ((int.EuclideanDivision.div i j) * j)%Z). Axiom divp_spec : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (i = ((divp i j) + (int.EuclideanDivision.mod1 i j))%Z). Axiom divp_spec1 : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> ((divp i j) <= i)%Z. Axiom divp_spec2 : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (i < (((divp i j) + 1%Z)%Z * j)%Z)%Z. Axiom divp_spec3 : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (i > j)%Z -> ((divp i j) > 0%Z)%Z. Axiom kth_right_div_mod : forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z -> (forall (k1:Z), (0%Z < (f k1))%Z) -> ((kth_right i k h f) = (int.EuclideanDivision.div (int.EuclideanDivision.mod1 i (ind_iproduct f (h - k)%Z h)) (ind_iproduct f ((h - k)%Z + 1%Z)%Z h))). Axiom kth_head : forall (i:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= h)%Z -> (forall (k:Z), (0%Z < (f k))%Z) -> ((kth_right i 1%Z h f) = (int.EuclideanDivision.mod1 i (f (h - 1%Z)%Z))). Parameter weighted_kth_right: Z -> Z -> Z -> (Z -> Z) -> Z. Axiom weighted_kth_right_def : forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (forall (k1:Z), (0%Z < (f k1))%Z) -> (1%Z <= k)%Z -> ((weighted_kth_right i k h f) = ((kth_right i k h f) * (ind_iproduct f ((h - k)%Z + 1%Z)%Z h))%Z). Axiom weighted_kth_right_ : forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (1%Z <= k)%Z -> (0%Z <= i)%Z -> (forall (k1:Z), (0%Z < (f k1))%Z) -> ((int.EuclideanDivision.mod1 i (ind_iproduct f (h - k)%Z h)) = ((weighted_kth_right i k h f) + (int.EuclideanDivision.mod1 i (ind_iproduct f ((h - k)%Z + 1%Z)%Z h)))%Z). Axiom kth_right_decomposition : forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z -> (forall (k1:Z), (0%Z < (f k1))%Z) -> ((int.EuclideanDivision.mod1 i (ind_iproduct f (h - k)%Z h)) = (ind_isum (fun (a:Z) => (weighted_kth_right i a h f)) 1%Z (k + 1%Z)%Z)). Axiom kth_left_div_mod : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> ((0%Z <= l)%Z /\ (l <= h)%Z) -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (forall (k1:Z), (0%Z < (f k1))%Z) -> ((kth_left i k l h f) = (int.EuclideanDivision.div (int.EuclideanDivision.mod1 i (ind_iproduct f ((l + k)%Z - 1%Z)%Z h)) (ind_iproduct f (l + k)%Z h))). Parameter weighted_kth_left: Z -> Z -> Z -> Z -> (Z -> Z) -> Z. Axiom weighted_kth_left_def : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (l <= h)%Z -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (forall (k1:Z), (0%Z < (f k1))%Z) -> ((weighted_kth_left i k l h f) = (weighted_kth_right i (((h - l)%Z - k)%Z + 1%Z)%Z h f)). Axiom weighted_kth_left_ : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (l <= h)%Z -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (forall (k1:Z), (0%Z < (f k1))%Z) -> ((int.EuclideanDivision.mod1 i (ind_iproduct f ((l + k)%Z - 1%Z)%Z h)) = ((weighted_kth_left i k l h f) + (int.EuclideanDivision.mod1 i (ind_iproduct f (l + k)%Z h)))%Z). Axiom bounded_kth_left_decomposition : forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (l <= h)%Z -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (forall (k1:Z), (0%Z < (f k1))%Z) -> ((int.EuclideanDivision.mod1 i (ind_iproduct f ((l + k)%Z - 1%Z)%Z h)) = (ind_isum (fun (a:Z) => (weighted_kth_left i a l h f)) k ((h - l)%Z + 1%Z)%Z)). Axiom kth_left_decomposition : forall (i:Z) (l:Z) (h:Z) (f:Z -> Z), ((0%Z <= i)%Z /\ (i < (ind_iproduct f l h))%Z) -> (l < h)%Z -> (forall (k:Z), (0%Z < (f k))%Z) -> (i = (ind_isum (fun (a:Z) => (weighted_kth_left i a l h f)) 1%Z ((h - l)%Z + 1%Z)%Z)). Parameter kronecker_neutral: matrix complex. Axiom kronecker_neutral_def : (kronecker_neutral = (make 1%Z 1%Z c_one)). Parameter identity: Z -> matrix complex. Parameter result9: Z -> Z -> complex. Axiom result_def9 : forall (i:Z) (j:Z), ((i = j) -> (((result9 i) j) = c_one)) /\ (~ (i = j) -> (((result9 i) j) = c_zero)). Axiom identity_def : forall (n:Z), (0%Z <= n)%Z -> ((identity n) = (make_f (power 2%Z n) (power 2%Z n) result9)). Axiom identity_spec : forall (n:Z), (0%Z <= n)%Z -> ((rows (identity n)) = (power 2%Z n)). Axiom identity_spec1 : forall (n:Z), (0%Z <= n)%Z -> ((columns (identity n)) = (power 2%Z n)). Axiom identity_spec2 : forall (n:Z), (0%Z <= n)%Z -> forall (i:Z) (j:Z), (valid_index (identity n) i j) -> ((i = j) -> ((get (identity n) i j) = c_one)) /\ (~ (i = j) -> ((get (identity n) i j) = c_zero)). Axiom identity_rows : forall (n:Z), (0%Z <= n)%Z -> ((rows (identity n)) = (power 2%Z n)). Axiom identity_columns : forall (n:Z), (0%Z <= n)%Z -> ((columns (identity n)) = (power 2%Z n)). Axiom identity_values : forall (i:Z) (j:Z) (n:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> ((i = j) -> ((get (identity n) i j) = c_one)) /\ (~ (i = j) -> ((get (identity n) i j) = c_zero)). Parameter kronecker: (matrix complex) -> (matrix complex) -> matrix complex. Axiom kronecker_def : forall (m:matrix complex) (n:matrix complex), ((kronecker m n) = (make_f ((rows m) * (rows n))%Z ((columns m) * (columns n))%Z (fun (i:Z) (j:Z) => (infix_asdt (get m (int.EuclideanDivision.div i (rows n)) (int.EuclideanDivision.div j (columns n))) (get n (int.EuclideanDivision.mod1 i (rows n)) (int.EuclideanDivision.mod1 j (columns n))))))). Axiom kronecker_spec : forall (m:matrix complex) (n:matrix complex), ((rows (kronecker m n)) = ((rows m) * (rows n))%Z). Axiom kronecker_spec1 : forall (m:matrix complex) (n:matrix complex), ((columns (kronecker m n)) = ((columns m) * (columns n))%Z). Axiom kronecker_spec2 : forall (m:matrix complex) (n:matrix complex), forall (i:Z) (j:Z), (valid_index (kronecker m n) i j) -> ((get (kronecker m n) i j) = (infix_asdt (get m (int.EuclideanDivision.div i (rows n)) (int.EuclideanDivision.div j (columns n))) (get n (int.EuclideanDivision.mod1 i (rows n)) (int.EuclideanDivision.mod1 j (columns n))))). Axiom kronecker_eq : forall (m1:matrix complex) (n1:matrix complex) (m2:matrix complex) (n2:matrix complex), (m1 = m2) -> (n1 = n2) -> ((kronecker m1 n1) = (kronecker m2 n2)). Axiom get_kronecker : forall (m:matrix complex) (n:matrix complex), ((kronecker m n) = (make_f ((rows m) * (rows n))%Z ((columns m) * (columns n))%Z (fun (i:Z) (j:Z) => (infix_asdt (get m (int.EuclideanDivision.div i (rows n)) (int.EuclideanDivision.div j (columns n))) (get n (int.EuclideanDivision.mod1 i (rows n)) (int.EuclideanDivision.mod1 j (columns n))))))). Axiom kronecker_values : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), (valid_index (kronecker m n) i j) -> ((get (kronecker m n) i j) = (infix_asdt (get m (int.EuclideanDivision.div i (rows n)) (int.EuclideanDivision.div j (columns n))) (get n (int.EuclideanDivision.mod1 i (rows n)) (int.EuclideanDivision.mod1 j (columns n))))). Axiom kronecker_rows : forall (m:matrix complex) (n:matrix complex), ((rows (kronecker m n)) = ((rows m) * (rows n))%Z). Axiom kronecker_columns : forall (m:matrix complex) (n:matrix complex), ((columns (kronecker m n)) = ((columns m) * (columns n))%Z). Axiom kronecker_values_gen : forall (m:matrix complex) (n:matrix complex), forall (i:Z) (j:Z), (valid_index (kronecker m n) i j) -> ((get (kronecker m n) i j) = (infix_asdt (get m (int.EuclideanDivision.div i (rows n)) (int.EuclideanDivision.div j (columns n))) (get n (int.EuclideanDivision.mod1 i (rows n)) (int.EuclideanDivision.mod1 j (columns n))))). Axiom kronecker_mod_values : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), (valid_index (kronecker m n) i j) -> ((get (kronecker m n) i j) = (infix_asdt (get m (int.EuclideanDivision.div (int.EuclideanDivision.mod1 i (rows (kronecker m n))) (rows n)) (int.EuclideanDivision.div (int.EuclideanDivision.mod1 j (columns (kronecker m n))) (columns n))) (get n (int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (rows (kronecker m n))) (rows n)) (int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 j (columns (kronecker m n))) (columns n))))). Axiom kronecker_indexes : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z) (k:Z) (l:Z), (valid_index m i j) -> (valid_index n k l) -> valid_index (kronecker m n) ((i * (rows n))%Z + k)%Z ((j * (columns n))%Z + l)%Z. Axiom kronecker_indexes_com : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), (valid_index (kronecker m n) i j) -> valid_index m (int.EuclideanDivision.div i (rows n)) (int.EuclideanDivision.div j (columns n)). Axiom kronecker_indexes_com1 : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), (valid_index (kronecker m n) i j) -> valid_index n (int.EuclideanDivision.mod1 i (rows n)) (int.EuclideanDivision.mod1 j (columns n)). Axiom kronecker_assoc_pre : forall (m:matrix complex) (n:matrix complex) (o:matrix complex) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (((rows m) * (rows n))%Z * (rows o))%Z)%Z) -> ((0%Z <= j)%Z /\ (j < (((columns m) * (columns n))%Z * (columns o))%Z)%Z) -> ((get (kronecker (kronecker m n) o) i j) = (get (kronecker m (kronecker n o)) i j)). Axiom kronecker_assoc : op_assoc (fun (y0:matrix complex) (y1:matrix complex) => (kronecker y0 y1)). Axiom kronecker_assoc_use : forall (a:matrix complex) (b:matrix complex) (c:matrix complex), ((kronecker a (kronecker b c)) = (kronecker (kronecker a b) c)). Axiom kronecker_assoc_use_rev : forall (a:matrix complex) (b:matrix complex) (c:matrix complex), ((kronecker (kronecker a b) c) = (kronecker a (kronecker b c))). Axiom neutral_ : forall (m:matrix complex), ((kronecker m kronecker_neutral) = m). Axiom neutral_1 : forall (m:matrix complex), ((kronecker kronecker_neutral m) = m). Axiom neutral1 : (kronecker_neutral = (neutral_elt (fun (y0:matrix complex) (y1:matrix complex) => (kronecker y0 y1)))). Axiom neutral2 : has_neutral (fun (y0:matrix complex) (y1:matrix complex) => (kronecker y0 y1)). Axiom neutral3 : iterable (fun (y0:matrix complex) (y1:matrix complex) => (kronecker y0 y1)). Axiom kronecker_equal : forall (m:matrix complex) (ml:matrix complex) (n:matrix complex) (nl:matrix complex), (equal m ml) -> (equal n nl) -> equal (kronecker m n) (kronecker ml nl). Axiom kron_id : forall (m:Z) (n:Z), (0%Z <= m)%Z -> (0%Z <= n)%Z -> ((kronecker (identity m) (identity n)) = (identity (m + n)%Z)). Parameter frows: (Z -> matrix complex) -> Z -> Z. Axiom frows_def : forall (f:Z -> matrix complex) (k:Z), ((frows f k) = (rows (f k))). Axiom frows_spec : forall (f:Z -> matrix complex) (k:Z), ((frows f k) > 0%Z)%Z. Parameter fcolumns: (Z -> matrix complex) -> Z -> Z. Axiom fcolumns_def : forall (f:Z -> matrix complex) (k:Z), ((fcolumns f k) = (columns (f k))). Axiom fcolumns_spec : forall (f:Z -> matrix complex) (k:Z), ((fcolumns f k) > 0%Z)%Z. Axiom const_fcol : forall (m:matrix complex) (k:Z), ((fcolumns ((fun (y0:matrix complex) (y1:Z) => (const y0 y1)) m) k) = (columns m)). Axiom const_frows : forall (m:matrix complex) (k:Z), ((frows ((fun (y0:matrix complex) (y1:Z) => (const y0 y1)) m) k) = (rows m)). Parameter mat_mult_no_bound: (matrix complex) -> (matrix complex) -> matrix complex. Axiom mat_mult_no_bound_def : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> ((mat_mult_no_bound m n) = (make_f (rows m) (columns n) (fun (i:Z) (j:Z) => (ind_sum (fun (k:Z) => (infix_asdt (get m i k) (get n k j))) 0%Z (columns m))))). Axiom mat_mult_no_bound_def1 : forall (m:matrix complex) (n:matrix complex), ~ ((columns m) = (rows n)) -> ((mat_mult_no_bound m n) = (make_f 1%Z 1%Z (fun (i:Z) (j:Z) => c_zero))). Axiom mat_mult_no_bound_spec : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> ((rows (mat_mult_no_bound m n)) = (rows m)). Axiom mat_mult_no_bound_spec1 : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> ((columns (mat_mult_no_bound m n)) = (columns n)). Axiom mat_mult_no_bound_spec2 : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> forall (i:Z) (j:Z), (valid_index (mat_mult_no_bound m n) i j) -> ((get (mat_mult_no_bound m n) i j) = (ind_sum (fun (k:Z) => (infix_asdt (get m i k) (get n k j))) 0%Z (columns m))). Parameter mat_mult: (matrix complex) -> (matrix complex) -> matrix complex. Axiom mat_mult_def : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> ((mat_mult m n) = (mat_mult_no_bound m n)). Axiom mat_mult_spec : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> ((rows (mat_mult m n)) = (rows m)). Axiom mat_mult_spec1 : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> ((columns (mat_mult m n)) = (columns n)). Axiom mat_mult_spec2 : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> forall (i:Z) (j:Z), (valid_index (mat_mult m n) i j) -> ((get (mat_mult m n) i j) = (ind_sum (fun (k:Z) => (infix_asdt (get m i k) (get n k j))) 0%Z (columns m))). Axiom correct_mat_mult : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> ((mat_mult m n) = (make_f (rows m) (columns n) (fun (i:Z) (j:Z) => (ind_sum (fun (k:Z) => (infix_asdt (get m i k) (get n k j))) 0%Z (columns m))))). Axiom mat_mult_values : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), ((columns m) = (rows n)) -> (valid_index (mat_mult m n) i j) -> ((get (mat_mult m n) i j) = (ind_sum (fun (k:Z) => (infix_asdt (get m i k) (get n k j))) 0%Z (columns m))). Axiom mat_mult_columns : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> ((columns (mat_mult m n)) = (columns n)). Axiom mat_mult_rows : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> ((rows (mat_mult m n)) = (rows m)). Axiom mat_mult_values_quant : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> forall (i:Z) (j:Z), (valid_index (mat_mult m n) i j) -> ((get (mat_mult m n) i j) = (ind_sum (fun (k:Z) => (infix_asdt (get m i k) (get n k j))) 0%Z (columns m))). Parameter int_mat_prod: (Z -> matrix complex) -> Z -> Z -> matrix complex. Axiom int_mat_prod_def : forall (f:Z -> matrix complex) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z) (k':Z), (((i <= k)%Z /\ (k <= j)%Z) /\ ((i <= k')%Z /\ (k' <= j)%Z)) -> ((rows (f k)) = (rows (f k'))) /\ ((rows (f k')) = (columns (f k')))) -> ((j - i)%Z = 0%Z) -> ((int_mat_prod f i j) = (f i)). Axiom int_mat_prod_def1 : forall (f:Z -> matrix complex) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z) (k':Z), (((i <= k)%Z /\ (k <= j)%Z) /\ ((i <= k')%Z /\ (k' <= j)%Z)) -> ((rows (f k)) = (rows (f k'))) /\ ((rows (f k')) = (columns (f k')))) -> ~ ((j - i)%Z = 0%Z) -> ((int_mat_prod f i j) = (mat_mult_no_bound (int_mat_prod f i (j - 1%Z)%Z) (f j))). Axiom int_mat_prod_spec : forall (f:Z -> matrix complex) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z) (k':Z), (((i <= k)%Z /\ (k <= j)%Z) /\ ((i <= k')%Z /\ (k' <= j)%Z)) -> ((rows (f k)) = (rows (f k'))) /\ ((rows (f k')) = (columns (f k')))) -> ((rows (int_mat_prod f i j)) = (rows (f i))). Axiom int_mat_prod_spec1 : forall (f:Z -> matrix complex) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z) (k':Z), (((i <= k)%Z /\ (k <= j)%Z) /\ ((i <= k')%Z /\ (k' <= j)%Z)) -> ((rows (f k)) = (rows (f k'))) /\ ((rows (f k')) = (columns (f k')))) -> ((columns (int_mat_prod f i j)) = (columns (f i))). Axiom int_mat_prod_spec2 : forall (f:Z -> matrix complex) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z) (k':Z), (((i <= k)%Z /\ (k <= j)%Z) /\ ((i <= k')%Z /\ (k' <= j)%Z)) -> ((rows (f k)) = (rows (f k'))) /\ ((rows (f k')) = (columns (f k')))) -> ((columns (int_mat_prod f i j)) = (rows (f i))). Axiom int_mat_prod_zero : forall (f:Z -> matrix complex) (i:Z) (j:Z), ((rows (f i)) = (columns (f i))) -> (i = j) -> ((int_mat_prod f i j) = (f i)). Parameter int_mat_prod_plus_one: (Z -> matrix complex) -> Z -> Z -> unit. Axiom int_mat_prod_plus_one_def : forall (f:Z -> matrix complex) (i:Z) (j:Z), (i < j)%Z -> (forall (k:Z) (k':Z), (((i <= k)%Z /\ (k <= j)%Z) /\ ((i <= k')%Z /\ (k' <= j)%Z)) -> ((rows (f k)) = (rows (f k'))) /\ ((rows (f k')) = (columns (f k')))) -> ((int_mat_prod_plus_one f i j) = tt). Axiom int_mat_prod_plus_one_spec : forall (f:Z -> matrix complex) (i:Z) (j:Z), (i < j)%Z -> (forall (k:Z) (k':Z), (((i <= k)%Z /\ (k <= j)%Z) /\ ((i <= k')%Z /\ (k' <= j)%Z)) -> ((rows (f k)) = (rows (f k'))) /\ ((rows (f k')) = (columns (f k')))) -> ((int_mat_prod f i j) = (mat_mult (int_mat_prod f i (j - 1%Z)%Z) (f j))). Axiom int_mat_prod_eq : forall (f:Z -> matrix complex) (g:Z -> matrix complex) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z) (k':Z), ((i <= k)%Z /\ (k <= j)%Z) -> ((i <= k')%Z /\ (k' <= j)%Z) -> ((rows (f k)) = (rows (f k'))) /\ ((rows (f k')) = (columns (f k')))) -> (forall (k:Z), ((i <= k)%Z /\ (k <= j)%Z) -> ((f k) = (g k))) -> ((int_mat_prod f i j) = (int_mat_prod g i j)). Axiom mat_mult_id : forall (n:Z) (m:matrix complex), (n >= 0%Z)%Z -> ((columns m) = (power 2%Z n)) -> ((mat_mult m (identity n)) = m). Axiom id_mat_mult : forall (n:Z) (m:matrix complex), (n >= 0%Z)%Z -> ((rows m) = (power 2%Z n)) -> ((mat_mult (identity n) m) = m). Axiom mat_mult_eq : forall (m:matrix complex) (n:matrix complex) (m':matrix complex) (n':matrix complex), (m = m') -> (n = n') -> ((columns m) = (rows n)) -> ((mat_mult m n) = (mat_mult m' n')). Parameter add_mat: (matrix complex) -> (matrix complex) -> matrix complex. Axiom add_mat_def : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((add_mat m n) = (make_f (rows m) (columns m) (fun (i:Z) (j:Z) => (infix_pldt (get m i j) (get n i j))))). Axiom add_mat_spec : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((columns (add_mat m n)) = (columns m)). Axiom add_mat_spec1 : True. Axiom add_mat_spec2 : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((rows (add_mat m n)) = (rows m)). Axiom add_mat_spec3 : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((rows m) = (rows n)). Axiom add_mat_spec4 : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> forall (i:Z) (j:Z), ((get (add_mat m n) i j) = (infix_pldt (get m i j) (get n i j))). Axiom add_mat_equal : forall (m:matrix complex) (n:matrix complex) (m':matrix complex) (n':matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> (m = m') -> (n = n') -> ((add_mat m n) = (add_mat m' n')). Axiom add_value : forall (m:matrix complex) (n:matrix complex), ((columns m) = (columns n)) -> ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> ((get (add_mat m n) i j) = (infix_pldt (get m i j) (get n i j))). Axiom add_values : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), ((columns m) = (columns n)) -> ((rows m) = (rows n)) -> ((get (add_mat m n) i j) = (infix_pldt (get m i j) (get n i j))). Axiom add_mat_null_left : forall (m:matrix complex) (n:matrix complex), ((columns m) = (columns n)) -> ((rows m) = (rows n)) -> (null_mat m) -> ((add_mat m n) = n). Axiom add_mat_null_right : forall (m:matrix complex) (n:matrix complex), ((columns m) = (columns n)) -> ((rows m) = (rows n)) -> (null_mat n) -> ((add_mat m n) = m). Axiom set_equal_columns_elt : forall (m:matrix complex) (n:matrix complex) (i:Z), (((columns m) = (columns n)) /\ ((columns n) = i)) -> ((columns m) = (columns n)). Axiom set_equal_rows_elt : forall (m:matrix complex) (n:matrix complex) (i:Z), (((rows m) = (rows n)) /\ ((rows n) = i)) -> ((rows m) = (rows n)). Axiom add_columns : forall (m:matrix complex) (n:matrix complex), ((columns m) = (columns n)) -> ((rows m) = (rows n)) -> ((columns (add_mat m n)) = (columns m)). Axiom add_rows : forall (m:matrix complex) (n:matrix complex), ((columns m) = (columns n)) -> ((rows m) = (rows n)) -> ((rows (add_mat m n)) = (rows m)). Axiom set_equal_dim_elt : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), (((rows m) = (rows n)) /\ ((rows n) = i)) -> (((columns m) = (columns n)) /\ ((columns n) = j)) -> ((columns m) = (columns n)). Axiom set_equal_dim_elt1 : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), (((rows m) = (rows n)) /\ ((rows n) = i)) -> (((columns m) = (columns n)) /\ ((columns n) = j)) -> ((rows m) = (rows n)). Axiom set_dim_add : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), (((rows m) = (rows n)) /\ ((rows n) = i)) -> (((columns m) = (columns n)) /\ ((columns n) = j)) -> ((rows (add_mat m n)) = i). Axiom set_dim_add1 : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), (((rows m) = (rows n)) /\ ((rows n) = i)) -> (((columns m) = (columns n)) /\ ((columns n) = j)) -> ((columns (add_mat m n)) = j). Axiom add_mat_eq : forall (m:matrix complex) (m1:matrix complex) (n:matrix complex) (n1:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> (m = m1) -> (n = n1) -> ((add_mat m n) = (add_mat m1 n1)). Axiom add_mat_comm : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((add_mat m n) = (add_mat n m)). Axiom add_mat_eq_rev : forall (m:matrix complex) (m1:matrix complex) (n:matrix complex) (n1:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> (m = m1) -> (n = n1) -> ((add_mat n m) = (add_mat m1 n1)). Parameter add_neutral: unit -> matrix complex. Axiom add_neutral_spec : forall (us:unit), forall (i:Z) (j:Z), (valid_index (add_neutral us) i j) -> ((get (add_neutral us) i j) = c_zero). Axiom add_neutral_spec1 : forall (us:unit), ((rows (add_neutral us)) > 0%Z)%Z. Axiom add_neutral_spec2 : forall (us:unit), ((columns (add_neutral us)) > 0%Z)%Z. Axiom distr_1_pre : forall (m:matrix complex) (n:matrix complex) (o:matrix complex) (i:Z) (j:Z), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((columns m) = (rows o)) -> ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns o))%Z) -> ((get (mat_mult (add_mat m n) o) i j) = (get (add_mat (mat_mult m o) (mat_mult n o)) i j)). Axiom distr_l : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((columns m) = (rows o)) -> ((mat_mult (add_mat m n) o) = (add_mat (mat_mult m o) (mat_mult n o))). Axiom distr_2_pre : forall (m:matrix complex) (n:matrix complex) (o:matrix complex) (i:Z) (j:Z), ((rows n) = (rows o)) -> ((columns n) = (columns o)) -> ((columns m) = (rows n)) -> ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns n))%Z) -> valid_index (mat_mult m (add_mat n o)) i j. Axiom distr_2_pre1 : forall (m:matrix complex) (n:matrix complex) (o:matrix complex) (i:Z) (j:Z), ((rows n) = (rows o)) -> ((columns n) = (columns o)) -> ((columns m) = (rows n)) -> ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns n))%Z) -> ((get (mat_mult m (add_mat n o)) i j) = (get (add_mat (mat_mult m n) (mat_mult m o)) i j)). Axiom distr_r : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((rows n) = (rows o)) -> ((columns n) = (columns o)) -> ((columns m) = (rows n)) -> ((mat_mult m (add_mat n o)) = (add_mat (mat_mult m n) (mat_mult m o))). Parameter infix_asdtdt: complex -> (matrix complex) -> matrix complex. Axiom infix_asdtdt_def : forall (s:complex) (m:matrix complex), ((infix_asdtdt s m) = (make_f (rows m) (columns m) (fun (i:Z) (j:Z) => (infix_asdt s (get m i j))))). Axiom infix_asdtdt_spec : forall (s:complex) (m:matrix complex), ((columns (infix_asdtdt s m)) = (columns m)). Axiom infix_asdtdt_spec1 : forall (s:complex) (m:matrix complex), ((rows (infix_asdtdt s m)) = (rows m)). Axiom infix_asdtdt_spec2 : forall (s:complex) (m:matrix complex), forall (i:Z) (j:Z), (valid_index (infix_asdtdt s m) i j) -> ((get (infix_asdtdt s m) i j) = (infix_asdt s (get m i j))). Axiom infix_asdtdt_spec3 : forall (s:complex) (m:matrix complex), forall (i:Z) (j:Z), (valid_index (infix_asdtdt s m) i j) -> valid_index m i j. Axiom infix_asdtdt_spec4 : forall (s:complex) (m:matrix complex), forall (i:Z) (j:Z), (valid_index m i j) -> valid_index (infix_asdtdt s m) i j. Axiom scalar_columns : forall (m:matrix complex) (a:complex), ((columns (infix_asdtdt a m)) = (columns m)). Axiom scalar_values : forall (m:matrix complex) (a:complex) (i:Z) (j:Z), ((get (infix_asdtdt a m) i j) = (infix_asdt a (get m i j))). Axiom scalar_rows : forall (m:matrix complex) (a:complex), ((rows (infix_asdtdt a m)) = (rows m)). Axiom scalar_null : forall (m:matrix complex), null_mat (infix_asdtdt c_zero m). Axiom scalar_c_one : forall (m:matrix complex), ((infix_asdtdt c_one m) = m). Axiom scalar_c_one_gen : forall (m:matrix complex) (a:complex), (a = c_one) -> ((infix_asdtdt a m) = m). Axiom scalar_null_gen : forall (m:matrix complex) (a:complex), (a = c_zero) -> null_mat (infix_asdtdt a m). Axiom scalar_plus : forall (m:matrix complex) (a:complex) (b:complex), ((infix_asdtdt (infix_pldt a b) m) = (add_mat (infix_asdtdt a m) (infix_asdtdt b m))). Axiom scalar_plus_rev : forall (m:matrix complex) (a:complex) (b:complex), ((add_mat (infix_asdtdt a m) (infix_asdtdt b m)) = (infix_asdtdt (infix_pldt a b) m)). Axiom add_scal : forall (m:matrix complex) (n:matrix complex) (a:complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((infix_asdtdt a (add_mat m n)) = (add_mat (infix_asdtdt a m) (infix_asdtdt a n))). Axiom add_scal_rev : forall (m:matrix complex) (n:matrix complex) (a:complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((add_mat (infix_asdtdt a m) (infix_asdtdt a n)) = (infix_asdtdt a (add_mat m n))). Axiom mat_mult_scal_values_l : forall (m:matrix complex) (n:matrix complex) (a:complex) (i:Z) (j:Z), ((rows n) = (columns m)) -> ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns n))%Z) -> ((infix_asdt a (get (mat_mult m n) i j)) = (ind_sum (fun (k:Z) => (infix_asdt (infix_asdt a (get m i k)) (get n k j))) 0%Z (columns m))). Axiom mat_mult_scal_values_r : forall (m:matrix complex) (n:matrix complex) (a:complex) (i:Z) (j:Z), ((rows n) = (columns m)) -> ((rows m) = (columns n)) -> ((columns m) = (columns n)) -> ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns n))%Z) -> ((infix_asdt (get (mat_mult m n) i j) a) = (ind_sum (fun (k:Z) => (infix_asdt (infix_asdt a (get m i k)) (get n k j))) 0%Z (columns m))). Axiom mat_mut_scal : forall (m:matrix complex) (n:matrix complex) (a:complex), ((rows n) = (columns m)) -> ((mat_mult m (infix_asdtdt a n)) = (infix_asdtdt a (mat_mult m n))). Axiom scal_mat_mut : forall (m:matrix complex) (n:matrix complex) (a:complex), ((rows n) = (columns m)) -> ((mat_mult (infix_asdtdt a m) n) = (infix_asdtdt a (mat_mult m n))). Axiom mat_mut_scal_rev : forall (m:matrix complex) (n:matrix complex) (a:complex), ((rows n) = (columns m)) -> ((infix_asdtdt a (mat_mult m n)) = (mat_mult m (infix_asdtdt a n))). Axiom scal_mat_mut_rev : forall (m:matrix complex) (n:matrix complex) (a:complex), ((rows n) = (columns m)) -> ((infix_asdtdt a (mat_mult m n)) = (mat_mult (infix_asdtdt a m) n)). Axiom ind_sum_commute_scal_r : forall (f:Z -> Z -> complex) (g:Z -> complex) (i:Z) (j:Z) (k:Z) (l:Z), (i <= j)%Z -> (k <= l)%Z -> ((ind_sum (fun (k1:Z) => (infix_asdt (ind_sum (f k1) k l) (g k1))) i j) = (ind_sum (fun (k1:Z) => (ind_sum (fun (k2:Z) => (infix_asdt ((f k2) k1) (g k2))) i j)) k l)). Axiom mat_mult_assoc_pre : forall (m:matrix complex) (n:matrix complex) (o:matrix complex) (i:Z) (j:Z), ((columns m) = (rows n)) -> ((columns n) = (rows o)) -> ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns o))%Z) -> ((get (mat_mult (mat_mult m n) o) i j) = (get (mat_mult m (mat_mult n o)) i j)). Axiom mat_mult_assoc : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((columns m) = (rows n)) -> ((columns n) = (rows o)) -> ((mat_mult (mat_mult m n) o) = (mat_mult m (mat_mult n o))). Axiom mat_mult_assoc_quant : forall (m:matrix complex) (n:matrix complex), ((columns m) = (rows n)) -> forall (o:matrix complex), ((columns n) = (rows o)) -> ((mat_mult (mat_mult m n) o) = (mat_mult m (mat_mult n o))). Axiom mat_mult_assoc_comm : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((columns m) = (rows n)) -> ((columns n) = (rows o)) -> ((mat_mult m (mat_mult n o)) = (mat_mult (mat_mult m n) o)). Axiom scalar_eq : forall (m:matrix complex) (n:matrix complex) (a:complex), (m = n) -> ((infix_asdtdt a m) = (infix_asdtdt a n)). Axiom scalar_eq_gen : forall (m:matrix complex) (n:matrix complex) (a:complex) (b:complex), (m = n) -> (a = b) -> ((infix_asdtdt a m) = (infix_asdtdt b n)). Axiom scalar_add : forall (m:matrix complex) (a:complex) (b:complex), ((infix_asdtdt (infix_pldt a b) m) = (add_mat (infix_asdtdt a m) (infix_asdtdt b m))). Axiom scalar_assoc : forall (m:matrix complex) (a:complex) (b:complex), ((infix_asdtdt a (infix_asdtdt b m)) = (infix_asdtdt (infix_asdt a b) m)). Axiom scalar_assoc_rev : forall (m:matrix complex) (a:complex) (b:complex), ((infix_asdtdt (infix_asdt a b) m) = (infix_asdtdt a (infix_asdtdt b m))). Axiom scalars_inv : forall (m:matrix complex) (a:complex) (b:complex) (a':complex) (b':complex), (a = a') -> (b = b') -> ((infix_asdtdt a' (infix_asdtdt b' m)) = (infix_asdtdt b (infix_asdtdt a m))). Axiom eq_scalar : forall (m:matrix complex) (a:complex) (b:complex), (exists i:Z, exists j:Z, (valid_index m i j) /\ ~ ((get m i j) = c_zero)) -> ((infix_asdtdt a m) = (infix_asdtdt b m)) -> (a = b). Parameter mat_substr: (matrix complex) -> (matrix complex) -> matrix complex. Axiom mat_substr_def : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((mat_substr m n) = (add_mat m (infix_asdtdt (prefix_mndt c_one) n))). Axiom mat_substr_spec : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((rows (mat_substr m n)) = (rows m)). Axiom mat_substr_spec1 : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((columns (mat_substr m n)) = (columns m)). Axiom mat_substr_spec2 : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> ((get (mat_substr m n) i j) = (infix_mndt (get m i j) (get n i j))). Axiom substr_rows : forall (m:matrix complex) (n:matrix complex) (r:Z), (((rows m) = (rows n)) /\ ((rows n) = r)) -> ((columns m) = (columns n)) -> ((rows (mat_substr m n)) = r). Axiom substr_columns : forall (m:matrix complex) (n:matrix complex) (c:Z), ((rows m) = (rows n)) -> (((columns m) = (columns n)) /\ ((columns n) = c)) -> ((columns (mat_substr m n)) = c). Axiom substr_value : forall (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> ((get (mat_substr m n) i j) = (infix_mndt (get m i j) (get n i j))). Axiom distr_l_substr : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((columns m) = (rows o)) -> ((mat_mult (mat_substr m n) o) = (mat_substr (mat_mult m o) (mat_mult n o))). Axiom distr_r_substr : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((rows n) = (rows o)) -> ((columns n) = (columns o)) -> ((columns m) = (rows o)) -> ((mat_mult m (mat_substr n o)) = (mat_substr (mat_mult m n) (mat_mult m o))). Axiom mat_substr_eq : forall (m:matrix complex) (m':matrix complex) (n:matrix complex) (n':matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> (m = m') -> (n = n') -> ((mat_substr m n) = (mat_substr m' n')). Axiom substr_decomp : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> (m = (add_mat n (mat_substr m n))). Axiom subtr_scal : forall (m:matrix complex) (n:matrix complex) (a:complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((infix_asdtdt a (mat_substr m n)) = (mat_substr (infix_asdtdt a m) (infix_asdtdt a n))). Axiom subtr_scal_rev : forall (m:matrix complex) (n:matrix complex) (a:complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((mat_substr (infix_asdtdt a m) (infix_asdtdt a n)) = (infix_asdtdt a (mat_substr m n))). Axiom get_equal_mat_to_substr : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> (m = n) -> ((mat_substr m n) = (make (rows m) (columns m) c_zero)). Axiom set_inequal_mat_by_substr : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ~ (m = n) -> ~ ((mat_substr m n) = (make (rows m) (columns m) c_zero)). Axiom set_inequal_mat_by_substr1 : forall (m:matrix complex) (n:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ~ ((mat_substr m n) = (make (rows m) (columns m) c_zero)) -> ~ (m = n). Axiom pow_inv_2_scal : forall (i:Z) (x:matrix complex), (0%Z <= i)%Z -> ((infix_asdtdt (pow_inv_2 i) x) = (infix_asdtdt (pow_inv_sqrt_2 i) (infix_asdtdt (pow_inv_sqrt_2 i) x))). Axiom pow_inv_2_from_int : forall (n:Z), (0%Z <= n)%Z -> ((pow_inv_2 n) = (infix_sldt c_one (i_to_c (power 2%Z n)))). Axiom pow_inv_2_sq_rt : forall (n:Z), (0%Z <= n)%Z -> ((square_rt (pow_inv_2 n)) = (pow_inv_sqrt_2 n)). Axiom pow_inv_sqrt_2_double : forall (n:Z), (0%Z <= n)%Z -> ((pow_inv_sqrt_2 (2%Z * n)%Z) = (pow_inv_2 n)). Axiom pos_pow_inv_2 : forall (i:Z), (0%Z <= i)%Z -> infix_lseqdt c_zero (pow_inv_2 i). Axiom pos_pow_inv_sqrt_2 : forall (i:Z), (0%Z <= i)%Z -> infix_lseqdt c_zero (pow_inv_sqrt_2 i). Axiom strict_pos_pow_inv_2 : forall (i:Z), (0%Z <= i)%Z -> infix_lsdt c_zero (pow_inv_2 i). Axiom pow_inv_2_add : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> ((pow_inv_2 (i + j)%Z) = (infix_asdt (pow_inv_2 i) (pow_inv_2 j))). Axiom pow_inv_2_plus_one : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_2 (i + 1%Z)%Z) = (infix_asdt (infix_sldt c_one ttwo) (pow_inv_2 i))). Axiom pow_inv_2_plus_one_rev : forall (i:Z), (0%Z <= i)%Z -> ((infix_asdt (infix_sldt c_one ttwo) (pow_inv_2 i)) = (pow_inv_2 (i + 1%Z)%Z)). Axiom pow_inv_2_with_ : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_2 i) = (infix_sldt c_one (i_to_c (power_ 2%Z i)))). Axiom pow_inv_2_to_one : forall (i:Z), (0%Z <= i)%Z -> ((infix_asdt (i_to_c (power_ 2%Z i)) (pow_inv_2 i)) = c_one). Axiom pow_inv_2_one : forall (i:Z), (i = 1%Z) -> ((i_to_c (power_ 2%Z i)) = ttwo). Axiom pow_inv_2_to_one_gen : forall (i:Z) (x:complex), (0%Z <= i)%Z -> (x = (i_to_c (power_ 2%Z i))) -> ((infix_asdt (pow_inv_2 i) x) = c_one). Axiom pow_inv_to_pow_2 : forall (k:Z) (l:Z), (0%Z <= l)%Z -> (k >= l)%Z -> ((infix_asdt (pow_inv_2 k) (i_to_c (power_ 2%Z l))) = (pow_inv_2 (k - l)%Z)). Parameter neg_pow_inv_sqrt_2: Z -> complex. Axiom neg_pow_inv_sqrt_2_def : forall (i:Z), (0%Z <= i)%Z -> ((neg_pow_inv_sqrt_2 i) = (cpower neg_coeff i)). Axiom inv_pow_inv_sqrt_2 : ((infix_asdt (pow_inv_sqrt_2 1%Z) squarert_two) = c_one). Axiom pow_inv_sqrt_2_values : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_sqrt_2 i) = (infix_sldt c_one (cpower squarert_two i))). Axiom neg_pow_inv_sqrt_2_values : forall (i:Z), (0%Z <= i)%Z -> ((neg_pow_inv_sqrt_2 i) = (infix_asdt (mop i) (infix_sldt c_one (cpower squarert_two i)))). Axiom ppos_neg_coeff_values : forall (i:Z), (0%Z <= i)%Z -> ((even i) = true) -> ((pow_inv_sqrt_2 i) = (neg_pow_inv_sqrt_2 i)). Axiom ppos_neg_coeff_values1 : forall (i:Z), (0%Z <= i)%Z -> ((odd i) = true) -> ((pow_inv_sqrt_2 i) = (prefix_mndt (neg_pow_inv_sqrt_2 i))). Axiom ppos_neg_coeff_values2 : forall (i:Z), (0%Z <= i)%Z -> ((neg_pow_inv_sqrt_2 i) = (infix_asdt (mop i) (pow_inv_sqrt_2 i))). Parameter pow_inv_sqrt_2_neg: Z -> complex. Axiom pow_inv_sqrt_2_neg_def : forall (i:Z), (0%Z <= i)%Z -> ((pow_inv_sqrt_2_neg i) = (prefix_mndt (pow_inv_sqrt_2 i))). Axiom int_to_ang_to_real_to_ang : forall (theta:angle) (k:Z) (n:Z), (n >= 0%Z)%Z -> (theta = (int_to_ang k n)) -> (theta = (real_to_ang (infix_asdt (i_to_c k) (pow_inv_2 n)))). Axiom real_to_ang_to_int_to_ang : forall (k:Z) (n:Z), (n >= 0%Z)%Z -> ((real_to_ang (infix_asdt (i_to_c k) (pow_inv_2 n))) = (int_to_ang k n)). Axiom real_to_ang_to_int_to_ang_add : forall (k:Z) (k':Z) (n:Z), (n >= 0%Z)%Z -> ((real_to_ang (infix_asdt (infix_pldt (i_to_c k) (i_to_c k')) (pow_inv_2 n))) = (int_to_ang (k + k')%Z n)). Axiom int_to_ang_to_real_to_ang_gen : forall (k:Z) (n:Z) (kx:complex), (n >= 0%Z)%Z -> (kx = (i_to_c k)) -> ((int_to_ang k n) = (real_to_ang (infix_asdt kx (pow_inv_2 n)))). Axiom Int_To_Ang_inv : forall (k:Z) (n:Z), (n >= 0%Z)%Z -> ((ang_inv (int_to_ang k n)) = (int_to_ang (-k)%Z n)). Axiom Int_To_Ang_inv_add : forall (k:Z) (n:Z), (n >= 0%Z)%Z -> ((ang_add (int_to_ang k n) (int_to_ang (-k)%Z n)) = ang_zero). Axiom Int_To_Ang_add : forall (k:Z) (k':Z) (n:Z), (n >= 0%Z)%Z -> ((ang_add (int_to_ang k n) (int_to_ang k' n)) = (int_to_ang (k + k')%Z n)). Axiom Int_To_Ang_up : forall (k:Z) (n:Z), (0%Z <= n)%Z -> ((int_to_ang k n) = (int_to_ang (2%Z * k)%Z (n + 1%Z)%Z)). Axiom Int_To_Ang_cyclic : forall (k:Z) (n:Z), (0%Z <= n)%Z -> ((int_to_ang k n) = (int_to_ang (k + (power_ 2%Z n))%Z n)). Axiom Zero_n : forall (n:Z), (n >= 0%Z)%Z -> ((int_to_ang 0%Z n) = ang_zero). Parameter ang_minus_one: angle. Axiom ang_minus_one_def : (ang_minus_one = (int_to_ang 1%Z 1%Z)). Axiom set_ang_minus_one_by_int : forall (a:Z) (b:Z), (a = 1%Z) -> (b = 1%Z) -> ((int_to_ang a b) = ang_minus_one). Axiom ang_minus_one_from_real : (ang_minus_one = (real_to_ang (infix_sldt c_one ttwo))). Axiom ang_exp_minus_one : ((ang_exp ang_minus_one) = (prefix_mndt c_one)). Axiom set_ang_zero_by_int : forall (a:Z) (b:Z), (a = 0%Z) -> (0%Z <= b)%Z -> ((int_to_ang a b) = ang_zero). Axiom ang_minus_one_twice : forall (a1:angle) (a2:angle), (a1 = ang_minus_one) -> (a2 = ang_minus_one) -> ((ang_add a1 a2) = ang_zero). Parameter div_two: angle -> angle. Axiom div_two_def : forall (d:angle), ((div_two d) = (real_to_ang (infix_sldt (ang_meas d) ttwo))). Axiom div_two_spec : forall (d:angle), ((ang_meas (div_two d)) = (infix_sldt (ang_meas d) ttwo)). Axiom div_two_spec1 : forall (d:angle), ((ang_add (div_two d) (div_two d)) = d). Axiom Div_two : forall (d:angle), ((ang_add (div_two d) (div_two d)) = d). Axiom div_two_int_to_ang : forall (k:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= k)%Z /\ (k < (power_ 2%Z n))%Z) -> ((div_two (int_to_ang k n)) = (int_to_ang k (n + 1%Z)%Z)). Axiom ang_exp_mult : forall (x:angle) (x':angle), ((infix_asdt (ang_exp x) (ang_exp x')) = (ang_exp (ang_add x x'))). Axiom ang_exp_modulus : forall (x:angle), ((modulus (ang_exp x)) = c_one). Axiom ang_exp_not_one : forall (i:complex), ((infix_lsdt c_zero i) /\ (infix_lsdt i c_one)) -> ~ ((ang_exp (real_to_ang i)) = c_one). Axiom ang_exp_not_by_modulus : forall (i:complex), ((infix_lsdt c_zero i) /\ (infix_lsdt i c_one)) -> ~ ((ang_exp (real_to_ang (modulus i))) = c_one). Parameter k_int_to_ang: Z -> angle. Axiom k_int_to_ang_def : forall (k:Z), (0%Z <= k)%Z -> ((k_int_to_ang k) = (int_to_ang 1%Z k)). Axiom K_int_to_angplus_one : forall (k:Z), (k > 0%Z)%Z -> ((ang_add (k_int_to_ang k) (k_int_to_ang k)) = (k_int_to_ang (k - 1%Z)%Z)). Parameter phase_inv_pre: Z -> angle -> angle. Axiom phase_inv_pre_def : forall (i:Z) (d:angle), (0%Z <= i)%Z -> (i = 0%Z) -> ((phase_inv_pre i d) = d). Axiom phase_inv_pre_def1 : forall (i:Z) (d:angle), (0%Z <= i)%Z -> ~ (i = 0%Z) -> ((phase_inv_pre i d) = (ang_inv (phase_inv_pre (i - 1%Z)%Z d))). Axiom phase_inv_pre_spec : forall (i:Z) (d:angle), (0%Z <= i)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) -> ((phase_inv_pre i d) = d). Axiom phase_inv_pre_spec1 : forall (i:Z) (d:angle), (0%Z <= i)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) -> ((phase_inv_pre i d) = (ang_inv d)). Parameter phase_inv_: Z -> angle -> angle. Axiom phase_inv__def : forall (i:Z) (d:angle), (0%Z <= i)%Z -> ((phase_inv_ i d) = (phase_inv_pre i d)). Axiom phase_inv__def1 : forall (i:Z) (d:angle), ~ (0%Z <= i)%Z -> ((phase_inv_ i d) = (phase_inv_pre (-i)%Z d)). Axiom phase_inv__spec : forall (i:Z) (d:angle), ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) -> ((phase_inv_ i d) = d). Axiom phase_inv__spec1 : forall (i:Z) (d:angle), ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) -> ((phase_inv_ i d) = (ang_inv d)). Axiom Even_phase_inv : forall (d:angle), forall (i:Z), ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) -> ((phase_inv_ i d) = d). Axiom Odd_phase_inv : forall (d:angle), forall (i:Z), ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) -> ((phase_inv_ i d) = (ang_inv d)). Axiom Gen_phase_inv : forall (k:Z) (n:Z) (i:Z), (n >= 0%Z)%Z -> (i >= 0%Z)%Z -> ((phase_inv_ i (int_to_ang k n)) = (int_to_ang ((power_ (-1%Z)%Z i) * k)%Z n)). Axiom Gen_phase_inv_neg : forall (k:Z) (n:Z) (i:Z), (n >= 0%Z)%Z -> (i < 0%Z)%Z -> ((phase_inv_ i (int_to_ang k n)) = (int_to_ang ((power_ (-1%Z)%Z (-i)%Z) * k)%Z n)). Axiom Ang_exp_inv : forall (o:angle), ((ang_exp (ang_inv o)) = (infix_sldt c_one (ang_exp o))). Axiom ang_inv_to_conjugate : forall (o:angle), ((ang_exp (ang_inv o)) = (conjugate (ang_exp o))). Axiom exp_minus : forall (x:complex), (real_ x) -> ((exp (infix_asdt im (prefix_mndt x))) = (conjugate (exp (infix_asdt im x)))). Axiom conjugate_to_ang_inv : forall (o:angle), ((conjugate (ang_exp o)) = (ang_exp (ang_inv o))). Axiom conjugate_inv_elim : forall (o:angle), ((conjugate (ang_exp (ang_inv o))) = (ang_exp o)). Axiom ang_exp_neg_conjugate : forall (x:complex), (real_ x) -> ((ang_exp (real_to_ang (prefix_mndt x))) = (conjugate (ang_exp (real_to_ang x)))). Axiom ang_exp_neg_conjugate_rev : forall (x:complex), (real_ x) -> ((conjugate (ang_exp (real_to_ang x))) = (ang_exp (real_to_ang (prefix_mndt x)))). Axiom ang_mult_int_in : forall (i:Z) (k:Z) (n:Z), (0%Z <= n)%Z -> ((ang_mult_int (int_to_ang k n) i) = (int_to_ang (i * k)%Z n)). Axiom ang_mult_int_out : forall (i:Z) (k:Z) (n:Z), (0%Z <= n)%Z -> ((int_to_ang (i * k)%Z n) = (ang_mult_int (int_to_ang k n) i)). Axiom int_to_ang_cycles : forall (k:Z) (n:Z) (i:Z), (0%Z <= n)%Z -> (0%Z <= i)%Z -> ((int_to_ang (k + (i * (power_ 2%Z n))%Z)%Z n) = (int_to_ang k n)). Axiom int_to_ang_eq : forall (k1:Z) (k2:Z) (n1:Z) (n2:Z), (k1 = k2) -> (n1 = n2) -> ((int_to_ang k1 n1) = (int_to_ang k2 n2)). Axiom int_to_ang_cycles_neg : forall (k:Z) (n:Z) (i:Z), (0%Z <= n)%Z -> (0%Z >= i)%Z -> ((int_to_ang (k + (i * (power_ 2%Z n))%Z)%Z n) = (int_to_ang k n)). Axiom int_to_ang_cycles_gen : forall (k:Z) (n:Z) (i:Z), (0%Z <= n)%Z -> ((int_to_ang (k + (i * (power_ 2%Z n))%Z)%Z n) = (int_to_ang k n)). Axiom int_to_ang_cycles_zero : forall (n':Z) (n:Z), ((0%Z <= n)%Z /\ (n <= n')%Z) -> ((int_to_ang (power_ 2%Z n') n) = ang_zero). Axiom int_to_ang_cycles_zero_mult : forall (k:Z) (n':Z) (n:Z), ((0%Z <= n)%Z /\ (n <= n')%Z) -> ((int_to_ang (k * (power_ 2%Z n'))%Z n) = ang_zero). Axiom int_to_ang_cycles_zero_mult_ : forall (k:Z) (n':Z) (n:Z), ((0%Z <= n)%Z /\ (n <= n')%Z) -> ((int_to_ang (k * (power_ 2%Z n'))%Z n) = ang_zero). Axiom int_to_ang_up : forall (k:Z) (n:Z) (n':Z), (0%Z <= n)%Z -> (0%Z <= n')%Z -> ((int_to_ang (k * (power_ 2%Z n'))%Z (n + n')%Z) = (int_to_ang k n)). Axiom int_to_ang_mod : forall (k:Z) (n:Z), (0%Z <= n)%Z -> ((int_to_ang k n) = (int_to_ang (int.EuclideanDivision.mod1 k (power_ 2%Z n)) n)). Axiom int_to_ang_equiv : forall (k1:Z) (k2:Z) (n1:Z) (n2:Z), (0%Z <= n1)%Z -> ((int.EuclideanDivision.mod1 k1 (power_ 2%Z n1)) = (int.EuclideanDivision.mod1 k2 (power_ 2%Z n1))) -> (n1 = n2) -> ((int_to_ang k1 n1) = (int_to_ang k2 n2)). Axiom int_to_ang_red : forall (k:Z) (n:Z), (1%Z <= n)%Z -> ~ (0%Z = k) -> ((int.EuclideanDivision.mod1 k 2%Z) = 0%Z) -> ((int_to_ang k n) = (int_to_ang (int.EuclideanDivision.div k 2%Z) (n - 1%Z)%Z)). Axiom int_to_ang_bin_rev : forall (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> (0%Z <= i)%Z -> (j = (n - 1%Z)%Z) -> ((int_to_ang (-(i * (power_ 2%Z j))%Z)%Z n) = (int_to_ang (i * (power_ 2%Z (n - 1%Z)%Z))%Z n)). Axiom int_to_ang_bin_rev_ : forall (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> (0%Z <= i)%Z -> (j = (n - 1%Z)%Z) -> ((int_to_ang (-(i * (power_ 2%Z j))%Z)%Z n) = (int_to_ang (i * (power_ 2%Z (n - 1%Z)%Z))%Z n)). Axiom int_to_ang_add_rev : forall (i:Z) (j:Z) (n:Z), (0%Z <= n)%Z -> ((int_to_ang (i + j)%Z n) = (ang_add (int_to_ang i n) (int_to_ang j n))). Axiom int_to_ang_ind_isum_plus_one : forall (f:Z -> Z) (i:Z) (j:Z) (n:Z), (i < j)%Z -> (0%Z <= n)%Z -> ((int_to_ang (ind_isum f i j) n) = (ang_add (int_to_ang (f i) n) (int_to_ang (ind_isum f (i + 1%Z)%Z j) n))). Axiom int_to_ang_ind_isum_plus_one_rev : forall (f:Z -> Z) (i:Z) (j:Z) (n:Z), (i < j)%Z -> (0%Z <= n)%Z -> ((int_to_ang (ind_isum f i j) n) = (ang_add (int_to_ang (ind_isum f (i + 1%Z)%Z j) n) (int_to_ang (f i) n))). Axiom int_to_ang_ind_isum_right_extension : forall (f:Z -> Z) (i:Z) (j:Z) (n:Z), (i < j)%Z -> (0%Z <= n)%Z -> ((int_to_ang (ind_isum f i j) n) = (ang_add (int_to_ang (ind_isum f i (j - 1%Z)%Z) n) (int_to_ang (f (j - 1%Z)%Z) n))). Axiom int_to_ang_ind_isum_right_extension_rev : forall (f:Z -> Z) (i:Z) (j:Z) (n:Z), (i < j)%Z -> (0%Z <= n)%Z -> ((int_to_ang (ind_isum f i j) n) = (ang_add (int_to_ang (f (j - 1%Z)%Z) n) (int_to_ang (ind_isum f i (j - 1%Z)%Z) n))). Axiom minus_int_to_ang_ind_isum_plus_one : forall (f:Z -> Z) (i:Z) (j:Z) (n:Z), (i < j)%Z -> (0%Z <= n)%Z -> ((int_to_ang (-(ind_isum f i j))%Z n) = (ang_add (int_to_ang (-(f i))%Z n) (int_to_ang (-(ind_isum f (i + 1%Z)%Z j))%Z n))). Axiom minus_int_to_ang_ind_isum_plus_one_rev : forall (f:Z -> Z) (i:Z) (j:Z) (n:Z), (i < j)%Z -> (0%Z <= n)%Z -> ((int_to_ang (-(ind_isum f i j))%Z n) = (ang_add (int_to_ang (-(ind_isum f (i + 1%Z)%Z j))%Z n) (int_to_ang (-(f i))%Z n))). Axiom minus_int_to_ang_ind_isum_right_extension : forall (f:Z -> Z) (i:Z) (j:Z) (n:Z), (i < j)%Z -> (0%Z <= n)%Z -> ((int_to_ang (-(ind_isum f i j))%Z n) = (ang_add (int_to_ang (-(ind_isum f i (j - 1%Z)%Z))%Z n) (int_to_ang (-(f (j - 1%Z)%Z))%Z n))). Axiom minus_int_to_ang_ind_isum_right_extension_rev : forall (f:Z -> Z) (i:Z) (j:Z) (n:Z), (i < j)%Z -> (0%Z <= n)%Z -> ((int_to_ang (-(ind_isum f i j))%Z n) = (ang_add (int_to_ang (-(f (j - 1%Z)%Z))%Z n) (int_to_ang (-(ind_isum f i (j - 1%Z)%Z))%Z n))). Axiom int_to_ang_simpl : forall (k:Z) (n1:Z) (n2:Z), (n1 >= 0%Z)%Z -> (n2 >= 0%Z)%Z -> ((int_to_ang (k * (power_ 2%Z n1))%Z (n2 + n1)%Z) = (int_to_ang k n2)). Axiom ang_add_eq : forall (d1:angle) (d2:angle) (e1:angle) (e2:angle), (d1 = e1) -> (d2 = e2) -> ((ang_add d1 d2) = (ang_add e1 e2)). Axiom ang_add_comm : forall (d1:angle) (d2:angle), ((ang_add d1 d2) = (ang_add d2 d1)). Axiom ang_add_eq_comm : forall (d1:angle) (d2:angle) (d3:angle) (d4:angle), (d1 = d3) -> (d2 = d4) -> ((ang_add d1 d2) = (ang_add d4 d3)). Axiom ang_mult_int_zero : forall (theta:angle), ((ang_mult_int theta 0%Z) = ang_zero). Axiom ang_div : forall (k:Z) (n:Z) (i:Z), (n >= 0%Z)%Z -> (i >= 0%Z)%Z -> ((int_to_ang k n) = (ang_mult_int (int_to_ang k (n + i)%Z) (power_ 2%Z i))). Axiom ang_zero_add : forall (d':angle) (d:angle), (d' = ang_zero) -> ((ang_add d' d) = d). Axiom int_to_ang_rev : forall (k:Z) (l:Z) (n:Z) (m:Z), (0%Z < n)%Z -> (0%Z <= k)%Z -> (n = (m + 1%Z)%Z) -> ((int_to_ang (((-k)%Z * l)%Z * (power_ 2%Z m))%Z n) = (int_to_ang ((k * l)%Z * (power_ 2%Z m))%Z n)). Axiom int_to_ang_rev_ : forall (k:Z) (l:Z) (n:Z) (m:Z), (0%Z < n)%Z -> (0%Z <= k)%Z -> (0%Z <= l)%Z -> (n = (m + 1%Z)%Z) -> ((int_to_ang (((-k)%Z * l)%Z * (power_ 2%Z m))%Z n) = (int_to_ang ((k * l)%Z * (power_ 2%Z m))%Z n)). Axiom ang_add_zero_d : forall (d':angle) (d:angle), (d' = ang_zero) -> ((ang_add d d') = d). Axiom real_to_ang_distr_minus : forall (x:complex) (z:complex) (t:complex), forall (y:Z), (real_ x) -> (real_ z) -> (real_ t) -> ((ang_add (real_to_ang (infix_asdt x (i_to_c y))) (real_to_ang (infix_asdt (infix_asdt (i_to_c y) (prefix_mndt z)) t))) = (ang_mult_int (real_to_ang (infix_mndt x (infix_asdt z t))) y)). Axiom ang_mult_int_exp_pos : forall (o:angle) (i:Z), (0%Z <= i)%Z -> ((ang_exp (ang_mult_int o i)) = (cpower (ang_exp o) i)). Axiom ang_mult_int_exp : forall (o:angle) (i:Z), ((ang_exp (ang_mult_int o i)) = (cpower (ang_exp o) i)). Axiom ang_mult_int_exp_rev : forall (o:angle) (i:Z), ((cpower (ang_exp o) i) = (ang_exp (ang_mult_int o i))). Axiom cpower_ang_exp_real : forall (x:complex) (i:Z), (real_ x) -> ((cpower (ang_exp (real_to_ang x)) i) = (ang_exp (real_to_ang (infix_asdt x (i_to_c i))))). Axiom ang_mult_int_add : forall (o:angle) (i:Z) (i':Z), ((ang_mult_int o (i + i')%Z) = (ang_add (ang_mult_int o i) (ang_mult_int o i'))). Axiom ang_mult_int_plus_one : forall (o:angle) (i:Z), ((ang_add o (ang_mult_int o i)) = (ang_mult_int o (i + 1%Z)%Z)). Axiom ang_mult_int_plus_one_rev : forall (o:angle) (i:Z), ((ang_mult_int o (1%Z + i)%Z) = (ang_add o (ang_mult_int o i))). Axiom ang_mult_int_double : forall (o:angle) (i:Z), ((ang_mult_int o (2%Z * i)%Z) = (ang_add (ang_mult_int o i) (ang_mult_int o i))). Axiom ang_mult_int_inv_one : forall (o:angle), ((ang_mult_int o (-1%Z)%Z) = (ang_inv o)). Axiom ang_mult_int_one : forall (o:angle) (n:Z), (n = 1%Z) -> ((ang_mult_int o n) = o). Axiom ang_mult_int_inv_rev : forall (o:angle), ((ang_inv o) = (ang_mult_int o (-1%Z)%Z)). Axiom ang_mult_int_comp : forall (o:angle) (i:Z) (j:Z), ((ang_mult_int (ang_mult_int o i) j) = (ang_mult_int o (i * j)%Z)). Axiom ang_mult_int_comp_rev : forall (o:angle) (i:Z) (j:Z), ((ang_mult_int o (i * j)%Z) = (ang_mult_int (ang_mult_int o i) j)). Axiom add_ang_mult_int_pos : forall (o:angle) (o':angle) (i:Z), (0%Z <= i)%Z -> ((ang_add (ang_mult_int o i) (ang_mult_int o' i)) = (ang_mult_int (ang_add o o') i)). Axiom add_ang_mult_int : forall (o:angle) (o':angle) (i:Z), ((ang_add (ang_mult_int o i) (ang_mult_int o' i)) = (ang_mult_int (ang_add o o') i)). Parameter ang_substr: angle -> angle -> angle. Axiom ang_substr_def : forall (o:angle) (o':angle), ((ang_substr o o') = (ang_add o (ang_inv o'))). Axiom ang_substr_inv : forall (o:angle) (o':angle), ((ang_substr o (ang_mult_int o' (-1%Z)%Z)) = (ang_add o o')). Axiom ang_mult_int_distr : forall (o:angle) (o':angle) (n:Z), ((ang_mult_int (ang_add o o') n) = (ang_add (ang_mult_int o n) (ang_mult_int o' n))). Axiom ang_mult_int_distr_rev : forall (o:angle) (n1:Z) (n2:Z), ((ang_add (ang_mult_int o n1) (ang_mult_int o n2)) = (ang_mult_int o (n1 + n2)%Z)). Axiom ang_add_assoc : forall (o:angle) (o':angle) (o'':angle), ((ang_add o (ang_add o' o'')) = (ang_add (ang_add o o') o'')). Axiom ang_add_assoc_rev : forall (o:angle) (o':angle) (o'':angle), ((ang_add (ang_add o o') o'') = (ang_add o (ang_add o' o''))). Axiom ang_add_own_inv : forall (o:angle), ((ang_add (ang_mult_int o (-1%Z)%Z) o) = ang_zero). Axiom ang_exp_inv : forall (o:angle), ((ang_exp (ang_inv o)) = (conjugate (ang_exp o))). Parameter constant_size: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> matrix complex) -> Prop. Axiom constant_size_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> forall (e1:a), (mem e1 s) -> ((rows (f e1)) = (rows (f (choose s)))). Axiom constant_size_def1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> forall (e1:a), (mem e1 s) -> ((columns (f e1)) = (columns (f (choose s)))). Axiom constant_size_def2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = (rows (f (choose s)))) /\ ((columns (f e1)) = (columns (f (choose s))))) -> constant_size s f. Axiom set_constant_size : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ((rows (f e1)) = (rows (f e')))) -> (forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ((columns (f e1)) = (columns (f e')))) -> constant_size s f. Axiom set_constant_size_exists : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (exists r:Z, forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (exists c:Z, forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> constant_size s f. Axiom set_constant_size_t : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> constant_size s f. Parameter fc5: forall {a:Type} {a_WT:WhyType a}, (a -> matrix complex) -> (a -> bool) -> (matrix complex) -> a -> matrix complex. Axiom fc_def5 : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (p:a -> bool) (m:matrix complex) (j:a), (((p j) = true) -> (((fc5 f p m) j) = (f j))) /\ (~ ((p j) = true) -> (((fc5 f p m) j) = m)). Axiom guarded_set_constant_size : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (p:a -> bool) (m:matrix complex), (constant_size s f) -> (forall (e1:a), (mem e1 s) -> ((p e1) = true)) -> constant_size s (fc5 f p m). Axiom set_constant_size_set : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> complex) (m:matrix complex) (i:Z) (j:Z), (valid_index m i j) -> constant_size s (fun (e1:a) => (set1 m i j (f e1))). Axiom get_constant_size : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ((rows (f e1)) = (rows (f e'))). Axiom get_constant_size1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ((columns (f e1)) = (columns (f e'))). Parameter s_rows: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> matrix complex) -> Z. Axiom s_rows_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((s_rows s f) = (rows (f (choose s)))). Axiom s_rows_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> (0%Z < (s_rows s f))%Z. Axiom s_rows_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> forall (e1:a), (mem e1 s) -> ((rows (f e1)) = (s_rows s f)). Axiom s_rows_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ((rows (f e1)) = (rows (f e'))). Parameter s_columns: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> matrix complex) -> Z. Axiom s_columns_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((s_columns s f) = (columns (f (choose s)))). Axiom s_columns_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> (0%Z < (s_columns s f))%Z. Axiom s_columns_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> forall (e1:a), (mem e1 s) -> ((columns (f e1)) = (s_columns s f)). Axiom s_columns_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ((columns (f e1)) = (columns (f e'))). Axiom set_s_rows : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z), (constant_size s f) -> ((rows (f (choose s))) = r) -> ((s_rows s f) = r). Axiom set_s_rows_elt : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (elt:a), (constant_size s f) -> (mem elt s) -> ((s_rows s f) = (rows (f elt))). Axiom set_s_columns : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z), (constant_size s f) -> ((columns (f (choose s))) = r) -> ((s_columns s f) = r). Axiom set_s_columns_elt : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (elt:a), (constant_size s f) -> (mem elt s) -> ((s_columns s f) = (columns (f elt))). Axiom s_rows_eq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (g:a -> matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> ((f e1) = (g e1))) -> ((s_rows s f) = (s_rows s g)). Axiom set_constant_size_give : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> constant_size s f. Axiom set_constant_size_give1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r). Axiom set_constant_size_give2 : True. Axiom set_constant_size_give3 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ((s_rows s f) = r). Axiom set_constant_size_give4 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ((s_columns s f) = c). Axiom s_columns_eq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (g:a -> matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> ((f e1) = (g e1))) -> ((s_columns s f) = (s_columns s g)). Axiom subset_constant_size : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (f:a -> matrix complex), (constant_size s f) -> ~ (is_empty s') -> (subset s' s) -> constant_size s' f. Axiom subset_constant_size1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (f:a -> matrix complex), (constant_size s f) -> ~ (is_empty s') -> (subset s' s) -> ((s_rows s' f) = (s_rows s f)). Axiom subset_constant_size2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (f:a -> matrix complex), (constant_size s f) -> ~ (is_empty s') -> (subset s' s) -> ((s_columns s' f) = (s_columns s f)). Axiom set_s_rows_rem : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), ((cardinal s) > 1%Z)%Z -> (constant_size s f) -> constant_size (remove (choose s) s) f. Axiom set_s_rows_rem1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), ((cardinal s) > 1%Z)%Z -> (constant_size s f) -> ((s_rows (remove (choose s) s) f) = (rows (f (choose s)))). Axiom set_s_columns_rem : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), ((cardinal s) > 1%Z)%Z -> (constant_size s f) -> constant_size (remove (choose s) s) f. Axiom set_s_columns_rem1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), ((cardinal s) > 1%Z)%Z -> (constant_size s f) -> ((s_columns (remove (choose s) s) f) = (columns (f (choose s)))). Axiom set_s_rows_add : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (x:a), ((cardinal s) > 0%Z)%Z -> (constant_size s f) -> ((columns (f x)) = (s_columns s f)) -> ((rows (f x)) = (s_rows s f)) -> ((s_rows (add x s) f) = (s_rows s f)). Axiom set_s_columns_add : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (x:a), ((cardinal s) > 0%Z)%Z -> (constant_size s f) -> ((columns (f x)) = (s_columns s f)) -> ((rows (f x)) = (s_rows s f)) -> ((s_columns (add x s) f) = (s_columns s f)). Axiom set_s_rows_columns_add : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (x:a), ((cardinal s) > 0%Z)%Z -> (constant_size s f) -> ((columns (f x)) = (s_columns s f)) -> ((rows (f x)) = (s_rows s f)) -> ((s_columns (add x s) f) = (s_columns s f)). Axiom set_s_rows_columns_add1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (x:a), ((cardinal s) > 0%Z)%Z -> (constant_size s f) -> ((columns (f x)) = (s_columns s f)) -> ((rows (f x)) = (s_rows s f)) -> ((s_rows (add x s) f) = (s_rows s f)). Parameter mat_sum: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> matrix complex) -> matrix complex. Axiom mat_sum_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((cardinal s) = 1%Z) -> ((mat_sum s f) = (f (element s))). Axiom mat_sum_def1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ~ ((cardinal s) = 1%Z) -> ((mat_sum s f) = (add_mat (f (choose s)) (mat_sum (remove (choose s) s) f))). Axiom mat_sum_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((rows (mat_sum s f)) = (s_rows s f)). Axiom mat_sum_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((columns (mat_sum s f)) = (s_columns s f)). Axiom mat_sum_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> forall (e1:a), (mem e1 s) -> ((rows (f e1)) = (s_rows s f)). Axiom mat_sum_spec3 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> forall (e1:a), (mem e1 s) -> ((columns (f e1)) = (s_columns s f)). Axiom columns_mat_sum : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (n:Z), ~ ((cardinal s) = 0%Z) -> (constant_size s f) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = n)) -> ((columns (mat_sum s f)) = n). Axiom rows_mat_sum : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (n:Z), ~ ((cardinal s) = 0%Z) -> (constant_size s f) -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = n)) -> ((rows (mat_sum s f)) = n). Axiom mat_sum_cardone : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), ((cardinal s) = 1%Z) -> ((mat_sum s f) = (f (element s))). Axiom mat_sum_to_sum_pre : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (i:Z) (j:Z), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (s_rows s f))%Z) -> ((0%Z <= j)%Z /\ (j < (s_columns s f))%Z) -> ((get (mat_sum s f) i j) = (sum s (fun (e1:a) => (get (f e1) i j)))). Axiom mat_sum_to_sum : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((mat_sum s f) = (make_f (s_rows s f) (s_columns s f) (fun (i:Z) (j:Z) => (sum s (fun (e1:a) => (get (f e1) i j)))))). Axiom mat_sum_value : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (i:Z) (j:Z), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> (valid_index (mat_sum s f) i j) -> ((get (mat_sum s f) i j) = (sum s (fun (e1:a) => (get (f e1) i j)))). Axiom mat_sum_add : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (x:a), ((cardinal s) > 0%Z)%Z -> (constant_size s f) -> ((rows (f x)) = (s_rows s f)) -> ((columns (f x)) = (s_columns s f)) -> ~ (mem x s) -> ((mat_sum (add x s) f) = (add_mat (f x) (mat_sum s f))). Axiom mat_sum_plus_one : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), ((cardinal s) > 1%Z)%Z -> (constant_size s f) -> ((mat_sum s f) = (add_mat (f (choose s)) (mat_sum (remove (choose s) s) f))). Axiom mat_sum_comp_pre : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> matrix complex) (g:b -> matrix complex) (i:Z) (j:Z), (constant_size s f) -> (constant_size s g) -> ((0%Z <= i)%Z /\ (i < (s_rows s f))%Z) -> ((0%Z <= j)%Z /\ (j < (s_columns s f))%Z) -> ((s_rows s f) = (s_rows s g)) -> ((s_columns s f) = (s_columns s g)) -> ((cardinal s) > 0%Z)%Z -> ((get (mat_sum s (fun (k:b) => (add_mat (f k) (g k)))) i j) = (get (add_mat (mat_sum s f) (mat_sum s g)) i j)). Axiom mat_sum_comp : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> matrix complex) (g:b -> matrix complex), (constant_size s f) -> (constant_size s g) -> ((s_rows s f) = (s_rows s g)) -> ((s_columns s f) = (s_columns s g)) -> ((cardinal s) > 0%Z)%Z -> ((mat_sum s (fun (k:b) => (add_mat (f k) (g k)))) = (add_mat (mat_sum s f) (mat_sum s g))). Axiom mat_sum_comp_rec : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> matrix complex) (g:b -> matrix complex), (constant_size s f) -> (constant_size s g) -> ((s_rows s f) = (s_rows s g)) -> ((s_columns s f) = (s_columns s g)) -> ((cardinal s) > 0%Z)%Z -> ((add_mat (mat_sum s f) (mat_sum s g)) = (mat_sum s (fun (k:b) => (add_mat (f k) (g k))))). Axiom mat_sum_to_sum_fun : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (s':set b) (f:a -> b -> matrix complex) (r:Z) (c:Z) (i:Z) (j:Z), ((cardinal s) > 0%Z)%Z -> ((cardinal s') > 0%Z)%Z -> (forall (e1:a), forall (e11:b), (mem e1 s) -> (mem e11 s') -> ((rows ((f e1) e11)) = r)) -> (forall (e1:a), forall (e11:b), (mem e1 s) -> (mem e11 s') -> ((columns ((f e1) e11)) = c)) -> ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> ((sum s (fun (e1:a) => (get (mat_sum s' (f e1)) i j))) = (sum s (fun (e1:a) => (sum s' (fun (e11:b) => (get ((f e1) e11) i j)))))). Axiom mat_sum_to_sum_double_pre : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (s':set b) (f:a -> b -> matrix complex) (r:Z) (c:Z) (i:Z) (j:Z), (forall (e1:a) (e':b), (mem e1 s) -> (mem e' s') -> ((rows ((f e1) e')) = r)) -> (forall (e1:a) (e':b), (mem e1 s) -> (mem e' s') -> ((columns ((f e1) e')) = c)) -> ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> ((cardinal s) > 0%Z)%Z -> ((cardinal s') > 0%Z)%Z -> ((get (mat_sum s (fun (e1:a) => (mat_sum s' (f e1)))) i j) = (sum s (fun (e1:a) => (sum s' (fun (e':b) => (get ((f e1) e') i j)))))). Axiom mat_mult_sum_out_l : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (n:matrix complex), ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = (rows n))) -> (exists r:Z, forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> ((mat_mult (mat_sum s f) n) = (mat_sum s (fun (e1:a) => (mat_mult (f e1) n)))). Parameter mat_sum_dim: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> matrix complex) -> Z -> Z -> matrix complex. Axiom mat_sum_dim_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ((cardinal s) = 0%Z) -> ((mat_sum_dim s f r c) = (make r c c_zero)). Axiom mat_sum_dim_def1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ~ ((cardinal s) = 0%Z) -> ((mat_sum_dim s f r c) = (mat_sum s f)). Axiom mat_sum_dim_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ((cardinal s) > 0%Z)%Z -> ((mat_sum_dim s f r c) = (mat_sum s f)). Axiom mat_sum_dim_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ((cardinal s) = 0%Z) -> ((mat_sum_dim s f r c) = (make r c c_zero)). Axiom mat_sum_dim_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ((rows (mat_sum_dim s f r c)) = r). Axiom mat_sum_dim_spec3 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ((columns (mat_sum_dim s f r c)) = c). Axiom mat_sum_dim_to_mat_sum : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), ((cardinal s) > 0%Z)%Z -> (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ((mat_sum_dim s f r c) = (mat_sum s f)). Axiom mat_sum_dim_to_make_zero : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (r:Z) (c:Z), ((cardinal s) = 0%Z) -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> (0%Z < r)%Z -> (0%Z < c)%Z -> ((mat_sum_dim s f r c) = (make r c c_zero)). Axiom mat_sum_dim_add : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (x:a) (r:Z) (c:Z), ((cardinal s) >= 0%Z)%Z -> ~ (mem x s) -> (forall (e1:a), (mem e1 (add x s)) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 (add x s)) -> ((columns (f e1)) = c)) -> (0%Z < r)%Z -> (0%Z < c)%Z -> ((mat_sum_dim (add x s) f r c) = (add_mat (f x) (mat_sum_dim s f r c))). Axiom mat_sum_scalar : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (a1:complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((mat_sum s (fun (k:a) => (infix_asdtdt a1 (f k)))) = (infix_asdtdt a1 (mat_sum s f))). Axiom mat_sum_scalar_rev : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (a1:complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((infix_asdtdt a1 (mat_sum s f)) = (mat_sum s (fun (k:a) => (infix_asdtdt a1 (f k))))). Axiom mat_sum_const : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (x:matrix complex), ((cardinal s) > 0%Z)%Z -> ((mat_sum s (fun (us:a) => x)) = (infix_asdtdt (i_to_c (cardinal s)) x)). Axiom mat_sum_quot : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (x:matrix complex), ((cardinal s) > 0%Z)%Z -> (x = (infix_asdtdt (infix_sldt c_one (i_to_c (cardinal s))) (mat_sum s (fun (us:a) => x)))). Axiom mat_sum_scalar_right : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (i:Z) (j:Z), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (s_rows s f))%Z) -> ((0%Z <= j)%Z /\ (j < (s_columns s f))%Z) -> ((infix_asdtdt (get (mat_sum s f) i j) m) = (mat_sum s (fun (k:a) => (infix_asdtdt (get (f k) i j) m)))). Axiom mat_sum_eq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (g:a -> matrix complex), ((cardinal s) > 0%Z)%Z -> (constant_size s f) -> (forall (a1:a), (mem a1 s) -> ((f a1) = (g a1))) -> ((mat_sum s f) = (mat_sum s g)). Axiom mat_sum_eq_gen : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (f:a -> matrix complex) (g:a -> matrix complex), ((cardinal s) > 0%Z)%Z -> (s = s') -> (constant_size s f) -> (forall (a1:a), (mem a1 s) -> ((f a1) = (g a1))) -> ((mat_sum s f) = (mat_sum s' g)). Axiom mat_sum_eq_gen_int : forall (i1:Z) (i2:Z) (o1:Z) (o2:Z) (f:Z -> matrix complex) (g:Z -> matrix complex), (i1 < o1)%Z -> (i1 = o1) -> (i2 = o2) -> (constant_size (to_fset i1 o1) f) -> (forall (a:Z), (mem a (to_fset i1 o1)) -> ((f a) = (g a))) -> ((mat_sum (to_fset i1 o1) f) = (mat_sum (to_fset i2 o2) g)). Axiom mat_sum_comp_eq : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> matrix complex) (g:b -> matrix complex) (h:b -> matrix complex), (constant_size s f) -> (constant_size s g) -> (constant_size s h) -> (((s_rows s f) = (s_rows s g)) /\ ((s_rows s g) = (s_rows s h))) -> (((s_columns s f) = (s_columns s g)) /\ ((s_columns s g) = (s_columns s h))) -> ((cardinal s) > 0%Z)%Z -> (forall (e1:b), forall (i:Z) (j:Z), (mem e1 s) -> ((0%Z <= i)%Z /\ (i < (s_rows s f))%Z) -> ((0%Z <= j)%Z /\ (j < (s_columns s f))%Z) -> ((infix_pldt (get (f e1) i j) (get (g e1) i j)) = (get (h e1) i j))) -> ((add_mat (mat_sum s f) (mat_sum s g)) = (mat_sum s h)). Axiom mat_sum_dim_eq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (g:a -> matrix complex) (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> (forall (e1:a), (mem e1 s) -> ((f e1) = (g e1))) -> ((mat_sum_dim s f r c) = (mat_sum_dim s g r c)). Axiom constant_size_map : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:b -> matrix complex) (s:set a) (t:a -> b), (constant_size s (fun (a1:a) => (f (t a1)))) -> constant_size (map t s) f. Axiom map_mat_sum : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:b -> matrix complex) (s:set a) (t:a -> b), ((cardinal s) > 0%Z)%Z -> (constant_size s (fun (a1:a) => (f (t a1)))) -> (p_injective t s) -> ((mat_sum (map t s) f) = (mat_sum s (fun (a1:a) => (f (t a1))))). Axiom map_mat_sum_rec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:b -> matrix complex) (s:set a) (t:a -> b), ((cardinal s) > 0%Z)%Z -> (constant_size s (fun (a1:a) => (f (t a1)))) -> (p_injective t s) -> ((mat_sum s (fun (a1:a) => (f (t a1)))) = (mat_sum (map t s) f)). Axiom mat_sum_id : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a), ((cardinal s) > 0%Z)%Z -> (constant_size s f) -> (constant_size (map f s) (fun (y0:matrix complex) => (p_id y0))) -> (p_injective f s) -> ((mat_sum (map f s) (fun (y0:matrix complex) => (p_id y0))) = (mat_sum s f)). Parameter nonn_mat_subset: forall {a:Type} {a_WT:WhyType a}, (a -> matrix complex) -> (set a) -> set a. Parameter result10: forall {a:Type} {a_WT:WhyType a}, (a -> matrix complex) -> (set a) -> a -> bool. Axiom result_def10 : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a) (e1:a), (((result10 f s) e1) = true) <-> ~ (equal (f e1) (make (s_rows s f) (s_columns s f) c_zero)). Axiom nonn_mat_subset_def : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a), (constant_size s f) -> ((nonn_mat_subset f s) = (filter (result10 f s) s)). Axiom nonn_mat_subset_spec : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a), (constant_size s f) -> subset (nonn_mat_subset f s) s. Axiom nonn_mat_subset_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a), (constant_size s f) -> forall (e1:a), (mem e1 (nonn_mat_subset f s)) -> mem e1 s. Axiom nonn_mat_subset_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a), (constant_size s f) -> constant_size (nonn_mat_subset f s) f. Axiom nonn_mat_subset_spec3 : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a), (constant_size s f) -> ~ ((nonn_mat_subset f s) = (empty : set a)) -> ((s_rows (nonn_mat_subset f s) f) = (s_rows s f)). Axiom nonn_mat_subset_spec4 : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a), (constant_size s f) -> ~ ((nonn_mat_subset f s) = (empty : set a)) -> ((s_columns (nonn_mat_subset f s) f) = (s_columns s f)). Axiom mat_subset_elt : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a), (constant_size s f) -> forall (e1:a), (mem e1 (nonn_mat_subset f s)) -> mem e1 s. Axiom mat_subset_nonn_elt : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a), (constant_size s f) -> forall (e1:a), (mem e1 (nonn_mat_subset f s)) -> ~ ((f e1) = (make (s_rows s f) (s_columns s f) c_zero)). Axiom nonn_mat_sum_cardzero : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a) (r:Z) (c:Z), ((cardinal s) = 0%Z) -> (r > 0%Z)%Z -> (c > 0%Z)%Z -> ((mat_sum_dim s f r c) = (mat_sum_dim (nonn_mat_subset f s) f r c)). Axiom nonn_mat_sum_cardone : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a) (r:Z) (c:Z), ((cardinal s) = 1%Z) -> (r > 0%Z)%Z -> (c > 0%Z)%Z -> ((rows (f (choose s))) = r) -> ((columns (f (choose s))) = c) -> ((mat_sum_dim s f r c) = (mat_sum_dim (nonn_mat_subset f s) f r c)). Axiom mat_sum_null_but_maybe_one_elt : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a) (e1:a), ((cardinal s) > 1%Z)%Z -> (constant_size s f) -> (mem e1 s) -> (forall (e':a), (mem e' s) -> ~ (e1 = e') -> null_mat (f e')) -> ((mat_sum s f) = (f e1)). Axiom nonn_mat_sum_plus_one : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a) (r:Z) (c:Z), ((cardinal s) > 1%Z)%Z -> (r > 0%Z)%Z -> (c > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ((mat_sum_dim (remove (choose s) s) f r c) = (mat_sum_dim (nonn_mat_subset f (remove (choose s) s)) f r c)) -> ((mat_sum_dim s f r c) = (mat_sum_dim (nonn_mat_subset f s) f r c)). Axiom nonn_mat_sum : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a) (r:Z) (c:Z), (r > 0%Z)%Z -> (c > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> ((mat_sum_dim s f r c) = (mat_sum_dim (nonn_mat_subset f s) f r c)). Axiom mat_sum_map_map : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b} {c:Type} {c_WT:WhyType c}, forall (s1:set a) (s2:set b) (t1:a -> c) (t2:b -> c) (f:c -> matrix complex), ((cardinal s1) > 0%Z)%Z -> (p_injective t1 s1) -> (constant_size s1 (fun (a1:a) => (f (t1 a1)))) -> ((cardinal s2) > 0%Z)%Z -> (p_injective t2 s2) -> (constant_size s2 (fun (a1:b) => (f (t2 a1)))) -> ((map t1 s1) = (map t2 s2)) -> ((mat_sum (map t1 s1) f) = (mat_sum (map t2 s2) f)). Axiom mat_sum_disjoint_transitivity : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s1:set a) (s2:set a) (f:a -> matrix complex), (constant_size s f) -> ((inter s1 s2) = (empty : set a)) -> ((union s1 s2) = s) -> ((cardinal s1) > 0%Z)%Z -> ((cardinal s2) > 0%Z)%Z -> ((add_mat (mat_sum s1 f) (mat_sum s2 f)) = (mat_sum s f)). Axiom mat_sum_null : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a), ((cardinal s) > 1%Z)%Z -> (constant_size s f) -> (forall (e1:a), (mem e1 s) -> forall (i:Z) (j:Z), (valid_index (f e1) i j) -> ((get (f e1) i j) = c_zero)) -> forall (i:Z) (j:Z), (valid_index (mat_sum s f) i j) -> ((get (mat_sum s f) i j) = c_zero). Axiom mat_sum_null_b : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a) (r:Z) (c:Z), ((cardinal s) > 1%Z)%Z -> (forall (e1:a), (mem e1 s) -> ((rows (f e1)) = r)) -> (forall (e1:a), (mem e1 s) -> ((columns (f e1)) = c)) -> (forall (e1:a), (mem e1 s) -> forall (i:Z) (j:Z), (valid_index (f e1) i j) -> ((get (f e1) i j) = c_zero)) -> forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> ((get (mat_sum s f) i j) = c_zero). Axiom map_add_mat_sum_t : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s:set a) (s':set b) (f:b -> matrix complex) (injz:a -> b) (injo:a -> b), (constant_size s' f) -> ((cardinal s) > 0%Z)%Z -> ((inter (map injz s) (map injo s)) = (empty : set b)) -> ((union (map injz s) (map injo s)) = s') -> (p_injective injo s) -> (p_injective injz s) -> ((mat_sum s (fun (e1:a) => (add_mat (f (injz e1)) (f (injo e1))))) = (mat_sum s' f)). Axiom map_add_mat_sum : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s1:set a) (s2:set a) (s':set a) (f:a -> matrix complex) (g:a -> matrix complex) (h:a -> matrix complex), (constant_size s' h) -> (constant_size s f) -> (constant_size s g) -> (((s_rows s' h) = (s_rows s f)) /\ ((s_rows s f) = (s_rows s g))) -> (((s_columns s' h) = (s_columns s f)) /\ ((s_columns s f) = (s_columns s g))) -> ((cardinal s) > 0%Z)%Z -> (p_injective f s) -> (p_injective g s) -> (p_injective h s') -> ((map f s) = (map h s1)) -> ((map g s) = (map h s2)) -> ((inter s1 s2) = (empty : set a)) -> ((union s1 s2) = s') -> ((mat_sum s (fun (e1:a) => (add_mat (f e1) (g e1)))) = (mat_sum s' (fun (e1:a) => (h e1)))). Parameter inv_func: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (set a) -> (set b) -> b -> a. Axiom inv_func_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b) (e':b), (p_bijective f s s') -> (mem e' s') -> ((inv_func f s s' e') = (element (my_filter s (fun (e1:a) => (indic_bool (f e1) e'))))). Axiom inv_func_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b) (e':b), (p_bijective f s s') -> (mem e' s') -> mem (inv_func f s s' e') s. Axiom inv_func_spec1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b) (e':b), (p_bijective f s s') -> (mem e' s') -> ((f (inv_func f s s' e')) = e'). Axiom bijective_inv_func : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> p_bijective (fun (x:b) => (inv_func f s s' x)) s' s. Axiom inv_rec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b) (e1:a), (p_bijective f s s') -> (mem e1 s) -> ((inv_func f s s' (f e1)) = e1). Parameter inv_: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (set a) -> (set b) -> b -> a. Axiom inv__def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b) (e1:b), (p_bijective f s s') -> (mem e1 s') -> ((inv_ f s s' e1) = (inv_func f s s' e1)). Axiom inv__spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b) (e1:b), (p_bijective f s s') -> (mem e1 s') -> mem (inv_ f s s' e1) s. Axiom inv__spec1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b) (e1:b), (p_bijective f s s') -> (mem e1 s') -> ((f (inv_ f s s' e1)) = e1). Axiom inv_bijective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> p_bijective ((((fun (y0:a -> b) (y1:set a) (y2:set b) (y3:b) => (inv_ y0 y1 y2 y3)) f) s) s') s' s. Axiom set_bijective_inv : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:b -> a) (s:set a) (b1:b), (mem b1 (map f s)) -> (forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ~ (e1 = e') -> ~ ((f e1) = (f e'))) -> (forall (e':b), (mem e' (map f s)) -> (mem (g e') s) /\ ((f (g e')) = e')) -> p_bijective f s (map f s). Axiom set_bijective_inv1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:b -> a) (s:set a) (b1:b), (mem b1 (map f s)) -> (forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ~ (e1 = e') -> ~ ((f e1) = (f e'))) -> (forall (e':b), (mem e' (map f s)) -> (mem (g e') s) /\ ((f (g e')) = e')) -> ((inv_func f s (map f s) b1) = (g b1)). Axiom set_bij_inv : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:b -> a) (s:set a), (forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ~ (e1 = e') -> ~ ((f e1) = (f e'))) -> (forall (e':b), (mem e' (map f s)) -> (mem (g e') s) /\ ((f (g e')) = e')) -> p_bijective f s (map f s). Axiom set_bij_inv1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:b -> a) (s:set a), (forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ~ (e1 = e') -> ~ ((f e1) = (f e'))) -> (forall (e':b), (mem e' (map f s)) -> (mem (g e') s) /\ ((f (g e')) = e')) -> p_bijective g (map f s) s. Axiom set_bij_inv2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (g:b -> a) (s:set a), (forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ~ (e1 = e') -> ~ ((f e1) = (f e'))) -> (forall (e':b), (mem e' (map f s)) -> (mem (g e') s) /\ ((f (g e')) = e')) -> forall (b1:b), (mem b1 (map f s)) -> ((inv_func f s (map f s) b1) = (g b1)). Parameter inv_f: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (set a) -> (set b) -> b -> a. Axiom inv_f_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> forall (e1:b), (mem e1 s') -> mem ((inv_f f s s') e1) s. Axiom inv_f_spec1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> forall (e1:b), (mem e1 s') -> ((f ((inv_f f s s') e1)) = e1). Axiom inv_f_spec2 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') -> p_bijective (inv_f f s s') s' s. Axiom inv_f_back : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b) (e1:b), (mem e1 s') -> (p_bijective f s s') -> ((f ((inv_f f s s') e1)) = e1). Axiom inv_f_back_rev : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b) (e1:a), (mem e1 s) -> (p_bijective f s s') -> (((inv_f f s s') (f e1)) = e1). Axiom injective_is_bijective : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (s:set a) (s':set b), (p_injective f s) -> (forall (e1:a), (mem e1 s) -> mem (f e1) s') -> ((cardinal s) = (cardinal s')) -> p_bijective f s s'. Axiom injective_is_bijective_auto : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> a) (s:set a), (p_injective f s) -> (forall (e1:a), (mem e1 s) -> mem (f e1) s) -> p_bijective f s s. Axiom injective_is_bijective_auto1 : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> a) (s:set a), (p_injective f s) -> (forall (e1:a), (mem e1 s) -> mem (f e1) s) -> ((map f s) = s). Parameter inv_auto: forall {a:Type} {a_WT:WhyType a}, (a -> a) -> (set a) -> a -> a. Axiom inv_auto_def : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> a) (s:set a), (p_injective f s) -> (forall (e1:a), (mem e1 s) -> mem (f e1) s) -> ((inv_auto f s) = (inv_f f s s)). Axiom inv_auto_spec : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> a) (s:set a), (p_injective f s) -> (forall (e1:a), (mem e1 s) -> mem (f e1) s) -> forall (e1:a), (mem e1 s) -> mem ((inv_auto f s) e1) s. Axiom inv_auto_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> a) (s:set a), (p_injective f s) -> (forall (e1:a), (mem e1 s) -> mem (f e1) s) -> forall (e1:a), (mem e1 s) -> ((f ((inv_auto f s) e1)) = e1). Axiom inv_auto_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> a) (s:set a), (p_injective f s) -> (forall (e1:a), (mem e1 s) -> mem (f e1) s) -> p_bijective (inv_auto f s) s s. Axiom ind_isum_mod_div : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> ((int.EuclideanDivision.mod1 (ind_isum (fun (k:Z) => (((getbv bv) k) * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z) 0%Z (length bv)) (power 2%Z ((length bv) - i)%Z)) = (ind_isum (fun (k:Z) => (((getbv bv) k) * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z) i (length bv))). Axiom ind_isum_mod_div1 : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> ((int.EuclideanDivision.div (ind_isum (fun (k:Z) => (((getbv bv) k) * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z) 0%Z (length bv)) (power 2%Z ((length bv) - i)%Z)) = (ind_isum (fun (k:Z) => (((getbv bv) k) * (power 2%Z ((i - 1%Z)%Z - k)%Z))%Z) 0%Z i)). Axiom mod_ind_isum : forall (f:Z -> Z) (i:Z) (l:Z), ((0%Z <= i)%Z /\ (i <= l)%Z) -> (binary f) -> ((int.EuclideanDivision.mod1 (ind_isum (fun (k:Z) => ((f k) * (power 2%Z ((l - 1%Z)%Z - k)%Z))%Z) 0%Z l) (power 2%Z i)) = (ind_isum (fun (k:Z) => ((f k) * (power 2%Z ((l - 1%Z)%Z - k)%Z))%Z) (l - i)%Z l)). Axiom mod_ind_isum_z : forall (f:Z -> Z) (i:Z) (l:Z), ((0%Z <= i)%Z /\ (i <= l)%Z) -> (binary f) -> ((int.EuclideanDivision.mod1 (ind_isum (fun (k:Z) => ((f k) * (power 2%Z ((l - 1%Z)%Z - k)%Z))%Z) 0%Z l) (power 2%Z i)) = (ind_isum (fun (k:Z) => ((f ((k + l)%Z - i)%Z) * (power 2%Z ((i - 1%Z)%Z - k)%Z))%Z) 0%Z i)). Axiom div_ind_isum : forall (f:Z -> Z) (i:Z) (l:Z), ((0%Z <= i)%Z /\ (i <= l)%Z) -> (binary f) -> ((int.EuclideanDivision.div (ind_isum (fun (k:Z) => ((f k) * (power 2%Z ((l - 1%Z)%Z - k)%Z))%Z) 0%Z l) (power 2%Z i)) = (ind_isum (fun (k:Z) => ((f k) * (power 2%Z (((l - 1%Z)%Z - k)%Z - i)%Z))%Z) 0%Z (l - i)%Z)). Axiom ind_isum_mod : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> ((int.EuclideanDivision.mod1 (ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (i - l)%Z))%Z) 0%Z (i + 1%Z)%Z) 2%Z) = ((getbv bv) i)). Axiom mod_ind_isum_ : forall (f:Z -> Z) (i:Z) (l:Z), ((0%Z <= i)%Z /\ (i <= l)%Z) -> (binary f) -> ((int.EuclideanDivision.mod1 (ind_isum (fun (k:Z) => ((f k) * (power_ 2%Z ((l - 1%Z)%Z - k)%Z))%Z) 0%Z l) (power_ 2%Z i)) = (ind_isum (fun (k:Z) => ((f k) * (power_ 2%Z ((l - 1%Z)%Z - k)%Z))%Z) (l - i)%Z l)). Axiom mod_ind_isum_z_ : forall (f:Z -> Z) (i:Z) (l:Z), ((0%Z <= i)%Z /\ (i <= l)%Z) -> (binary f) -> ((int.EuclideanDivision.mod1 (ind_isum (fun (k:Z) => ((f k) * (power_ 2%Z ((l - 1%Z)%Z - k)%Z))%Z) 0%Z l) (power_ 2%Z i)) = (ind_isum (fun (k:Z) => ((f ((k + l)%Z - i)%Z) * (power_ 2%Z ((i - 1%Z)%Z - k)%Z))%Z) 0%Z i)). Axiom div_ind_isum_ : forall (f:Z -> Z) (i:Z) (l:Z), ((0%Z <= i)%Z /\ (i <= l)%Z) -> (binary f) -> ((int.EuclideanDivision.div (ind_isum (fun (k:Z) => ((f k) * (power_ 2%Z ((l - 1%Z)%Z - k)%Z))%Z) 0%Z l) (power_ 2%Z i)) = (ind_isum (fun (k:Z) => ((f k) * (power_ 2%Z (((l - 1%Z)%Z - k)%Z - i)%Z))%Z) 0%Z (l - i)%Z)). Axiom ind_isum_mod_ : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> ((int.EuclideanDivision.mod1 (ind_isum (fun (l:Z) => (((getbv bv) l) * (power_ 2%Z (i - l)%Z))%Z) 0%Z (i + 1%Z)%Z) 2%Z) = ((getbv bv) i)). Axiom bv_to_int_kth_pre : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < ((length bv) - 1%Z)%Z)%Z) -> (((getbv bv) k) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.div (ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) 0%Z (length bv)) (power 2%Z (((length bv) - k)%Z - 1%Z)%Z)) 2%Z)). Axiom bv_to_int_kth_pre1 : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < ((length bv) - 1%Z)%Z)%Z) -> (((getbv bv) k) = (int.EuclideanDivision.div (int.EuclideanDivision.mod1 (ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) 0%Z (length bv)) (power 2%Z ((length bv) - k)%Z)) (power 2%Z (((length bv) - k)%Z - 1%Z)%Z))). Parameter int_to_bv: Z -> Z -> bitvec. Parameter result11: Z -> Z -> Z -> Z. Axiom result_def11 : forall (i:Z) (n:Z) (k:Z), (((0%Z <= k)%Z /\ (k < n)%Z) -> (((result11 i n) k) = (int.EuclideanDivision.div (int.EuclideanDivision.mod1 i (power 2%Z (n - k)%Z)) (power 2%Z ((n - k)%Z - 1%Z)%Z)))) /\ (~ ((0%Z <= k)%Z /\ (k < n)%Z) -> (((result11 i n) k) = 0%Z)). Axiom int_to_bv_def : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((int_to_bv i n) = (make_bv (result11 i n) n)). Axiom int_to_bv_spec : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((length (int_to_bv i n)) = n). Axiom int_to_bv_spec1 : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((int_to_bv i n) = (make_bv (fun (k:Z) => (int.EuclideanDivision.div (int.EuclideanDivision.mod1 i (power 2%Z (n - k)%Z)) (power 2%Z ((n - k)%Z - 1%Z)%Z))) n)). Axiom int_to_bv_sum_pre : forall (i:Z) (n:Z) (k:Z), ((n >= k)%Z /\ (k >= 0%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((int.EuclideanDivision.mod1 i (power 2%Z k)) = (ind_isum (fun (l:Z) => (((getbv (int_to_bv i n)) l) * (power 2%Z ((n - l)%Z - 1%Z)%Z))%Z) (n - k)%Z n)). Axiom int_to_bv_sum : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (i = (ind_isum (fun (k:Z) => (((getbv (int_to_bv i n)) k) * (power 2%Z ((n - 1%Z)%Z - k)%Z))%Z) 0%Z n)). Axiom int_to_bv_sum_rev : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((ind_isum (fun (k:Z) => (((getbv (int_to_bv i n)) k) * (power_ 2%Z ((n - k)%Z - 1%Z)%Z))%Z) 0%Z n) = i). Axiom int_to_bv_mod_div : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((int_to_bv i n) = (make_bv (fun (k:Z) => (int.EuclideanDivision.mod1 (int.EuclideanDivision.div i (power 2%Z ((n - k)%Z - 1%Z)%Z)) 2%Z)) n)). Axiom mod_isum : forall (i:Z) (k:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((int.EuclideanDivision.mod1 i (power 2%Z k)) = (ind_isum (fun (l:Z) => (((getbv (int_to_bv i n)) l) * (power 2%Z ((n - 1%Z)%Z - l)%Z))%Z) (n - k)%Z n)). Axiom mod_isum_z : forall (i:Z) (k:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((int.EuclideanDivision.mod1 i (power 2%Z k)) = (ind_isum (fun (l:Z) => (((getbv (int_to_bv i n)) (l + (n - k)%Z)%Z) * (power 2%Z ((k - l)%Z - 1%Z)%Z))%Z) 0%Z k)). Axiom div_isum : forall (i:Z) (k:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((int.EuclideanDivision.div i (power 2%Z k)) = (ind_isum (fun (l:Z) => (((getbv (int_to_bv i n)) l) * (power 2%Z (((n - 1%Z)%Z - k)%Z - l)%Z))%Z) 0%Z (n - k)%Z)). Axiom int_to_bv_div_mod : forall (i:Z) (k:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((int_to_bv i n) = (make_bv (fun (k1:Z) => (int.EuclideanDivision.div (int.EuclideanDivision.mod1 i (power 2%Z (n - k1)%Z)) (power 2%Z ((n - k1)%Z - 1%Z)%Z))) n)). Axiom int_to_bv_value : forall (i:Z) (n:Z) (k:Z), (n > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> (((getbv (int_to_bv i n)) k) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.div i (power 2%Z ((n - k)%Z - 1%Z)%Z)) 2%Z)). Axiom int_to_bv_value_zero : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((i < (power 2%Z (n - 1%Z)%Z))%Z -> (((getbv (int_to_bv i n)) 0%Z) = 0%Z)) /\ (~ (i < (power 2%Z (n - 1%Z)%Z))%Z -> (((getbv (int_to_bv i n)) 0%Z) = 1%Z)). Axiom int_to_bv_mod_div_ : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((int_to_bv i n) = (make_bv (fun (k:Z) => (int.EuclideanDivision.mod1 (int.EuclideanDivision.div i (power_ 2%Z ((n - k)%Z - 1%Z)%Z)) 2%Z)) n)). Axiom mod_isum_ : forall (i:Z) (k:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((int.EuclideanDivision.mod1 i (power_ 2%Z k)) = (ind_isum (fun (l:Z) => (((getbv (int_to_bv i n)) l) * (power_ 2%Z ((n - 1%Z)%Z - l)%Z))%Z) (n - k)%Z n)). Axiom mod_isum_z_ : forall (i:Z) (k:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((int.EuclideanDivision.mod1 i (power_ 2%Z k)) = (ind_isum (fun (l:Z) => (((getbv (int_to_bv i n)) (l + (n - k)%Z)%Z) * (power_ 2%Z ((k - l)%Z - 1%Z)%Z))%Z) 0%Z k)). Axiom div_isum_ : forall (i:Z) (k:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((int.EuclideanDivision.div i (power_ 2%Z k)) = (ind_isum (fun (l:Z) => (((getbv (int_to_bv i n)) l) * (power_ 2%Z (((n - 1%Z)%Z - k)%Z - l)%Z))%Z) 0%Z (n - k)%Z)). Axiom int_to_bv_div_mod_ : forall (i:Z) (k:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((int_to_bv i n) = (make_bv (fun (k1:Z) => (int.EuclideanDivision.div (int.EuclideanDivision.mod1 i (power_ 2%Z (n - k1)%Z)) (power_ 2%Z ((n - k1)%Z - 1%Z)%Z))) n)). Axiom int_to_bv_value_ : forall (i:Z) (n:Z) (k:Z), (n > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> (((getbv (int_to_bv i n)) k) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.div i (power_ 2%Z ((n - k)%Z - 1%Z)%Z)) 2%Z)). Axiom int_to_bv_value_zero_ : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((i < (power_ 2%Z (n - 1%Z)%Z))%Z -> (((getbv (int_to_bv i n)) 0%Z) = 0%Z)) /\ (~ (i < (power_ 2%Z (n - 1%Z)%Z))%Z -> (((getbv (int_to_bv i n)) 0%Z) = 1%Z)). Axiom int_to_bv_zero : forall (n:Z), forall (k:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> (((getbv (int_to_bv 0%Z n)) k) = 0%Z). Axiom int_to_sum : forall (i:Z) (n:Z), (n > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (i = (ind_isum (fun (k:Z) => (((getbv (int_to_bv i n)) k) * (power 2%Z ((n - k)%Z - 1%Z)%Z))%Z) 0%Z n)). Axiom int_to_bv_transl : forall (i:Z) (k:Z) (n:Z) (t:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < (n - t)%Z)%Z) -> ((0%Z < t)%Z /\ (t <= n)%Z) -> (((getbv (int_to_bv (int.EuclideanDivision.mod1 i (power_ 2%Z (n - t)%Z)) (n - t)%Z)) k) = ((getbv (int_to_bv i n)) (k + t)%Z)). Axiom int_to_bv_transl_div : forall (i:Z) (k:Z) (n:Z) (n':Z) (t:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= k)%Z /\ (k < t)%Z) -> (n' = t) -> ((0%Z < t)%Z /\ (t <= n)%Z) -> (((getbv (int_to_bv (int.EuclideanDivision.div i (power_ 2%Z (n - t)%Z)) n')) k) = ((getbv (int_to_bv i n)) k)). Axiom product_int_to_bv_inv : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((i = 0%Z) -> ((ind_iproduct (fun (j:Z) => (1%Z - ((getbv (int_to_bv i n)) j))%Z) 0%Z n) = 1%Z)) /\ (~ (i = 0%Z) -> ((ind_iproduct (fun (j:Z) => (1%Z - ((getbv (int_to_bv i n)) j))%Z) 0%Z n) = 0%Z)). Parameter bin_to_int: (Z -> Z) -> Z -> Z. Axiom bin_to_int_def : forall (f:Z -> Z) (n:Z), (0%Z <= n)%Z -> (binary f) -> ((bin_to_int f n) = (bv_to_int (make_bv f n))). Axiom bin_to_int_spec : forall (f:Z -> Z) (n:Z), (0%Z <= n)%Z -> (binary f) -> ((bin_to_int f n) = (ind_isum (fun (k:Z) => ((f k) * (power 2%Z ((n - 1%Z)%Z - k)%Z))%Z) 0%Z n)). Axiom bin_to_int_spec1 : forall (f:Z -> Z) (n:Z), (0%Z <= n)%Z -> (binary f) -> (0%Z <= (bin_to_int f n))%Z. Parameter int_to_bin: Z -> Z -> Z -> Z. Axiom int_to_bin_def : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((int_to_bin i n) = (getbv (int_to_bv i n))). Axiom int_to_bin_spec : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (i = (ind_isum (fun (k:Z) => (((int_to_bin i n) k) * (power_ 2%Z ((n - 1%Z)%Z - k)%Z))%Z) 0%Z n)). Axiom int_to_bin_spec1 : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> binary (int_to_bin i n). Axiom int_to_bin_spec2 : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> forall (k:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> (((int_to_bin i n) k) = (int.EuclideanDivision.mod1 (int.EuclideanDivision.div i (power_ 2%Z ((n - k)%Z - 1%Z)%Z)) 2%Z)). Axiom int_to_bv_tail : forall (i:Z) (n:Z), (n > 1%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((int_to_bv (tail_bits i n) (n - 1%Z)%Z) = (tail (int_to_bv i n))). Axiom bound_sum_dec : forall (bv:bitvec) (i:Z), ((1%Z <= i)%Z /\ (i <= (length bv))%Z) -> ((ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z ((length bv) - l)%Z))%Z) i ((length bv) + 1%Z)%Z) < (power 2%Z (((length bv) - i)%Z + 1%Z)%Z))%Z. Axiom bv_to_int_to_bv : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((bv_to_int (int_to_bv i n)) = i). Axiom bv_to_int_to_bv_ : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((bv_to_int (int_to_bv i n)) = i). Axiom tail_bits_sum : forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((tail_bits i n) = (ind_isum (fun (l:Z) => (((getbv (int_to_bv i n)) l) * (power 2%Z ((n - 1%Z)%Z - l)%Z))%Z) 1%Z n)). Axiom int_to_bv_to_int : forall (bv:bitvec), (1%Z <= (length bv))%Z -> ((int_to_bv (bv_to_int bv) (length bv)) = bv). Axiom int_to_bv_to_int_ : forall (bv:bitvec) (l:Z), (0%Z <= l)%Z -> ((length bv) = l) -> ((int_to_bv (bv_to_int bv) l) = bv). Axiom concat_to_int : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i <= 1%Z)%Z) -> ((bv_to_int (concat_l bv i)) = ((bv_to_int bv) + (i * (power 2%Z (length bv)))%Z)%Z). Axiom bounded_to_int : forall (bv:bitvec), ((bv_to_int bv) < (power 2%Z (length bv)))%Z. Axiom int_to_bv_to_int_value : forall (bv:bitvec) (i:Z), (1%Z <= (length bv))%Z -> (((0%Z <= i)%Z /\ (i < (length bv))%Z) -> (((getbv (int_to_bv (bv_to_int bv) (length bv))) i) = ((getbv bv) i))) /\ (~ ((0%Z <= i)%Z /\ (i < (length bv))%Z) -> (((getbv (int_to_bv (bv_to_int bv) (length bv))) i) = 0%Z)). Axiom int_to_bv_to_int_gen : forall (bv:bitvec) (n:Z), (1%Z <= (length bv))%Z -> (n = (length bv)) -> ((int_to_bv (bv_to_int bv) n) = bv). Axiom bv_to_int_mod : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < (length bv))%Z) -> ((int.EuclideanDivision.mod1 (bv_to_int bv) (power 2%Z ((length bv) - k)%Z)) = (ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) k (length bv))). Axiom bv_to_int_mod_rev : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < (length bv))%Z) -> ((ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) k (length bv)) = (int.EuclideanDivision.mod1 (bv_to_int bv) (power 2%Z ((length bv) - k)%Z))). Axiom bv_to_int_mod_gen : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> forall (bv:bitvec), ((length bv) = n) -> ((int.EuclideanDivision.mod1 (bv_to_int bv) (power 2%Z ((length bv) - k)%Z)) = (ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) k (length bv))). Axiom to_int_head_tail : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> ((bv_to_int bv) = ((bv_to_int (tail bv)) + ((head bv) * (power 2%Z ((length bv) - 1%Z)%Z))%Z)%Z). Axiom to_int_head_tail1 : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> ((bv_to_int (tail bv)) = (int.EuclideanDivision.mod1 (bv_to_int bv) (power 2%Z ((length bv) - 1%Z)%Z))). Axiom not_disj : forall (a:bool) (b:bool), ~ (a = true) -> ~ (b = true) -> ~ (a = true). Axiom not_disj1 : True. Parameter my_map: forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) -> (set a) -> set b. Axiom my_map_def : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (u:set a), ((cardinal u) = 0%Z) -> ((my_map f u) = (empty : set b)). Axiom my_map_def1 : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (u:set a), ~ ((cardinal u) = 0%Z) -> ((my_map f u) = (add (f (choose u)) (my_map f (remove (choose u) u)))). Axiom my_map_spec : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (u:set a), ((my_map f u) = (map f u)). Axiom my_map_to_map : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (u:set a), ((my_map f u) = (map f u)). Axiom map_to_my_map : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:a -> b) (u:set a), ((map f u) = (my_map f u)). Parameter mapz_pre: Z -> (set bitvec) -> set bitvec. Axiom mapz_pre_def : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> ((mapz_pre n s) = (my_map (fun (bv:bitvec) => (concat_l bv 0%Z)) s)). Axiom mapz_pre_spec : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> mem (make_bv (fun (us:Z) => 0%Z) n) (mapz_pre n s). Axiom mapz_pre_spec1 : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> forall (e1:bitvec), (mem e1 (mapz_pre n s)) -> (((getbv e1) 0%Z) = 0%Z). Axiom mapz_pre_spec2 : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> forall (e1:bitvec), (mem e1 (mapz_pre n s)) -> exists bv:bitvec, (mem bv s) /\ (e1 = (concat_l bv 0%Z)). Axiom mapz_pre_spec3 : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> forall (e1:bitvec), (mem e1 (mapz_pre n s)) -> ((length e1) = n). Axiom mapz_pre_spec4 : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> forall (e1:bitvec), ((length e1) = n) -> (((getbv e1) 0%Z) = 0%Z) -> mem e1 (mapz_pre n s). Parameter mapo_pre: Z -> (set bitvec) -> set bitvec. Axiom mapo_pre_def : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> ((mapo_pre n s) = (my_map (fun (bv:bitvec) => (concat_l bv 1%Z)) s)). Axiom mapo_pre_spec : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> mem (make_bv (fun (us:Z) => 1%Z) n) (mapo_pre n s). Axiom mapo_pre_spec1 : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> forall (e1:bitvec), (mem e1 (mapo_pre n s)) -> (((getbv e1) 0%Z) = 1%Z). Axiom mapo_pre_spec2 : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> forall (e1:bitvec), (mem e1 (mapo_pre n s)) -> exists bv:bitvec, (mem bv s) /\ (e1 = (concat_l bv 1%Z)). Axiom mapo_pre_spec3 : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> forall (e1:bitvec), (mem e1 (mapo_pre n s)) -> ((length e1) = n). Axiom mapo_pre_spec4 : forall (n:Z) (s:set bitvec), (1%Z <= n)%Z -> (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> forall (e1:bitvec), ((length e1) = n) -> (((getbv e1) 0%Z) = 1%Z) -> mem e1 (mapo_pre n s). Parameter n_bvs: Z -> set bitvec. Axiom n_bvs_spec : forall (n:Z), (0%Z <= n)%Z -> (1%Z <= n)%Z -> forall (s:set bitvec), (forall (f:bitvec), (mem f s) <-> ((length f) = (n - 1%Z)%Z)) -> ((n_bvs n) = (union (mapz_pre n s) (mapo_pre n s))). Axiom n_bvs_spec1 : forall (n:Z), (0%Z <= n)%Z -> forall (f:bitvec), (mem f (n_bvs n)) -> ((length f) = n). Axiom n_bvs_spec2 : forall (n:Z), (0%Z <= n)%Z -> forall (f:bitvec), (mem f (n_bvs n)) -> ((length f) = n). Axiom n_bvs_spec3 : forall (n:Z), (0%Z <= n)%Z -> forall (f:bitvec), ((length f) = n) -> mem f (n_bvs n). Axiom n_bvs_spec4 : forall (n:Z), (0%Z <= n)%Z -> ((cardinal (n_bvs n)) > 0%Z)%Z. Axiom in_n_bvs : forall (x:bitvec) (n:Z), (0%Z <= n)%Z -> ((length x) = n) -> mem x (n_bvs n). Axiom get_in_n_bvs : forall (x:bitvec) (n:Z), (0%Z <= n)%Z -> (mem x (n_bvs n)) -> ((length x) = n). Parameter mapz: Z -> set bitvec. Axiom mapz_def : forall (n:Z), (1%Z <= n)%Z -> ((mapz n) = (mapz_pre n (n_bvs (n - 1%Z)%Z))). Axiom mapz_spec : forall (n:Z), (1%Z <= n)%Z -> ((mapz n) = (my_map (fun (bv:bitvec) => (concat_l bv 0%Z)) (n_bvs (n - 1%Z)%Z))). Axiom mapz_spec1 : forall (n:Z), (1%Z <= n)%Z -> (0%Z < (cardinal (mapz n)))%Z. Axiom mapz_spec2 : forall (n:Z), (1%Z <= n)%Z -> forall (e1:bitvec), (mem e1 (mapz n)) -> (((getbv e1) 0%Z) = 0%Z). Axiom mapz_spec3 : forall (n:Z), (1%Z <= n)%Z -> forall (e1:bitvec), (mem e1 (mapz n)) -> exists bv:bitvec, (mem bv (n_bvs (n - 1%Z)%Z)) /\ (e1 = (concat_l bv 0%Z)). Axiom mapz_spec4 : forall (n:Z), (1%Z <= n)%Z -> forall (e1:bitvec), (mem e1 (mapz n)) -> ((length e1) = n). Axiom mapz_spec5 : forall (n:Z), (1%Z <= n)%Z -> forall (e1:bitvec), ((length e1) = n) -> (((getbv e1) 0%Z) = 0%Z) -> mem e1 (mapz n). Parameter mapo: Z -> set bitvec. Axiom mapo_def : forall (n:Z), (1%Z <= n)%Z -> ((mapo n) = (mapo_pre n (n_bvs (n - 1%Z)%Z))). Axiom mapo_spec : forall (n:Z), (1%Z <= n)%Z -> ((mapo n) = (my_map (fun (bv:bitvec) => (concat_l bv 1%Z)) (n_bvs (n - 1%Z)%Z))). Axiom mapo_spec1 : forall (n:Z), (1%Z <= n)%Z -> (0%Z < (cardinal (mapo n)))%Z. Axiom mapo_spec2 : forall (n:Z), (1%Z <= n)%Z -> forall (e1:bitvec), (mem e1 (mapo n)) -> (((getbv e1) 0%Z) = 1%Z). Axiom mapo_spec3 : forall (n:Z), (1%Z <= n)%Z -> forall (e1:bitvec), (mem e1 (mapo n)) -> exists bv:bitvec, (mem bv (n_bvs (n - 1%Z)%Z)) /\ (e1 = (concat_l bv 1%Z)). Axiom mapo_spec4 : forall (n:Z), (1%Z <= n)%Z -> forall (e1:bitvec), (mem e1 (mapo n)) -> ((length e1) = n). Axiom mapo_spec5 : forall (n:Z), (1%Z <= n)%Z -> forall (e1:bitvec), ((length e1) = n) -> (((getbv e1) 0%Z) = 1%Z) -> mem e1 (mapo n). Axiom n_bvs_node : forall (n:Z), (0%Z < n)%Z -> ((inter (mapz n) (mapo n)) = (empty : set bitvec)). Axiom n_bvs_node1 : forall (n:Z), (0%Z < n)%Z -> ((union (mapz n) (mapo n)) = (n_bvs n)). Parameter n_bvsz: unit -> set bitvec. Axiom n_bvsz_def : forall (us:unit), ((n_bvsz us) = (n_bvs 0%Z)). Axiom n_bvsz_spec : forall (us:unit), forall (x:bitvec), ((length x) = 0%Z) -> mem x (n_bvsz us). Axiom n_bvsz_spec1 : forall (us:unit), forall (x:bitvec), (mem x (n_bvsz us)) -> (x = (make_bv (fun (us1:Z) => 0%Z) 0%Z)). Axiom n_bvsz_spec2 : forall (us:unit), ((n_bvsz us) = (to_set (make_bv (fun (us1:Z) => 0%Z) 0%Z))). Axiom n_bvsz_spec3 : forall (us:unit), ((choose (n_bvsz us)) = (make_bv (fun (us1:Z) => 0%Z) 0%Z)). Axiom n_bvsz_spec4 : forall (us:unit), forall (f:bitvec -> matrix complex), ((mat_sum (n_bvsz us) f) = (f (make_bv (fun (us1:Z) => 0%Z) 0%Z))). Parameter n_bvso: unit -> set bitvec. Axiom n_bvso_def : forall (us:unit), ((n_bvso us) = (n_bvs 1%Z)). Axiom n_bvso_spec : forall (us:unit), forall (x:bitvec), ((length x) = 1%Z) -> mem x (n_bvso us). Axiom n_bvso_spec1 : forall (us:unit), forall (x:bitvec), (mem x (n_bvso us)) -> ((length x) = 1%Z). Axiom n_bvso_spec2 : forall (us:unit), ((n_bvso us) = (add (make_bv (fun (us1:Z) => 0%Z) 1%Z) (to_set (make_bv (fun (us1:Z) => 1%Z) 1%Z)))). Axiom n_bvso_spec3 : forall (us:unit), forall (f:bitvec -> matrix complex), (constant_size (n_bvso us) f) -> ((mat_sum (n_bvso us) f) = (add_mat (f (make_bv (fun (us1:Z) => 0%Z) 1%Z)) (f (make_bv (fun (us1:Z) => 1%Z) 1%Z)))). Axiom injective_node : forall (n:Z), (0%Z <= n)%Z -> p_injective (fun (bv:bitvec) => (concat_l bv 0%Z)) (n_bvs n). Axiom injective_node1 : forall (n:Z), (0%Z <= n)%Z -> p_injective (fun (bv:bitvec) => (concat_l bv 1%Z)) (n_bvs n). Axiom mat_sum_n_bvs_pos : forall (n:Z) (f:bitvec -> matrix complex), (0%Z < n)%Z -> (constant_size (n_bvs n) f) -> ((mat_sum (n_bvs n) f) = (add_mat (mat_sum (n_bvs (n - 1%Z)%Z) (fun (bv:bitvec) => (f (concat_l bv 0%Z)))) (mat_sum (n_bvs (n - 1%Z)%Z) (fun (bv:bitvec) => (f (concat_l bv 1%Z)))))). Axiom mat_sum_n_bvs_null : forall (f:bitvec -> matrix complex), ((mat_sum (n_bvs 0%Z) f) = (f (make_bv ((fun (y0:Z) (y1:Z) => (const y0 y1)) 0%Z) 0%Z))). Axiom mat_sum_n_bvs_null_eq : forall (f:bitvec -> matrix complex) (x:matrix complex), (x = (f (make_bv ((fun (y0:Z) (y1:Z) => (const y0 y1)) 0%Z) 0%Z))) -> ((mat_sum (n_bvs 0%Z) f) = x). Axiom get_n_bvs : forall (bv:bitvec), mem bv (n_bvs (length bv)). Axiom get_n_bvs_gen : forall (bv:bitvec) (l:Z), (l = (length bv)) -> mem bv (n_bvs l). Axiom set_n_bvs : forall (bv:bitvec), (mem bv (n_bvs (length bv))) -> forall (i:Z), ~ (0%Z <= i)%Z -> (((getbv bv) i) = 0%Z). Axiom set_n_bvs1 : forall (bv:bitvec), (mem bv (n_bvs (length bv))) -> forall (i:Z), ~ (i < (length bv))%Z -> (((getbv bv) i) = 0%Z). Axiom int_to_bv_n_bvs : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> mem (int_to_bv i n) (n_bvs n). Axiom n_bvs_def_pos : forall (n:Z), (0%Z < n)%Z -> ((n_bvs n) = (union (map (fun (bv:bitvec) => (concat_l bv 0%Z)) (n_bvs (n - 1%Z)%Z)) (map (fun (bv:bitvec) => (concat_l bv 1%Z)) (n_bvs (n - 1%Z)%Z)))). Axiom map_n_bvs : forall (n:Z), (0%Z < n)%Z -> ((to_fset 0%Z (power 2%Z n)) = (map (fun (y0:bitvec) => (bv_to_int y0)) (n_bvs n))). Axiom ind_sum_bv : forall (f:Z -> complex) (n:Z), (1%Z <= n)%Z -> ((ind_sum f 0%Z (power_ 2%Z n)) = (sum (n_bvs n) (fun (k:bitvec) => (f (bv_to_int k))))). Parameter first_div: bitvec -> bitvec -> Z. Axiom first_div_spec : forall (bv1:bitvec) (bv2:bitvec), ((length bv1) = (length bv2)) -> ~ (bv1 = bv2) -> forall (j:Z), ((0%Z <= j)%Z /\ (j < (first_div bv1 bv2))%Z) -> (((getbv bv1) j) = ((getbv bv2) j)). Axiom first_div_spec1 : forall (bv1:bitvec) (bv2:bitvec), ((length bv1) = (length bv2)) -> ~ (bv1 = bv2) -> ((first_div bv1 bv2) < (length bv1))%Z -> ~ (((getbv bv1) (first_div bv1 bv2)) = ((getbv bv2) (first_div bv1 bv2))). Axiom first_div_spec2 : forall (bv1:bitvec) (bv2:bitvec), ((length bv1) = (length bv2)) -> ~ (bv1 = bv2) -> (0%Z <= (first_div bv1 bv2))%Z. Axiom first_div_spec3 : forall (bv1:bitvec) (bv2:bitvec), ((length bv1) = (length bv2)) -> ~ (bv1 = bv2) -> ((first_div bv1 bv2) < (length bv1))%Z. Axiom injective_concat : forall (i:Z) (n:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i <= 1%Z)%Z) -> p_injective (fun (bv:bitvec) => (concat_l bv i)) (n_bvs n). Axiom inf_first_div : forall (bv1:bitvec) (bv2:bitvec), ((length bv1) = (length bv2)) -> ~ (bv1 = bv2) -> forall (j:Z), (1%Z <= j)%Z -> ~ (((getbv bv1) j) = ((getbv bv2) j)) -> ((first_div bv1 bv2) <= j)%Z. Axiom first_div_diff : forall (bv1:bitvec) (bv2:bitvec), ((length bv1) = (length bv2)) -> ~ (bv1 = bv2) -> ~ (((getbv bv1) (first_div bv1 bv2)) = ((getbv bv2) (first_div bv1 bv2))). Axiom exists_first_div : forall (bv1:bitvec) (bv2:bitvec), ((length bv1) = (length bv2)) -> ~ (bv1 = bv2) -> exists i:Z, ((0%Z <= i)%Z /\ (i < (length bv1))%Z) /\ (i = (first_div bv1 bv2)). Axiom set_diff_length : forall (bv1:bitvec) (bv2:bitvec), ~ ((length bv1) = (length bv2)) -> ~ (bv1 = bv2). Axiom set_diff_val : forall (bv1:bitvec) (bv2:bitvec) (i:Z), ((length bv1) = (length bv2)) -> ((0%Z <= i)%Z /\ (i < (length bv1))%Z) -> ~ (((getbv bv1) i) = ((getbv bv2) i)) -> ~ (bv1 = bv2). Parameter fc6: bitvec -> Z -> Z. Parameter fc7: bitvec -> Z -> Z. Axiom fc_def6 : forall (bv:bitvec) (l:Z), ((l < (length bv))%Z -> (((fc6 bv) l) = (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z)) /\ (~ (l < (length bv))%Z -> (((fc6 bv) l) = 0%Z)). Axiom fc_def7 : forall (bv:bitvec) (l:Z), ((l < (length bv))%Z -> (((fc7 bv) l) = (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z)) /\ (~ (l < (length bv))%Z -> (((fc7 bv) l) = 0%Z)). Axiom kth_decomp : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < (length bv))%Z) -> ((bv_to_int bv) = (((ind_isum (fc6 bv) 0%Z k) + (((getbv bv) k) * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z)%Z + (ind_isum (fc7 bv) (k + 1%Z)%Z (length bv)))%Z). Axiom kth_decomp1 : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < (length bv))%Z) -> ((bv_to_int bv) = (((ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) 0%Z k) + (((getbv bv) k) * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z)%Z + (ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) (k + 1%Z)%Z (length bv)))%Z). Axiom int_to_bv_prod : forall (i:Z) (j:Z) (n:Z), (n > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> ((ind_product (fun (k:Z) => (indic ((getbv (int_to_bv i n)) k) ((getbv (int_to_bv j n)) k))) 0%Z n) = (indic i j)). Axiom int_to_bv_prod_gen : forall (i:Z) (n:Z), (n > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> forall (j:Z), ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> ((ind_product (fun (k:Z) => (indic ((getbv (int_to_bv i n)) k) ((getbv (int_to_bv j n)) k))) 0%Z n) = (indic i j)). Axiom kth_decomp_bound_zero : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < (length bv))%Z) -> (((getbv bv) k) = 0%Z) -> ((ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) 0%Z k) <= (bv_to_int bv))%Z. Axiom kth_decomp_bound_zero1 : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < (length bv))%Z) -> (((getbv bv) k) = 0%Z) -> ((bv_to_int bv) < ((ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) 0%Z k) + (power 2%Z (((length bv) - k)%Z - 1%Z)%Z))%Z)%Z. Axiom kth_decomp_bound_one : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < (length bv))%Z) -> (((getbv bv) k) = 1%Z) -> (((ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - 1%Z)%Z - l)%Z))%Z) 0%Z k) + (power 2%Z (((length bv) - k)%Z - 1%Z)%Z))%Z <= (bv_to_int bv))%Z. Axiom kth_decomp_bound_one1 : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < (length bv))%Z) -> (((getbv bv) k) = 1%Z) -> ((bv_to_int bv) < ((ind_isum (fun (l:Z) => (((getbv bv) l) * (power 2%Z (((length bv) - l)%Z - 1%Z)%Z))%Z) 0%Z k) + (power 2%Z ((length bv) - k)%Z))%Z)%Z. Axiom bv_to_int_length_2 : forall (x:bitvec), ((length x) = 2%Z) -> (((getbv x) 0%Z) = (int.EuclideanDivision.div (bv_to_int x) 2%Z)). Axiom bv_to_int_length_21 : forall (x:bitvec), ((length x) = 2%Z) -> (((getbv x) 1%Z) = (int.EuclideanDivision.mod1 (bv_to_int x) 2%Z)). Axiom bv_to_int_length_2_gen : forall (x:bitvec), ((length x) = 2%Z) -> (((getbv x) 0%Z) = (int.EuclideanDivision.div (bv_to_int x) 2%Z)). Axiom bv_to_int_length_2_gen1 : forall (x:bitvec), ((length x) = 2%Z) -> (((getbv x) 1%Z) = (int.EuclideanDivision.mod1 (bv_to_int x) 2%Z)). Parameter is_a_ket: (matrix complex) -> Prop. Axiom Is_a_ket : forall (m:matrix complex), (is_a_ket m) -> ((columns m) = 1%Z). Axiom Is_a_ket1 : forall (m:matrix complex), (is_a_ket m) -> exists s:Z, (s >= 0%Z)%Z /\ ((rows m) = (power 2%Z s)). Axiom Is_a_ket2 : forall (m:matrix complex), (((columns m) = 1%Z) /\ exists s:Z, (s >= 0%Z)%Z /\ ((rows m) = (power 2%Z s))) -> is_a_ket m. Parameter xor_i: Z -> Z -> Z. Axiom xor_i_def : forall (i:Z) (i':Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ((0%Z <= i')%Z /\ (i' < 2%Z)%Z) -> (i = 0%Z) -> ((xor_i i i') = i'). Axiom xor_i_def1 : forall (i:Z) (i':Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ((0%Z <= i')%Z /\ (i' < 2%Z)%Z) -> ~ (i = 0%Z) -> ((xor_i i i') = (1%Z - i')%Z). Axiom xor_i_spec : forall (i:Z) (i':Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ((0%Z <= i')%Z /\ (i' < 2%Z)%Z) -> (i = 0%Z) -> (i' = 0%Z) -> ((xor_i i i') = 0%Z). Axiom xor_i_spec1 : forall (i:Z) (i':Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ((0%Z <= i')%Z /\ (i' < 2%Z)%Z) -> (i = 0%Z) -> (i' = 1%Z) -> ((xor_i i i') = 1%Z). Axiom xor_i_spec2 : forall (i:Z) (i':Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ((0%Z <= i')%Z /\ (i' < 2%Z)%Z) -> (i = 1%Z) -> (i' = 0%Z) -> ((xor_i i i') = 1%Z). Axiom xor_i_spec3 : forall (i:Z) (i':Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ((0%Z <= i')%Z /\ (i' < 2%Z)%Z) -> (i = 1%Z) -> (i' = 1%Z) -> ((xor_i i i') = 0%Z). Parameter is_a_ket_l: (matrix complex) -> Z -> Prop. Axiom is_a_ket_l_def : forall (m:matrix complex) (l:Z), (is_a_ket_l m l) -> (l >= 0%Z)%Z. Axiom is_a_ket_l_def1 : forall (m:matrix complex) (l:Z), (is_a_ket_l m l) -> ((columns m) = 1%Z). Axiom is_a_ket_l_def2 : forall (m:matrix complex) (l:Z), (is_a_ket_l m l) -> ((rows m) = (power 2%Z l)). Axiom is_a_ket_l_def3 : forall (m:matrix complex) (l:Z), ((l >= 0%Z)%Z /\ (((columns m) = 1%Z) /\ ((rows m) = (power 2%Z l)))) -> is_a_ket_l m l. Axiom ket_l_rows : forall (m:matrix complex) (l:Z), (is_a_ket_l m l) -> ((rows m) = (power 2%Z l)). Axiom ket_l_columns : forall (m:matrix complex), (exists l:Z, is_a_ket_l m l) -> ((columns m) = 1%Z). Parameter ket_valid_index: (matrix complex) -> Z -> Prop. Axiom ket_valid_index_def : forall (m:matrix complex) (i:Z), (ket_valid_index m i) -> valid_index m i 0%Z. Axiom ket_valid_index_def1 : forall (m:matrix complex) (i:Z), (valid_index m i 0%Z) -> ket_valid_index m i. Parameter ket_length: (matrix complex) -> Z. Axiom ket_length_def : forall (m:matrix complex), (is_a_ket m) -> ((ket_length m) = ((binary_length (rows m)) - 1%Z)%Z). Axiom ket_length_spec : forall (m:matrix complex), (is_a_ket m) -> (0%Z <= (ket_length m))%Z. Axiom ket_length_spec1 : forall (m:matrix complex), (is_a_ket m) -> ((rows m) = (power 2%Z (ket_length m))). Parameter get_ket: (matrix complex) -> Z -> complex. Axiom get_ket_def : forall (m:matrix complex) (i:Z), ((get_ket m i) = (get m i 0%Z)). Axiom get_ket_rev : forall (m:matrix complex) (i:Z), ((get m i 0%Z) = (get_ket m i)). Parameter get_ket_bv: (matrix complex) -> bitvec -> complex. Axiom get_ket_bv_def : forall (x:matrix complex) (bv:bitvec), (is_a_ket_l x (length bv)) -> ((get_ket_bv x bv) = (get_ket x (bv_to_int bv))). Axiom get_ket_add : forall (x:matrix complex) (y:matrix complex) (i:Z), (is_a_ket x) -> (is_a_ket y) -> ((ket_length x) = (ket_length y)) -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z (ket_length y)))%Z) -> ((get_ket (add_mat x y) i) = (infix_pldt (get_ket x i) (get_ket y i))). Axiom get_ket_substr : forall (x:matrix complex) (y:matrix complex) (i:Z), (is_a_ket x) -> (is_a_ket y) -> ((ket_length x) = (ket_length y)) -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z (ket_length y)))%Z) -> ((get_ket (mat_substr x y) i) = (infix_mndt (get_ket x i) (get_ket y i))). Axiom mat_mult_ket_l : forall (m:matrix complex) (k:matrix complex) (n:Z), (is_a_ket_l k n) -> ((rows m) = (power 2%Z n)) -> ((columns m) = (power 2%Z n)) -> is_a_ket_l (mat_mult m k) n. Axiom ket_kronecker_values : forall (m:matrix complex) (n:matrix complex) (i:Z), (is_a_ket m) -> (is_a_ket n) -> ((0%Z <= i)%Z /\ (i < ((rows m) * (rows n))%Z)%Z) -> ((get_ket (kronecker m n) i) = (infix_asdt (get_ket m (int.EuclideanDivision.div i (rows n))) (get_ket n (int.EuclideanDivision.mod1 i (rows n))))). Axiom ket_l_to_ket : forall (m:matrix complex) (l:Z), (is_a_ket_l m l) -> is_a_ket m. Axiom ket_l_to_ket1 : forall (m:matrix complex) (l:Z), (is_a_ket_l m l) -> ((ket_length m) = l). Axiom ket_l_to_ket_gen : forall (m:matrix complex), (exists l:Z, is_a_ket_l m l) -> is_a_ket m. Axiom ket_to_ket_l : forall (m:matrix complex), (is_a_ket m) -> is_a_ket_l m (ket_length m). Axiom set_ket_valid_index : forall (m:matrix complex) (i:Z), (is_a_ket m) -> ((0%Z <= i)%Z /\ (i < (power 2%Z (ket_length m)))%Z) -> ket_valid_index m i. Axiom ket_to_ket_l_l : forall (m:matrix complex) (i:Z), (is_a_ket m) -> ((ket_length m) = i) -> is_a_ket_l m i. Axiom set_constant_size_ket : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), (forall (e1:a), (mem e1 s) -> is_a_ket (f e1)) -> (forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ((ket_length (f e1)) = (ket_length (f e')))) -> constant_size s f. Parameter ket_norm_l: (matrix complex) -> Z -> complex. Axiom ket_norm_l_def : forall (x:matrix complex) (n:Z), (is_a_ket_l x n) -> ((ket_norm_l x n) = (square_rt (sum (to_fset 0%Z (power 2%Z n)) (fun (k:Z) => (infix_asdt (modulus (get x k 0%Z)) (modulus (get x k 0%Z))))))). Axiom ind_sum_ket_norm_l : forall (x:matrix complex) (n:Z), (is_a_ket_l x n) -> ((ket_norm_l x n) = (square_rt (ind_sum (fun (k:Z) => (infix_asdt (modulus (get x k 0%Z)) (modulus (get x k 0%Z)))) 0%Z (power 2%Z n)))). Axiom ket_norm_one : forall (x:matrix complex) (n:Z), (n = 1%Z) -> (is_a_ket_l x n) -> ((ket_norm_l x n) = (square_rt (infix_pldt (infix_asdt (modulus (get x 0%Z 0%Z)) (modulus (get x 0%Z 0%Z))) (infix_asdt (modulus (get x 1%Z 0%Z)) (modulus (get x 1%Z 0%Z)))))). Axiom ket_norm_one_c_one : forall (x:matrix complex) (n:Z), (n = 1%Z) -> (is_a_ket_l x n) -> ((infix_pldt (infix_asdt (modulus (get x 0%Z 0%Z)) (modulus (get x 0%Z 0%Z))) (infix_asdt (modulus (get x 1%Z 0%Z)) (modulus (get x 1%Z 0%Z)))) = c_one) -> ((ket_norm_l x n) = c_one). Axiom scalar_ket_norm_l : forall (x:matrix complex) (a:complex) (n:Z), (infix_lseqdt c_zero a) -> (is_a_ket_l x n) -> ((ket_norm_l (infix_asdtdt a x) n) = (infix_asdt a (ket_norm_l x n))). Axiom zero_ket_norm_l : forall (x:matrix complex) (n:Z), (is_a_ket_l x n) -> ((ket_norm_l x n) = c_zero) -> forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (j = 0%Z) -> ((get x i j) = c_zero). Parameter normalized_l: (matrix complex) -> Z -> matrix complex. Axiom normalized_l_def : forall (x:matrix complex) (n:Z), (is_a_ket_l x n) -> (exists i:Z, ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) /\ ~ ((get x i 0%Z) = c_zero)) -> ((normalized_l x n) = (infix_asdtdt (infix_sldt c_one (ket_norm_l x n)) x)). Axiom normalized_l_spec : forall (x:matrix complex) (n:Z), (is_a_ket_l x n) -> (exists i:Z, ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) /\ ~ ((get x i 0%Z) = c_zero)) -> is_a_ket_l (normalized_l x n) n. Parameter make_ket: Z -> (Z -> complex) -> matrix complex. Axiom make_ket_def : forall (n:Z) (f:Z -> complex), (n >= 0%Z)%Z -> ((make_ket n f) = (make_f (power 2%Z n) 1%Z (fun (x:Z) (us:Z) => (f x)))). Axiom make_ket_spec : forall (n:Z) (f:Z -> complex), (n >= 0%Z)%Z -> is_a_ket_l (make_ket n f) n. Axiom make_ket_spec1 : forall (n:Z) (f:Z -> complex), (n >= 0%Z)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((get_ket (make_ket n f) i) = (f i)). Axiom make_ket_spec2 : forall (n:Z) (f:Z -> complex), (n >= 0%Z)%Z -> forall (i:Z) (j:Z), (valid_index (make_ket n f) i j) -> ((get (make_ket n f) i j) = (f i)). Axiom assert_make_ket : forall (r:Z) (c:Z) (f:Z -> complex) (i:Z), (c = 1%Z) -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z r))%Z) -> ((get_ket (make_ket r f) i) = (f i)). Axiom assert_make_ket_l : forall (l:Z) (f:Z -> complex) (i:Z), (0%Z <= l)%Z -> ((get_ket (make_ket l f) i) = (f i)). Axiom make_ket_length : forall (l:Z) (f:Z -> complex), (0%Z <= l)%Z -> ((ket_length (make_ket l f)) = l). Axiom make_ket_rows : forall (l:Z) (f:Z -> complex), (0%Z <= l)%Z -> ((rows (make_ket l f)) = (power_ 2%Z l)). Axiom make_ket_columns : forall (l:Z) (f:Z -> complex), (0%Z <= l)%Z -> ((columns (make_ket l f)) = 1%Z). Parameter make_ket_constant: Z -> complex -> matrix complex. Axiom make_ket_constant_def : forall (n:Z) (c:complex), (n >= 0%Z)%Z -> ((make_ket_constant n c) = (make_ket n (fun (i:Z) => c))). Axiom make_ket_constant_spec : forall (n:Z) (c:complex), (n >= 0%Z)%Z -> is_a_ket_l (make_ket_constant n c) n. Axiom make_ket_constant_spec1 : forall (n:Z) (c:complex), (n >= 0%Z)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((get_ket (make_ket_constant n c) i) = c). Axiom make_ket_constant_spec2 : forall (n:Z) (c:complex), (n >= 0%Z)%Z -> forall (i:Z) (j:Z), (valid_index (make_ket_constant n c) i j) -> ((get (make_ket_constant n c) i j) = c). Axiom set_equal_ket : forall (m:matrix complex) (n:matrix complex), (is_a_ket m) -> (is_a_ket n) -> ((ket_length m) = (ket_length n)) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z (ket_length m)))%Z) -> ((get_ket m i) = (get_ket n i))) -> (m = n). Axiom set_equal_ket_ : forall (m:matrix complex) (n:matrix complex), (exists l:Z, (is_a_ket_l m l) /\ ((is_a_ket_l n l) /\ forall (i:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z l))%Z) -> ((get_ket m i) = (get_ket n i)))) -> (m = n). Parameter add_ket: (matrix complex) -> (matrix complex) -> matrix complex. Axiom add_ket_def : forall (m:matrix complex) (n:matrix complex), (is_a_ket m) -> (is_a_ket n) -> ((ket_length m) = (ket_length n)) -> ((add_ket m n) = (add_mat m n)). Axiom add_ket_spec : forall (m:matrix complex) (n:matrix complex), (is_a_ket m) -> (is_a_ket n) -> ((ket_length m) = (ket_length n)) -> is_a_ket (add_ket m n). Axiom add_ket_spec1 : forall (m:matrix complex) (n:matrix complex), (is_a_ket m) -> (is_a_ket n) -> ((ket_length m) = (ket_length n)) -> ((ket_length (add_ket m n)) = (ket_length m)). Axiom add_ket_spec2 : forall (m:matrix complex) (n:matrix complex), (is_a_ket m) -> (is_a_ket n) -> ((ket_length m) = (ket_length n)) -> forall (i:Z), (ket_valid_index (add_ket m n) i) -> ((get_ket (add_ket m n) i) = (infix_pldt (get_ket m i) (get_ket n i))). Parameter add_ket_l: (matrix complex) -> (matrix complex) -> Z -> matrix complex. Axiom add_ket_l_def : forall (m:matrix complex) (n:matrix complex) (l:Z), (0%Z <= l)%Z -> ((add_ket_l m n l) = (make_ket l (fun (i:Z) => (infix_pldt (get_ket m i) (get_ket n i))))). Axiom add_ket_l_spec : forall (m:matrix complex) (n:matrix complex) (l:Z), (0%Z <= l)%Z -> is_a_ket_l (add_ket_l m n l) l. Axiom add_ket_l_spec1 : forall (m:matrix complex) (n:matrix complex) (l:Z), (0%Z <= l)%Z -> ((ket_length (add_ket_l m n l)) = l). Axiom add_ket_l_spec2 : forall (m:matrix complex) (n:matrix complex) (l:Z), (0%Z <= l)%Z -> forall (i:Z), ((get_ket (add_ket_l m n l) i) = (infix_pldt (get_ket m i) (get_ket n i))). Axiom add_ket_l_spec3 : forall (m:matrix complex) (n:matrix complex) (l:Z), (0%Z <= l)%Z -> (is_a_ket_l m l) -> (is_a_ket_l n l) -> ((add_ket_l m n l) = (add_mat m n)). Axiom add_ket_l_to_add_mat : forall (m:matrix complex) (n:matrix complex) (l:Z), (0%Z <= l)%Z -> (is_a_ket_l m l) -> (is_a_ket_l n l) -> ((add_ket_l m n l) = (add_mat m n)). Axiom null_add_ket_l : forall (m:matrix complex) (n:matrix complex) (l:Z), (is_a_ket_l m l) -> (is_a_ket_l n l) -> (null_mat m) -> ((add_ket_l m n l) = n). Axiom add_ket_l_null : forall (m:matrix complex) (n:matrix complex) (l:Z), (is_a_ket_l m l) -> (is_a_ket_l n l) -> (null_mat n) -> ((add_ket_l m n l) = m). Parameter add_ket_l_eq: (matrix complex) -> (matrix complex) -> (matrix complex) -> (matrix complex) -> Z -> unit. Axiom add_ket_l_eq_def : forall (m:matrix complex) (m':matrix complex) (n:matrix complex) (n':matrix complex) (l:Z), (is_a_ket_l m l) -> (is_a_ket_l n l) -> (m = m') -> (n = n') -> ((add_ket_l_eq m m' n n' l) = tt). Axiom add_ket_l_eq_spec : forall (m:matrix complex) (m':matrix complex) (n:matrix complex) (n':matrix complex) (l:Z), (is_a_ket_l m l) -> (is_a_ket_l n l) -> (m = m') -> (n = n') -> ((((fun (y0:matrix complex) (y1:matrix complex) (y2:Z) => (add_ket_l y0 y1 y2)) m) n) = (((fun (y0:matrix complex) (y1:matrix complex) (y2:Z) => (add_ket_l y0 y1 y2)) m') n')). Axiom add_ket_l_value : forall (m:matrix complex) (n:matrix complex) (l:Z) (i:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z l))%Z) -> (0%Z <= l)%Z -> ((get_ket (add_ket_l m n l) i) = (infix_pldt (get_ket m i) (get_ket n i))). Axiom add_ket_l_length : forall (m:matrix complex) (n:matrix complex) (l:Z), (0%Z <= l)%Z -> ((ket_length (add_ket_l m n l)) = l). Axiom add_ket_l_rows : forall (m:matrix complex) (n:matrix complex) (l:Z), (0%Z <= l)%Z -> ((rows (add_ket_l m n l)) = (power_ 2%Z l)). Axiom add_ket_l_columns : forall (m:matrix complex) (n:matrix complex) (l:Z), (0%Z <= l)%Z -> ((columns (add_ket_l m n l)) = 1%Z). Axiom add_ket_l_values : forall (m:matrix complex) (n:matrix complex) (l:Z), (0%Z <= l)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z l))%Z) -> ((get_ket (add_ket_l m n l) i) = (infix_pldt (get_ket m i) (get_ket n i))). Axiom set_equal_ket_l : forall (m:matrix complex) (n:matrix complex), (exists l:Z, (is_a_ket_l m l) /\ (is_a_ket_l n l)) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z (ket_length m)))%Z) -> ((get_ket m i) = (get_ket n i))) -> (m = n). Axiom set_equal_ket_l_ : forall (m:matrix complex) (n:matrix complex) (l:Z), (is_a_ket_l m l) -> (is_a_ket_l n l) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z l))%Z) -> ((get_ket m i) = (get_ket n i))) -> (m = n). Axiom get_ket_length : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = 1%Z) -> ((rows m) = (power 2%Z n)) -> ((ket_length m) = n). Axiom set_ket_length : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (is_a_ket m) -> ((ket_length m) = n) -> ((rows m) = (power 2%Z n)). Axiom scalar_ket : forall (x:matrix complex) (a:complex), (is_a_ket x) -> is_a_ket (infix_asdtdt a x). Axiom scalar_ket_length : forall (m:matrix complex) (a:complex), (is_a_ket m) -> ((ket_length (infix_asdtdt a m)) = (ket_length m)). Axiom scalar_ket_valid_index : forall (m:matrix complex) (a:complex) (i:Z), (ket_valid_index m i) -> (is_a_ket m) -> ket_valid_index (infix_asdtdt a m) i. Axiom scalar_ket_l : forall (x:matrix complex) (l:Z) (a:complex), (is_a_ket_l x l) -> is_a_ket_l (infix_asdtdt a x) l. Axiom scalar_ket_l_values : forall (a:complex) (x:matrix complex) (l:Z), (is_a_ket_l x l) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z l))%Z) -> ((get_ket (infix_asdtdt a x) i) = (infix_asdt a (get_ket x i))). Axiom scalar_ket_l_value : forall (a:complex) (x:matrix complex) (i:Z) (l:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z l))%Z) -> (is_a_ket_l x l) -> ((get_ket (infix_asdtdt a x) i) = (infix_asdt a (get_ket x i))). Axiom scalar_ket_value : forall (x:matrix complex) (i:Z) (a:complex), ((get_ket (infix_asdtdt a x) i) = (infix_asdt a (get_ket x i))). Axiom scalar_ket_value_rev : forall (x:matrix complex) (i:Z) (a:complex), ((infix_asdt a (get_ket x i)) = (get_ket (infix_asdtdt a x) i)). Axiom add_ket_is_a_ket : forall (x:matrix complex) (y:matrix complex), (is_a_ket x) -> (is_a_ket y) -> ((ket_length x) = (ket_length y)) -> is_a_ket (add_mat x y). Axiom set_ket_length_gen : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (is_a_ket m) -> ((power 2%Z (ket_length m)) = n) -> ((rows m) = n). Axiom set_is_a_ket : forall (m:matrix complex), ((columns m) = 1%Z) -> (exists s:Z, (s >= 0%Z)%Z /\ ((rows m) = (power 2%Z s))) -> is_a_ket m. Axiom set_is_a_ket_l : forall (m:matrix complex) (l:Z), (l >= 0%Z)%Z -> ((columns m) = 1%Z) -> ((rows m) = (power 2%Z l)) -> is_a_ket_l m l. Axiom set_is_a_ket_p : forall (m:matrix complex) (l:Z), (l >= 0%Z)%Z -> ((columns m) = 1%Z) -> ((rows m) = (power 2%Z l)) -> is_a_ket m. Axiom get_is_a_ket : forall (m:matrix complex), (is_a_ket m) -> ((columns m) = 1%Z). Axiom get_is_a_ket1 : forall (m:matrix complex), (is_a_ket m) -> ((rows m) = (power 2%Z (ket_length m))). Axiom get_ket_columns : forall (m:matrix complex), (is_a_ket m) -> ((columns m) = 1%Z). Axiom get_ket_rows : forall (m:matrix complex), (is_a_ket m) -> ((rows m) = (power 2%Z (ket_length m))). Axiom get_ket_rows_gen : forall (m:matrix complex) (i:Z), (is_a_ket m) -> (i = (power 2%Z (ket_length m))) -> ((rows m) = i). Axiom get_ket_rows_length : forall (m:matrix complex) (l:Z), (is_a_ket m) -> ((ket_length m) = l) -> ((rows m) = (power 2%Z l)). Axiom ket_kronecker : forall (m:matrix complex) (n:matrix complex), (is_a_ket m) -> (is_a_ket n) -> is_a_ket (kronecker m n). Axiom ket_kronecker1 : forall (m:matrix complex) (n:matrix complex), (is_a_ket m) -> (is_a_ket n) -> ((ket_length (kronecker m n)) = ((ket_length m) + (ket_length n))%Z). Axiom ket_kronecker_l : forall (m:matrix complex) (n:matrix complex) (l:Z) (l':Z), (is_a_ket_l m l) -> (is_a_ket_l n l') -> is_a_ket_l (kronecker m n) (l + l')%Z. Axiom set_ket_kron_l : forall (m:matrix complex) (n:matrix complex) (l:Z) (l':Z) (l'':Z), (is_a_ket_l m l) -> (is_a_ket_l n l') -> (l'' = (l + l')%Z) -> is_a_ket_l (kronecker m n) l''. Parameter ket: Z -> Z -> matrix complex. Axiom ket_def : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((ket n i) = (set1 (make (power 2%Z n) 1%Z c_zero) i 0%Z c_one)). Axiom ket_def1 : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ~ (0%Z <= i)%Z -> ((ket n i) = (make (power 2%Z n) 1%Z c_zero)). Axiom ket_def2 : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ~ (i < (power 2%Z n))%Z -> ((ket n i) = (make (power 2%Z n) 1%Z c_zero)). Axiom ket_spec : forall (n:Z) (i:Z), (0%Z <= n)%Z -> is_a_ket (ket n i). Axiom ket_spec1 : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((ket_length (ket n i)) = n). Axiom ket_spec2 : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((columns (ket n i)) = 1%Z). Axiom ket_spec3 : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((rows (ket n i)) = (power 2%Z n)). Axiom ket_spec4 : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> forall (j:Z), (valid_index (ket n i) j 0%Z) -> ((get (ket n i) j 0%Z) = (indic j i)). Axiom ket_spec5 : forall (n:Z) (i:Z), (0%Z <= n)%Z -> forall (j:Z), (valid_index (ket n i) j 0%Z) -> ~ (i = j) -> ((get (ket n i) j 0%Z) = c_zero). Axiom ket_spec6 : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((get (ket n i) i 0%Z) = c_one). Parameter scal_ket_zero: matrix complex. Axiom scal_ket_zero_def : (scal_ket_zero = (ket 0%Z 0%Z)). Parameter scal_ket_one: matrix complex. Axiom scal_ket_one_def : (scal_ket_one = (ket 0%Z 1%Z)). Axiom ket_l : forall (n:Z) (m:Z) (i:Z), (0%Z <= n)%Z -> (n = m) -> is_a_ket_l (ket n i) m. Axiom ket_ket_length : forall (n:Z) (m:Z) (i:Z), (0%Z <= n)%Z -> (n = m) -> ((ket_length (ket n i)) = m). Axiom ket_length_explicit : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((ket_length (ket n i)) = n). Axiom ket_eq : forall (n1:Z) (n2:Z) (i1:Z) (i2:Z), (0%Z <= n1)%Z -> (n1 = n2) -> (i1 = i2) -> ((ket n1 i1) = (ket n2 i2)). Axiom ket_rows : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((rows (ket n i)) = (power 2%Z n)). Axiom ket_columns : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((columns (ket n i)) = 1%Z). Axiom ket_value : forall (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> ((i = j) -> ((get (ket n i) j 0%Z) = c_one)) /\ (~ (i = j) -> ((get (ket n i) j 0%Z) = c_zero)). Axiom g_ket_value : forall (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> ((i = j) -> ((get_ket (ket n i) j) = c_one)) /\ (~ (i = j) -> ((get_ket (ket n i) j) = c_zero)). Axiom norm_ket_basis : forall (n:Z) (i:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((ket_norm_l (ket n i) n) = c_one). Axiom get_ket_ : forall (m:matrix complex) (i:Z) (n:Z), (m = (ket n i)) -> (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> is_a_ket m. Axiom get_ket_1 : forall (m:matrix complex) (i:Z) (n:Z), (m = (ket n i)) -> (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((ket_length m) = n). Axiom get_ket_2 : forall (m:matrix complex) (i:Z) (n:Z), (m = (ket n i)) -> (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((columns m) = 1%Z). Axiom get_ket_3 : forall (m:matrix complex) (i:Z) (n:Z), (m = (ket n i)) -> (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((rows m) = (power 2%Z n)). Axiom get_ket_4 : forall (m:matrix complex) (i:Z) (n:Z), (m = (ket n i)) -> (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> forall (j:Z), (valid_index m j 0%Z) -> ((get m j 0%Z) = (indic j i)). Axiom get_ket_5 : forall (m:matrix complex) (i:Z) (n:Z), (m = (ket n i)) -> (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> forall (j:Z), (valid_index m j 0%Z) -> ~ (i = j) -> ((get m j 0%Z) = c_zero). Axiom get_ket_6 : forall (m:matrix complex) (i:Z) (n:Z), (m = (ket n i)) -> (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((get m i 0%Z) = c_one). Axiom get_ket_value : forall (i:Z) (n:Z) (j:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> ((get (ket n i) j 0%Z) = (indic j i)). Axiom get_ket_values : forall (i:Z) (n:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> forall (j:Z), ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> ((get (ket n i) j 0%Z) = (indic j i)). Axiom get_ket_value_z : forall (i:Z) (n:Z) (j:Z) (z:Z), (z = 0%Z) -> (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> ((get (ket n i) j z) = (indic j i)). Axiom get__ket_value : forall (i:Z) (j:Z) (n:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> ((get_ket (ket n i) j) = (indic j i)). Axiom set_ket : forall (m:matrix complex) (i:Z) (n:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((columns m) = 1%Z) -> ((rows m) = (power 2%Z n)) -> (forall (j:Z), (valid_index m j 0%Z) -> ((get m j 0%Z) = (indic j i))) -> (m = (ket n i)). Axiom kronecker_kets : forall (i1:Z) (i2:Z) (n1:Z) (n2:Z), (0%Z <= n1)%Z -> (0%Z <= n2)%Z -> ((0%Z <= i1)%Z /\ (i1 < (power 2%Z n1))%Z) -> ((0%Z <= i2)%Z /\ (i2 < (power 2%Z n2))%Z) -> ((kronecker (ket n1 i1) (ket n2 i2)) = (ket (n1 + n2)%Z ((i1 * (power 2%Z n2))%Z + i2)%Z)). Axiom kronecker_ket_l : forall (x:matrix complex) (y:matrix complex) (n1:Z) (n2:Z), (0%Z <= n1)%Z -> (0%Z <= n2)%Z -> (is_a_ket_l x n1) -> (is_a_ket_l y n2) -> is_a_ket_l (kronecker x y) (n1 + n2)%Z. Axiom kronecker_ket_l_sum : forall (x:matrix complex) (y:matrix complex) (n1:Z) (n2:Z) (n3:Z), (0%Z <= n1)%Z -> (0%Z <= n2)%Z -> (is_a_ket_l x n1) -> (is_a_ket_l y n2) -> (n3 = (n1 + n2)%Z) -> is_a_ket_l (kronecker x y) n3. Axiom kronecker_kets_bin_to_int : forall (f1:Z -> Z) (f2:Z -> Z) (n1:Z) (n2:Z), (binary f1) -> (binary f2) -> (0%Z <= n1)%Z -> (0%Z <= n2)%Z -> ((kronecker (ket n1 (bin_to_int f1 n1)) (ket n2 (bin_to_int f2 n2))) = (ket (n1 + n2)%Z (((bin_to_int f1 n1) * (power 2%Z n2))%Z + (bin_to_int f2 n2))%Z)). Parameter concat: bitvec -> bitvec -> bitvec. Parameter result12: bitvec -> bitvec -> Z -> Z. Axiom result_def12 : forall (bv1:bitvec) (bv2:bitvec) (i:Z), ((((length bv1) <= i)%Z /\ (i < ((length bv1) + (length bv2))%Z)%Z) -> (((result12 bv1 bv2) i) = ((getbv bv2) (i - (length bv1))%Z))) /\ (~ (((length bv1) <= i)%Z /\ (i < ((length bv1) + (length bv2))%Z)%Z) -> (((result12 bv1 bv2) i) = ((getbv bv1) i))). Axiom concat_def : forall (bv1:bitvec) (bv2:bitvec), ((concat bv1 bv2) = (make_bv (result12 bv1 bv2) ((length bv1) + (length bv2))%Z)). Axiom concat_spec : forall (bv1:bitvec) (bv2:bitvec), ((length (concat bv1 bv2)) = ((length bv1) + (length bv2))%Z). Axiom concat_spec1 : forall (bv1:bitvec) (bv2:bitvec), forall (i:Z), ((0%Z <= i)%Z /\ (i < (length bv1))%Z) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv1) i)). Axiom concat_spec2 : forall (bv1:bitvec) (bv2:bitvec), forall (i:Z), ((length (concat bv1 bv2)) <= i)%Z -> (((getbv (concat bv1 bv2)) i) = ((getbv bv1) i)). Axiom concat_spec3 : forall (bv1:bitvec) (bv2:bitvec), forall (i:Z), (((length bv1) <= i)%Z /\ (i < (length (concat bv1 bv2)))%Z) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv2) (i - (length bv1))%Z)). Axiom concat_length : forall (bv1:bitvec) (bv2:bitvec), ((length (concat bv1 bv2)) = ((length bv1) + (length bv2))%Z). Parameter hpart: bitvec -> Z -> bitvec. Axiom hpart_def : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> ((hpart bv m) = (make_bv (getbv bv) m)). Axiom hpart_spec : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> ((length (hpart bv m)) = m). Axiom hpart_spec1 : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> ((length bv) = m) -> ((hpart bv m) = bv). Axiom hpart_spec2 : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> forall (k:Z), ((0%Z <= k)%Z /\ (k < m)%Z) -> (((getbv (hpart bv m)) k) = ((getbv bv) k)). Axiom hpart_spec3 : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> forall (k:Z), ~ (0%Z <= k)%Z -> (((getbv (hpart bv m)) k) = 0%Z). Axiom hpart_spec4 : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> forall (k:Z), ~ (k < m)%Z -> (((getbv (hpart bv m)) k) = 0%Z). Axiom hpart_value : forall (bv:bitvec) (m:Z) (i:Z), (0%Z <= m)%Z -> (((0%Z <= i)%Z /\ (i < m)%Z) -> (((getbv (hpart bv m)) i) = ((getbv bv) i))) /\ (~ ((0%Z <= i)%Z /\ (i < m)%Z) -> (((getbv (hpart bv m)) i) = 0%Z)). Axiom hpart_value_b : forall (bv:bitvec) (m:Z) (i:Z), ((0%Z <= i)%Z /\ (i < m)%Z) -> (((getbv (hpart bv m)) i) = ((getbv bv) i)). Parameter tpart: bitvec -> Z -> bitvec. Axiom tpart_def : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> ((length bv) >= m)%Z -> ((tpart bv m) = (make_bv (fun (k:Z) => ((getbv bv) (k + m)%Z)) ((length bv) - m)%Z)). Axiom tpart_def1 : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> ~ ((length bv) >= m)%Z -> ((tpart bv m) = (make_bv (fun (k:Z) => ((getbv bv) (k + m)%Z)) 0%Z)). Axiom tpart_spec : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> ((length bv) >= m)%Z -> ((length (tpart bv m)) = ((length bv) - m)%Z). Axiom tpart_spec1 : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> ((length bv) < m)%Z -> ((length (tpart bv m)) = 0%Z). Axiom tpart_spec2 : forall (bv:bitvec) (m:Z), (0%Z <= m)%Z -> forall (k:Z), ((0%Z <= k)%Z /\ (k < (length (tpart bv m)))%Z) -> (((getbv (tpart bv m)) k) = ((getbv bv) (k + m)%Z)). Parameter bv_tail: bitvec -> Z -> bitvec. Axiom bv_tail_def : forall (bv:bitvec) (m:Z), ((0%Z <= m)%Z /\ (m <= ((length bv) - m)%Z)%Z) -> ((bv_tail bv m) = (tpart bv ((length bv) - m)%Z)). Axiom bv_tail_spec : forall (bv:bitvec) (m:Z), ((0%Z <= m)%Z /\ (m <= ((length bv) - m)%Z)%Z) -> ((length (bv_tail bv m)) = m). Axiom bv_tail_spec1 : forall (bv:bitvec) (m:Z), ((0%Z <= m)%Z /\ (m <= ((length bv) - m)%Z)%Z) -> forall (k:Z), ((0%Z <= k)%Z /\ (k < (length (bv_tail bv m)))%Z) -> (((getbv (bv_tail bv m)) k) = ((getbv bv) (k + ((length bv) - m)%Z)%Z)). Parameter last: bitvec -> Z. Axiom last_def : forall (bv:bitvec), ((length bv) >= 1%Z)%Z -> ((last bv) = ((getbv bv) ((length bv) - 1%Z)%Z)). Parameter bv_head: bitvec -> Z -> bitvec. Axiom bv_head_def : forall (bv:bitvec) (m:Z), ((0%Z <= m)%Z /\ (m <= (length bv))%Z) -> ((bv_head bv m) = (hpart bv ((length bv) - m)%Z)). Axiom bv_head_spec : forall (bv:bitvec) (m:Z), ((0%Z <= m)%Z /\ (m <= (length bv))%Z) -> ((length (bv_head bv m)) = ((length bv) - m)%Z). Axiom bv_head_spec1 : forall (bv:bitvec) (m:Z), ((0%Z <= m)%Z /\ (m <= (length bv))%Z) -> forall (k:Z), ((0%Z <= k)%Z /\ (k < (length (bv_head bv m)))%Z) -> (((getbv (bv_head bv m)) k) = ((getbv bv) k)). Parameter htpart: bitvec -> Z -> Z -> bitvec. Axiom htpart_def : forall (bv:bitvec) (k:Z) (n:Z), (0%Z <= k)%Z -> (0%Z <= n)%Z -> ((htpart bv k n) = (make_bv (fun (i:Z) => ((getbv bv) (k + i)%Z)) n)). Axiom htpart_spec : forall (bv:bitvec) (k:Z) (n:Z), (0%Z <= k)%Z -> (0%Z <= n)%Z -> ((length (htpart bv k n)) = n). Axiom htpart_spec1 : forall (bv:bitvec) (k:Z) (n:Z), (0%Z <= k)%Z -> (0%Z <= n)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv (htpart bv k n)) i) = ((getbv bv) (k + i)%Z)). Axiom tpart_value : forall (bv:bitvec) (m:Z) (i:Z), (0%Z <= m)%Z -> (((0%Z <= i)%Z /\ (i < ((length bv) - m)%Z)%Z) -> (((getbv (tpart bv m)) i) = ((getbv bv) (i + m)%Z))) /\ (~ ((0%Z <= i)%Z /\ (i < ((length bv) - m)%Z)%Z) -> (((getbv (tpart bv m)) i) = 0%Z)). Axiom tpart_value_b : forall (bv:bitvec) (m:Z) (i:Z), (0%Z <= m)%Z -> ((0%Z <= i)%Z /\ (i < ((length bv) - m)%Z)%Z) -> (((getbv (tpart bv m)) i) = ((getbv bv) (i + m)%Z)). Axiom tpart_length : forall (bv:bitvec) (m:Z), ((0%Z <= m)%Z /\ (m <= (length bv))%Z) -> ((length (tpart bv m)) = ((length bv) - m)%Z). Axiom htpart_value : forall (bv:bitvec) (k:Z) (n:Z) (i:Z), (0%Z <= k)%Z -> (0%Z <= n)%Z -> (((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv (htpart bv k n)) i) = ((getbv bv) (k + i)%Z))) /\ (~ ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv (htpart bv k n)) i) = 0%Z)). Axiom htpart_value_b : forall (bv:bitvec) (k:Z) (n:Z) (i:Z), (0%Z <= k)%Z -> (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv (htpart bv k n)) i) = ((getbv bv) (k + i)%Z)). Axiom htpart_product_ : forall (x:bitvec) (k:Z) (n:Z) (n':Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> (n' = (n - k)%Z) -> ((ind_iproduct (getbv (htpart x k n')) 0%Z (n - k)%Z) = (ind_iproduct (getbv x) k n)). Axiom htpart_product_one : forall (x:bitvec) (k:Z) (n:Z) (n':Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((length x) = n) -> (n' = (n - k)%Z) -> ((ind_iproduct (getbv x) 0%Z n) = 1%Z) -> ((ind_iproduct (getbv (htpart x k n')) 0%Z (n - k)%Z) = 1%Z). Axiom htpart_product_zero : forall (x:bitvec) (k:Z) (n:Z) (n':Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((length x) = n) -> (n' = (n - k)%Z) -> (exists j:Z, ((k <= j)%Z /\ (j < n)%Z) /\ ~ (((getbv x) j) = 1%Z)) -> ((ind_iproduct (getbv (htpart x k n')) 0%Z (n - k)%Z) = 0%Z). Axiom htpart_product : forall (x:bitvec) (k:Z) (n:Z) (n':Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((length x) = n) -> (n' = (n - k)%Z) -> ((forall (j:Z), ((k <= j)%Z /\ (j < n)%Z) -> (((getbv x) j) = 1%Z)) -> ((ind_iproduct (getbv (htpart x k n')) 0%Z (n - k)%Z) = 1%Z)) /\ (~ (forall (j:Z), ((k <= j)%Z /\ (j < n)%Z) -> (((getbv x) j) = 1%Z)) -> ((ind_iproduct (getbv (htpart x k n')) 0%Z (n - k)%Z) = 0%Z)). Axiom htpart_length : forall (bv:bitvec) (k:Z) (n:Z), (0%Z <= k)%Z -> (0%Z <= n)%Z -> ((length (htpart bv k n)) = n). Axiom tpart_length_gen : forall (bv:bitvec) (m:Z) (l:Z), ((0%Z <= m)%Z /\ (m <= (length bv))%Z) -> (l = ((length bv) - m)%Z) -> ((length (tpart bv m)) = l). Axiom concat_value_left : forall (bv1:bitvec) (bv2:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv1))%Z) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv1) i)). Axiom concat_value : forall (bv1:bitvec) (bv2:bitvec) (i:Z), ((((length bv1) <= i)%Z /\ (i < ((length bv1) + (length bv2))%Z)%Z) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv2) (i - (length bv1))%Z))) /\ (~ (((length bv1) <= i)%Z /\ (i < ((length bv1) + (length bv2))%Z)%Z) -> (((0%Z <= i)%Z /\ (i < (length bv1))%Z) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv1) i))) /\ (~ ((0%Z <= i)%Z /\ (i < (length bv1))%Z) -> (((getbv (concat bv1 bv2)) i) = 0%Z))). Axiom concat_value_right : forall (bv1:bitvec) (bv2:bitvec) (i:Z), (((length bv1) <= i)%Z /\ (i < ((length bv1) + (length bv2))%Z)%Z) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv2) (i - (length bv1))%Z)). Axiom concat_value_out : forall (bv1:bitvec) (bv2:bitvec) (i:Z), (((length bv1) + (length bv2))%Z < i)%Z -> (((getbv (concat bv1 bv2)) i) = ((getbv bv1) i)). Axiom concat_value_tpart : forall (bv1:bitvec) (bv2:bitvec) (i:Z), (((length bv1) <= i)%Z /\ (i < (length bv2))%Z) -> (((getbv (concat bv1 (tpart bv2 (length bv1)))) i) = ((getbv bv2) i)). Axiom concat_value_ht : forall (bv1:bitvec) (bv2:bitvec) (bv3:bitvec) (bv4:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv3))%Z) -> ~ (0%Z <= i)%Z -> ~ ((length bv1) <= i)%Z -> (bv2 = (tpart bv3 (length bv1))) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv4) i)). Axiom concat_value_ht1 : forall (bv1:bitvec) (bv2:bitvec) (bv3:bitvec) (bv4:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv3))%Z) -> ~ (0%Z <= i)%Z -> (((getbv bv3) i) = ((getbv bv4) i)) -> (bv2 = (tpart bv3 (length bv1))) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv4) i)). Axiom concat_value_ht2 : forall (bv1:bitvec) (bv2:bitvec) (bv3:bitvec) (bv4:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv3))%Z) -> ~ (i < (length bv1))%Z -> ~ ((length bv1) <= i)%Z -> (bv2 = (tpart bv3 (length bv1))) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv4) i)). Axiom concat_value_ht3 : forall (bv1:bitvec) (bv2:bitvec) (bv3:bitvec) (bv4:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv3))%Z) -> ~ (i < (length bv1))%Z -> (((getbv bv3) i) = ((getbv bv4) i)) -> (bv2 = (tpart bv3 (length bv1))) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv4) i)). Axiom concat_value_ht4 : forall (bv1:bitvec) (bv2:bitvec) (bv3:bitvec) (bv4:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv3))%Z) -> (((getbv bv1) i) = ((getbv bv4) i)) -> ~ ((length bv1) <= i)%Z -> (bv2 = (tpart bv3 (length bv1))) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv4) i)). Axiom concat_value_ht5 : forall (bv1:bitvec) (bv2:bitvec) (bv3:bitvec) (bv4:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i < (length bv3))%Z) -> (((getbv bv1) i) = ((getbv bv4) i)) -> (((getbv bv3) i) = ((getbv bv4) i)) -> (bv2 = (tpart bv3 (length bv1))) -> (((getbv (concat bv1 bv2)) i) = ((getbv bv4) i)). Axiom concat_ht1 : forall (bv1:bitvec) (bv2:bitvec) (bv3:bitvec) (bv4:bitvec), (forall (i:Z), ((0%Z <= i)%Z /\ (i < (length bv1))%Z) -> (((getbv bv1) i) = ((getbv bv4) i))) -> (forall (i:Z), ((length bv1) <= i)%Z -> (((getbv bv3) i) = ((getbv bv4) i))) -> ((length bv4) = ((length bv1) + (length bv2))%Z) -> ((length bv3) >= ((length bv1) + (length bv2))%Z)%Z -> (bv2 = (tpart bv3 (length bv1))) -> ((concat bv1 bv2) = bv4). Axiom set_concat : forall (bv1:bitvec) (bv2:bitvec) (bv4:bitvec), (forall (i:Z), ((0%Z <= i)%Z /\ (i < (length bv1))%Z) -> (((getbv bv1) i) = ((getbv bv4) i))) -> (forall (i:Z), ((length bv1) <= i)%Z -> (((getbv bv2) (i - (length bv1))%Z) = ((getbv bv4) i))) -> ((length bv4) = ((length bv1) + (length bv2))%Z) -> ((concat bv1 bv2) = bv4). Axiom concat_m : forall (bv1:bitvec) (bv2:bitvec) (i1:Z) (i2:Z), (i1 > 0%Z)%Z -> (i2 > 0%Z)%Z -> ((length bv1) = i1) -> ((length bv2) = i2) -> ((concat (make_bv_m (getbv bv1) i1) (make_bv_m (getbv bv2) i2)) = (make_bv_m (getbv (concat bv1 bv2)) (i1 + i2)%Z)). Axiom concat_comm : forall (bv1:bitvec) (bv2:bitvec), ((hpart (concat bv1 bv2) (length bv1)) = bv1). Axiom concat_comm1 : forall (bv1:bitvec) (bv2:bitvec), ((tpart (concat bv1 bv2) (length bv1)) = bv2). Axiom concat_and_rec : forall (bv:bitvec) (i:Z), ((0%Z <= i)%Z /\ (i <= (length bv))%Z) -> ((concat (hpart bv i) (tpart bv i)) = bv). Parameter concat_int_bv: bitvec -> Z -> Z -> bitvec. Axiom concat_int_bv_def : forall (bv:bitvec) (i:Z) (n:Z), (n > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((concat_int_bv bv i n) = (concat bv (int_to_bv i n))). Axiom concat_int_to_bv_value : forall (bv:bitvec) (i:Z) (n:Z) (j:Z), (n > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= j)%Z /\ (j < (length (concat_int_bv bv i n)))%Z) -> (j < (length bv))%Z -> (((getbv (concat_int_bv bv i n)) j) = ((getbv bv) j)). Axiom bv_to_int_concat : forall (bvx:bitvec) (bvy:bitvec), ((bv_to_int (concat bvx bvy)) = (((power 2%Z (length bvy)) * (bv_to_int bvx))%Z + (bv_to_int bvy))%Z). Axiom concat_fin : forall (f1:Z -> Z) (f2:Z -> Z) (l1:Z) (l2:Z), (l1 >= 0%Z)%Z -> (l2 >= 0%Z)%Z -> (binary f1) -> (binary f2) -> ((make_bv ((((fun (y0:Z -> Z) (y1:Z -> Z) (y2:Z) (y3:Z) => (concat_fun y0 y1 y2 y3)) f1) f2) l1) (l1 + l2)%Z) = (concat (make_bv f1 l1) (make_bv f2 l2))). Axiom bin_to_int_concat : forall (f1:Z -> Z) (f2:Z -> Z) (l1:Z) (l2:Z), (l1 >= 0%Z)%Z -> (l2 >= 0%Z)%Z -> (binary f1) -> (binary f2) -> ((bin_to_int ((((fun (y0:Z -> Z) (y1:Z -> Z) (y2:Z) (y3:Z) => (concat_fun y0 y1 y2 y3)) f1) f2) l1) (l1 + l2)%Z) = (((power 2%Z l2) * (bin_to_int f1 l1))%Z + (bin_to_int f2 l2))%Z). Axiom bijective_concat : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> p_bijective (fun (o:(bitvec* bitvec)%type) => (concat (fir o) (sec o))) (cartesian_product (n_bvs i) (n_bvs j)) (n_bvs (i + j)%Z). Axiom bijective_concat1 : forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> p_bijective (fun (x:bitvec) => (hpart x i, tpart x i)) (n_bvs (i + j)%Z) (cartesian_product (n_bvs i) (n_bvs j)). Axiom bv_to_int_hpart : forall (bv:bitvec) (l:Z), ((0%Z <= l)%Z /\ (l <= (length bv))%Z) -> ((bv_to_int (hpart bv l)) = (int.EuclideanDivision.div (bv_to_int bv) (power 2%Z ((length bv) - l)%Z))). Axiom bv_to_int_tpart : forall (bv:bitvec) (l:Z), ((0%Z <= l)%Z /\ (l <= (length bv))%Z) -> ((bv_to_int (tpart bv l)) = (int.EuclideanDivision.mod1 (bv_to_int bv) (power 2%Z ((length bv) - l)%Z))). Axiom bv_to_int_hpart_rev : forall (bv:bitvec) (l:Z) (q:Z), (q = ((length bv) - l)%Z) -> ((0%Z <= l)%Z /\ (l <= (length bv))%Z) -> ((int.EuclideanDivision.div (bv_to_int bv) (power_ 2%Z q)) = (bv_to_int (hpart bv l))). Axiom bv_to_int_tpart_rev : forall (bv:bitvec) (l:Z) (q:Z), (q = ((length bv) - l)%Z) -> ((0%Z <= l)%Z /\ (l <= (length bv))%Z) -> ((int.EuclideanDivision.mod1 (bv_to_int bv) (power_ 2%Z q)) = (bv_to_int (tpart bv l))). Parameter ind_basis_mat: Z -> Z -> Z -> Z -> matrix complex. Axiom ind_basis_mat_def : forall (i:Z) (j:Z) (r:Z) (c:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> ((ind_basis_mat i j r c) = (make_f r c (fun (k:Z) (l:Z) => (indic_2 k i l j)))). Axiom ind_basis_mat_spec : forall (i:Z) (j:Z) (r:Z) (c:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> ((rows (ind_basis_mat i j r c)) = r). Axiom ind_basis_mat_spec1 : forall (i:Z) (j:Z) (r:Z) (c:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> ((columns (ind_basis_mat i j r c)) = c). Axiom ind_basis_mat_spec2 : forall (i:Z) (j:Z) (r:Z) (c:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> forall (k:Z) (l:Z), (valid_index (ind_basis_mat i j r c) k l) -> ((get (ind_basis_mat i j r c) k l) = (indic_2 k i l j)). Axiom ind_basis_mat_spec3 : forall (i:Z) (j:Z) (r:Z) (c:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> forall (o:(Z* Z)%type), (mem o (mat_indices (ind_basis_mat i j r c))) -> ((get (ind_basis_mat i j r c) (fir o) (sec o)) = c_one) -> ((fir o) = i). Axiom ind_basis_mat_spec4 : forall (i:Z) (j:Z) (r:Z) (c:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> forall (o:(Z* Z)%type), (mem o (mat_indices (ind_basis_mat i j r c))) -> ((get (ind_basis_mat i j r c) (fir o) (sec o)) = c_one) -> ((sec o) = j). Axiom ind_basis_mat_spec5 : forall (i:Z) (j:Z) (r:Z) (c:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> forall (o:(Z* Z)%type), (mem o (mat_indices (ind_basis_mat i j r c))) -> (((fir o) = i) /\ ((sec o) = j)) -> ((get (ind_basis_mat i j r c) (fir o) (sec o)) = c_one). Axiom ind_basis_mat_values : forall (i:Z) (j:Z) (r:Z) (c:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((0%Z <= j)%Z /\ (j < c)%Z) -> forall (i1:Z) (j1:Z), ((0%Z <= i1)%Z /\ (i1 < r)%Z) -> ((0%Z <= j1)%Z /\ (j1 < c)%Z) -> ((get (ind_basis_mat i j r c) i1 j1) = (indic_2 i i1 j j1)). Axiom unic_ind_basis_mat : forall (i1:Z) (j1:Z) (i2:Z) (j2:Z) (r:Z) (c:Z), ((0%Z <= i1)%Z /\ (i1 < r)%Z) -> ((0%Z <= j1)%Z /\ (j1 < c)%Z) -> ((0%Z <= i2)%Z /\ (i2 < r)%Z) -> ((0%Z <= j2)%Z /\ (j2 < c)%Z) -> ((ind_basis_mat i1 j1 r c) = (ind_basis_mat i2 j2 r c)) -> ((i1, j1) = (i2, j2)). Parameter basis_mat: Z -> Z -> set (matrix complex). Parameter result13: Z -> Z -> (Z* Z)%type -> matrix complex. Axiom result_def13 : forall (r:Z) (c:Z) (o:(Z* Z)%type), match o with | (i, j) => ((((0%Z <= i)%Z /\ (i < r)%Z) /\ ((0%Z <= j)%Z /\ (j < c)%Z)) -> (((result13 r c) o) = (ind_basis_mat i j r c))) /\ (~ (((0%Z <= i)%Z /\ (i < r)%Z) /\ ((0%Z <= j)%Z /\ (j < c)%Z)) -> (((result13 r c) o) = (make r c c_zero))) end. Axiom basis_mat_def : forall (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> ((basis_mat r c) = (map (result13 r c) (cartesian_product (to_fset 0%Z r) (to_fset 0%Z c)))). Axiom basis_mat_spec : forall (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> forall (m:matrix complex), (mem m (basis_mat r c)) -> exists i:Z, exists j:Z, ((0%Z <= i)%Z /\ (i < r)%Z) /\ (((0%Z <= j)%Z /\ (j < c)%Z) /\ (m = (ind_basis_mat i j r c))). Axiom basis_mat_spec1 : forall (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> forall (m:matrix complex), (exists i:Z, exists j:Z, ((0%Z <= i)%Z /\ (i < r)%Z) /\ (((0%Z <= j)%Z /\ (j < c)%Z) /\ (m = (ind_basis_mat i j r c)))) -> mem m (basis_mat r c). Axiom basis_mat_spec2 : forall (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> ((basis_mat r c) = (map (fun (o:(Z* Z)%type) => (ind_basis_mat (fir o) (sec o) r c)) (cartesian_product (to_fset 0%Z r) (to_fset 0%Z c)))). Axiom basis_mat_spec3 : forall (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> constant_size (basis_mat r c) (fun (y0:matrix complex) => (p_id y0)). Axiom basis_mat_spec4 : forall (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> ((s_columns (basis_mat r c) (fun (y0:matrix complex) => (p_id y0))) = c). Axiom basis_mat_spec5 : forall (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> ((s_rows (basis_mat r c) (fun (y0:matrix complex) => (p_id y0))) = r). Parameter fc8: (matrix complex) -> (Z* Z)%type -> bool. Axiom fc_def8 : forall (m:matrix complex) (x:(Z* Z)%type), (((fc8 m) x) = true) <-> (eq_t (get m (fir x) (sec x)) c_one). Axiom basis_mat_spec6 : forall (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> forall (m:matrix complex), (mem m (basis_mat r c)) -> ((cardinal (my_filter (mat_indices m) (fc8 m))) = 1%Z). Parameter basis_mat_indexes: (matrix complex) -> (Z* Z)%type. Parameter result14: (matrix complex) -> (Z* Z)%type -> bool. Axiom result_def14 : forall (m:matrix complex) (x:(Z* Z)%type), (((result14 m) x) = true) <-> ((mem x (mat_indices m)) /\ (equal m (ind_basis_mat (fir x) (sec x) (rows m) (columns m)))). Axiom basis_mat_indexes_def : forall (m:matrix complex), (mem m (basis_mat (rows m) (columns m))) -> ((basis_mat_indexes m) = (element (my_filter (mat_indices m) (result14 m)))). Axiom basis_mat_indexes_spec : forall (m:matrix complex), (mem m (basis_mat (rows m) (columns m))) -> (m = (ind_basis_mat (fir (basis_mat_indexes m)) (sec (basis_mat_indexes m)) (rows m) (columns m))). Axiom basis_mat_indexes_spec1 : forall (m:matrix complex), (mem m (basis_mat (rows m) (columns m))) -> (m = (make_f (rows m) (columns m) (fun (i:Z) (j:Z) => (indic_2 (fir (basis_mat_indexes m)) i (sec (basis_mat_indexes m)) j)))). Axiom basis_mat_indexes_spec2 : forall (m:matrix complex), (mem m (basis_mat (rows m) (columns m))) -> ((get m (fir (basis_mat_indexes m)) (sec (basis_mat_indexes m))) = c_one). Axiom basis_mat_indexes_spec3 : forall (m:matrix complex), (mem m (basis_mat (rows m) (columns m))) -> forall (i:Z) (j:Z), (valid_index m i j) -> (i = (fir (basis_mat_indexes m))) -> ~ (j = (sec (basis_mat_indexes m))) -> ((get m i j) = c_zero). Axiom basis_mat_indexes_spec4 : forall (m:matrix complex), (mem m (basis_mat (rows m) (columns m))) -> valid_index m (fir (basis_mat_indexes m)) (sec (basis_mat_indexes m)). Axiom get_basis_mat_indexes : forall (m:matrix complex), (mem m (basis_mat (rows m) (columns m))) -> (m = (ind_basis_mat (fir (basis_mat_indexes m)) (sec (basis_mat_indexes m)) (rows m) (columns m))). Axiom get_basis_mat_indexes1 : forall (m:matrix complex), (mem m (basis_mat (rows m) (columns m))) -> (m = (make_f (rows m) (columns m) (fun (i:Z) (j:Z) => (indic_2 (fir (basis_mat_indexes m)) i (sec (basis_mat_indexes m)) j)))). Axiom get_basis_mat_indexes2 : forall (m:matrix complex), (mem m (basis_mat (rows m) (columns m))) -> ((get m (fir (basis_mat_indexes m)) (sec (basis_mat_indexes m))) = c_one). Axiom get_basis_mat_indexes3 : forall (m:matrix complex), (mem m (basis_mat (rows m) (columns m))) -> forall (i:Z) (j:Z), (valid_index m i j) -> ~ ((basis_mat_indexes m) = (i, j)) -> ((get m i j) = c_zero). Axiom set_basis_mat_indexes : forall (m:matrix complex) (i:Z) (j:Z), (valid_index m i j) -> (mem m (basis_mat (rows m) (columns m))) -> ((get m i j) = c_one) -> ((basis_mat_indexes m) = (i, j)). Axiom set_basis_mat_indexes1 : forall (m:matrix complex) (i:Z) (j:Z), (valid_index m i j) -> (mem m (basis_mat (rows m) (columns m))) -> ((get m i j) = c_one) -> (m = (ind_basis_mat i j (rows m) (columns m))). Axiom set_basis_mat_indexes2 : forall (m:matrix complex) (i:Z) (j:Z), (valid_index m i j) -> (mem m (basis_mat (rows m) (columns m))) -> ((get m i j) = c_one) -> (m = (make_f (rows m) (columns m) (fun (i1:Z) (j1:Z) => (indic_2 i i1 j j1)))). Axiom set_basis_mat_indexes3 : forall (m:matrix complex) (i:Z) (j:Z), (valid_index m i j) -> (mem m (basis_mat (rows m) (columns m))) -> ((get m i j) = c_one) -> forall (i1:Z) (j1:Z), (valid_index m i1 j1) -> (i1 = i) -> ~ (j1 = j) -> ((get m i1 j1) = c_zero). Parameter basis_projection: (matrix complex) -> Z -> Z -> matrix complex. Axiom basis_projection_def : forall (m:matrix complex) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> ((basis_projection m i j) = (infix_asdtdt (get m i j) (ind_basis_mat i j (rows m) (columns m)))). Axiom basis_projection_spec : forall (m:matrix complex) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> ((rows (basis_projection m i j)) = (rows m)). Axiom basis_projection_spec1 : forall (m:matrix complex) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> ((columns (basis_projection m i j)) = (columns m)). Axiom basis_projection_spec2 : forall (m:matrix complex) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> ((basis_projection m i j) = (make_f (rows m) (columns m) (fun (k:Z) (l:Z) => (infix_asdt (get m i j) (indic_2 k i l j))))). Axiom basis_projection_spec3 : forall (m:matrix complex) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> ((get (basis_projection m i j) i j) = (get m i j)). Axiom basis_projection_spec4 : forall (m:matrix complex) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> forall (i':Z) (j':Z), (valid_index (basis_projection m i j) i' j') -> ~ (i' = i) -> ((get (basis_projection m i j) i' j') = c_zero). Axiom basis_projection_spec5 : forall (m:matrix complex) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> ((0%Z <= j)%Z /\ (j < (columns m))%Z) -> forall (i':Z) (j':Z), (valid_index (basis_projection m i j) i' j') -> ~ (j' = j) -> ((get (basis_projection m i j) i' j') = c_zero). Axiom basis_projection_null : forall (m:matrix complex) (i:Z) (j:Z) (k:Z) (l:Z), (valid_index m i j) -> (valid_index m k l) -> ~ (i = k) -> ((get (basis_projection m i j) k l) = c_zero). Axiom basis_projection_null1 : forall (m:matrix complex) (i:Z) (j:Z) (k:Z) (l:Z), (valid_index m i j) -> (valid_index m k l) -> ~ (j = l) -> ((get (basis_projection m i j) k l) = c_zero). Parameter basis_projections: (matrix complex) -> set (matrix complex). Parameter result15: (matrix complex) -> (Z* Z)%type -> matrix complex. Axiom result_def15 : forall (m:matrix complex) (o:(Z* Z)%type), ((valid_index m (fir o) (sec o)) -> (((result15 m) o) = (basis_projection m (fir o) (sec o)))) /\ (~ (valid_index m (fir o) (sec o)) -> (((result15 m) o) = m)). Axiom basis_projections_def : forall (m:matrix complex), ((basis_projections m) = (map (result15 m) (to_indexes m))). Axiom basis_projections_spec : forall (m:matrix complex), ((basis_projections m) = (map ((fun (y0:Z -> Z -> matrix complex) (y1:(Z* Z)%type) => (couple y0 y1)) ((fun (y0:matrix complex) (y1:Z) (y2:Z) => (basis_projection y0 y1 y2)) m)) (to_indexes m))). Axiom basis_projections_spec1 : forall (m:matrix complex), forall (e1:matrix complex), (mem e1 (basis_projections m)) -> ((rows e1) = (rows m)). Axiom basis_projections_spec2 : forall (m:matrix complex), forall (e1:matrix complex), (mem e1 (basis_projections m)) -> ((columns e1) = (columns m)). Axiom basis_projections_spec3 : forall (m:matrix complex), constant_size (basis_projections m) (fun (y0:matrix complex) => (p_id y0)). Parameter fc9: (matrix complex) -> (Z* Z)%type -> matrix complex. Axiom fc_def9 : forall (m:matrix complex) (o:(Z* Z)%type), ((valid_index m (fir o) (sec o)) -> (((fc9 m) o) = (basis_projection m (fir o) (sec o)))) /\ (~ (valid_index m (fir o) (sec o)) -> (((fc9 m) o) = m)). Axiom rewrite_basis_projections : forall (m:matrix complex), ((basis_projections m) = (map (fc9 m) (to_indexes m))). Parameter indexes_decomp: (matrix complex) -> matrix complex. Parameter result16: (matrix complex) -> (Z* Z)%type -> matrix complex. Axiom result_def16 : forall (m:matrix complex) (o:(Z* Z)%type), ((mem o (to_indexes m)) -> (((result16 m) o) = (basis_projection m (fir o) (sec o)))) /\ (~ (mem o (to_indexes m)) -> (((result16 m) o) = m)). Axiom indexes_decomp_def : forall (m:matrix complex), ((indexes_decomp m) = (mat_sum (to_indexes m) (result16 m))). Axiom indexes_decomp_spec : forall (m:matrix complex), ((rows (indexes_decomp m)) = (rows m)). Axiom indexes_decomp_spec1 : forall (m:matrix complex), ((columns (indexes_decomp m)) = (columns m)). Axiom rewrite_indexes_decomp : forall (m:matrix complex), ((indexes_decomp m) = (mat_sum (to_indexes m) (fun (o:(Z* Z)%type) => (basis_projection m (fir o) (sec o))))). Axiom indexes_decomp_pre : forall (m:matrix complex) (i:Z) (j:Z), (valid_index m i j) -> ((get m i j) = (sum (to_indexes m) (fun (o:(Z* Z)%type) => (get (basis_projection m (fir o) (sec o)) i j)))). Axiom indexes_decomp_pre_gen : forall (m:matrix complex), forall (i:Z) (j:Z), (valid_index m i j) -> ((get m i j) = (sum (to_indexes m) (fun (o:(Z* Z)%type) => (get (basis_projection m (fir o) (sec o)) i j)))). Axiom mat_to_indexes_decomp : forall (m:matrix complex), (m = (indexes_decomp m)). Parameter basis_decomp: (matrix complex) -> matrix complex. Axiom basis_decomp_def : forall (m:matrix complex), ((basis_decomp m) = (mat_sum (basis_projections m) (fun (y0:matrix complex) => (p_id y0)))). Axiom basis_decomp_spec : forall (m:matrix complex), ((rows (basis_decomp m)) = (rows m)). Axiom basis_decomp_spec1 : forall (m:matrix complex), ((columns (basis_decomp m)) = (columns m)). Axiom indexes_basis_decomp_equal_pre : forall (m:matrix complex) (i:Z) (j:Z), (valid_index m i j) -> ((get (indexes_decomp m) i j) = (get (basis_decomp m) i j)). Axiom indexes_basis_decomp_equal : forall (m:matrix complex), ((indexes_decomp m) = (basis_decomp m)). Axiom mat_to_basis_decomp : forall (m:matrix complex), (m = (indexes_decomp m)). Parameter fc10: forall {a:Type} {a_WT:WhyType a}, (matrix complex) -> (set a) -> (a -> matrix complex) -> a -> matrix complex. Axiom fc_def10 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix complex) (s:set a) (f:a -> matrix complex) (a1:a), ((mem a1 s) -> (((fc10 m s f) a1) = (mat_mult m (f a1)))) /\ (~ (mem a1 s) -> (((fc10 m s f) a1) = m)). Axiom product_mat_sum_r_pre : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix complex) (s':set a) (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((columns m) = (s_rows s f)) -> (subset s' s) -> ((cardinal s') > 0%Z)%Z -> ((mat_mult m (mat_sum s' f)) = (mat_sum s' (fc10 m s f))). Axiom product_mat_sum_r_pre1 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix complex) (s':set a) (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((columns m) = (s_rows s f)) -> (subset s' s) -> ((cardinal s') > 0%Z)%Z -> ((mat_mult m (mat_sum s' f)) = (mat_sum s' (fun (a1:a) => (mat_mult m (f a1))))). Axiom product_mat_sum_r_pre2 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix complex) (s':set a) (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((columns m) = (s_rows s f)) -> (subset s' s) -> ((cardinal s') > 0%Z)%Z -> ((rows (mat_sum s' f)) = (s_rows s f)). Axiom product_mat_sum_r_pre3 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix complex) (s':set a) (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((columns m) = (s_rows s f)) -> (subset s' s) -> ((cardinal s') > 0%Z)%Z -> ((columns (mat_sum s' f)) = (s_columns s f)). Axiom product_mat_sum_r_pre4 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix complex) (s':set a) (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((columns m) = (s_rows s f)) -> (subset s' s) -> ((cardinal s') > 0%Z)%Z -> ((rows (mat_mult m (mat_sum s' f))) = (rows m)). Axiom product_mat_sum_r_pre5 : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix complex) (s':set a) (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((columns m) = (s_rows s f)) -> (subset s' s) -> ((cardinal s') > 0%Z)%Z -> ((columns (mat_mult m (mat_sum s' f))) = (s_columns s f)). Axiom product_mat_sum_r : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix complex) (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((columns m) = (s_rows s f)) -> ((cardinal s) > 0%Z)%Z -> ((mat_mult m (mat_sum s f)) = (mat_sum s (fun (a1:a) => (mat_mult m (f a1))))). Axiom product_mat_sum_r_rev : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix complex) (s:set a) (f:a -> matrix complex), (constant_size s f) -> ((columns m) = (s_rows s f)) -> ((cardinal s) > 0%Z)%Z -> ((mat_sum s (fun (a1:a) => (mat_mult m (f a1)))) = (mat_mult m (mat_sum s f))). Axiom p_injective_proj : forall (m:matrix complex), p_injective ((fun (y0:Z -> Z -> matrix complex) (y1:(Z* Z)%type) => (couple y0 y1)) ((fun (y0:matrix complex) (y1:Z) (y2:Z) => (basis_projection y0 y1 y2)) m)) (nonn_mat_subset ((fun (y0:Z -> Z -> matrix complex) (y1:(Z* Z)%type) => (couple y0 y1)) ((fun (y0:matrix complex) (y1:Z) (y2:Z) => (basis_projection y0 y1 y2)) m)) (to_indexes m)). Axiom mat_decomp_equal_indexes : forall (m:matrix complex), (m = (indexes_decomp m)). Parameter ket_basis: Z -> set (matrix complex). Axiom ket_basis_def : forall (n:Z), (0%Z <= n)%Z -> ((ket_basis n) = (basis_mat (power 2%Z n) 1%Z)). Axiom ket_basis_spec : forall (n:Z), (0%Z <= n)%Z -> ((ket_basis n) = (map (fun (o:(Z* Z)%type) => (ind_basis_mat (fir o) (sec o) (power 2%Z n) 1%Z)) (cartesian_product (to_fset 0%Z (power 2%Z n)) (to_fset 0%Z 1%Z)))). Axiom ket_basis_spec1 : forall (n:Z), (0%Z <= n)%Z -> ((ket_basis n) = (basis_mat (power 2%Z n) 1%Z)). Axiom ket_basis_spec2 : forall (n:Z), (0%Z <= n)%Z -> forall (mat:matrix complex), (mem mat (ket_basis n)) -> ((rows mat) = (power 2%Z n)). Axiom ket_basis_spec3 : forall (n:Z), (0%Z <= n)%Z -> forall (mat:matrix complex), (mem mat (ket_basis n)) -> ((columns mat) = 1%Z). Axiom ket_basis_spec4 : forall (n:Z), (0%Z <= n)%Z -> forall (mat:matrix complex), (mem mat (ket_basis n)) -> ((rows mat) = (power 2%Z n)). Axiom ket_basis_spec5 : forall (n:Z), (0%Z <= n)%Z -> forall (mat:matrix complex), (mem mat (ket_basis n)) -> ((columns mat) = 1%Z). Axiom ket_basis_spec6 : forall (n:Z), (0%Z <= n)%Z -> forall (mat:matrix complex), (mem mat (ket_basis n)) -> exists i:Z, (valid_index mat i 0%Z) /\ ((basis_mat_indexes mat) = (i, 0%Z)). Axiom unary_ket_basis : forall (n:Z), (0%Z <= n)%Z -> ((ket_basis n) = (map (fun (i:Z) => (ind_basis_mat i 0%Z (power 2%Z n) 1%Z)) (to_fset 0%Z (power 2%Z n)))). Axiom to_ket_basis : forall (i:Z) (n:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> mem (ind_basis_mat i 0%Z (power 2%Z n) 1%Z) (ket_basis n). Parameter ket_basis_index: (matrix complex) -> Z -> Z. Axiom ket_basis_index_def : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (mem m (ket_basis n)) -> ((ket_basis_index m n) = (fir (basis_mat_indexes m))). Axiom ket_basis_index_spec : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (mem m (ket_basis n)) -> mem (ind_basis_mat (ket_basis_index m n) 0%Z (power 2%Z n) 1%Z) (ket_basis n). Axiom ket_basis_index_spec1 : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (mem m (ket_basis n)) -> (m = (make_f (rows m) 1%Z (fun (i:Z) (us:Z) => (indic (ket_basis_index m n) i)))). Axiom ket_basis_index_spec2 : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (mem m (ket_basis n)) -> forall (i:Z), (valid_index m i 0%Z) -> ~ (i = (ket_basis_index m n)) -> ((get m i 0%Z) = c_zero). Axiom ket_basis_index_spec3 : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (mem m (ket_basis n)) -> valid_index m (ket_basis_index m n) 0%Z. Axiom set_ket_basis : forall (m:matrix complex) (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (mem m (ket_basis n)) -> ((get m i 0%Z) = c_one) -> ((ket_basis_index m n) = i). Axiom set_ket_basis1 : forall (m:matrix complex) (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (mem m (ket_basis n)) -> ((get m i 0%Z) = c_one) -> forall (i1:Z), (valid_index m i1 0%Z) -> ~ (i1 = i) -> ((get m i1 0%Z) = c_zero). Axiom set_ket_basis2 : forall (m:matrix complex) (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (mem m (ket_basis n)) -> ((get m i 0%Z) = c_one) -> mem m (ket_basis n). Axiom set_ket_basis3 : forall (m:matrix complex) (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (mem m (ket_basis n)) -> ((get m i 0%Z) = c_one) -> (m = (make_f (rows m) (columns m) (fun (i1:Z) (us:Z) => (indic i i1)))). Axiom from_ket_basis : forall (n:Z) (m:matrix complex), (0%Z <= n)%Z -> (mem m (ket_basis n)) -> exists i:Z, ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) /\ (m = (ind_basis_mat i 0%Z (power 2%Z n) 1%Z)). Axiom int_to_ket_basis : forall (n:Z) (i:Z), (n > 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> mem (ket n i) (ket_basis n). Parameter is_a_ket_basis_elt: (matrix complex) -> Prop. Axiom is_a_ket_basis_elt_def : forall (m:matrix complex), (is_a_ket_basis_elt m) -> is_a_ket m. Axiom is_a_ket_basis_elt_def1 : forall (m:matrix complex), (is_a_ket_basis_elt m) -> mem m (ket_basis (ket_length m)). Axiom is_a_ket_basis_elt_def2 : forall (m:matrix complex), ((is_a_ket m) /\ (mem m (ket_basis (ket_length m)))) -> is_a_ket_basis_elt m. Axiom ket_basis_elt_are_kets : forall (m:matrix complex), (is_a_ket_basis_elt m) -> is_a_ket m. Axiom get_is_a_ket_basis_elt : forall (m:matrix complex), (is_a_ket_basis_elt m) -> is_a_ket m. Axiom get_is_a_ket_basis_elt1 : forall (m:matrix complex), (is_a_ket_basis_elt m) -> mem m (ket_basis (ket_length m)). Axiom get_is_a_ket_basis_elt2 : forall (m:matrix complex), (is_a_ket_basis_elt m) -> exists i:Z, ((0%Z <= i)%Z /\ (i < (power 2%Z (ket_length m)))%Z) /\ (m = (ket (ket_length m) i)). Axiom get_is_a_ket_basis_elt3 : forall (m:matrix complex), (is_a_ket_basis_elt m) -> exists i:Z, ((0%Z <= i)%Z /\ (i < (power 2%Z (ket_length m)))%Z) /\ (((get m i 0%Z) = c_one) /\ forall (j:Z), (((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length m)))%Z) /\ ~ ((get m j 0%Z) = c_zero)) -> (i = j)). Axiom get_is_a_ket_basis_elt4 : forall (m:matrix complex), (is_a_ket_basis_elt m) -> forall (i:Z), (((0%Z <= i)%Z /\ (i < (power 2%Z (ket_length m)))%Z) /\ ((get m i 0%Z) = c_one)) -> forall (j:Z), (((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length m)))%Z) /\ ~ ((get m j 0%Z) = c_zero)) -> (i = j). Axiom get_is_a_ket_basis_elt_indic : forall (m:matrix complex), (is_a_ket_basis_elt m) -> exists i:Z, ((0%Z <= i)%Z /\ (i < (power 2%Z (ket_length m)))%Z) /\ forall (j:Z), ((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length m)))%Z) -> ((get m j 0%Z) = (indic i j)). Axiom set_is_a_ket_basis_elt : forall (m:matrix complex), (is_a_ket m) -> (exists i:Z, ((0%Z <= i)%Z /\ (i < (power 2%Z (ket_length m)))%Z) /\ (m = (ket (ket_length m) i))) -> is_a_ket_basis_elt m. Axiom set_is_a_ket_basis_elt_exists : forall (m:matrix complex), (is_a_ket m) -> (exists j:Z, ((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length m)))%Z) /\ (m = (make_f (power 2%Z (ket_length m)) 1%Z (fun (i:Z) (us:Z) => (indic i j))))) -> is_a_ket_basis_elt m. Axiom ket_func_sets_ket_basis_elts : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> is_a_ket_basis_elt (ket n i). Axiom ket_func_sets_ket_basis_elts1 : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((ket_length (ket n i)) = n). Axiom kronecker_is_a_ket_basis_elt : forall (x:matrix complex) (y:matrix complex), (is_a_ket_basis_elt x) -> (is_a_ket_basis_elt y) -> is_a_ket_basis_elt (kronecker x y). Axiom ket_is_a_ket_basis_elt : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> is_a_ket_basis_elt (ket n i). Axiom ket_basis_non_null_val : forall (m:matrix complex) (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (is_a_ket_basis_elt m) -> ((ket_length m) = n) -> ~ ((get m i 0%Z) = c_zero) -> (m = (ket n i)). Parameter ket_to_int: (matrix complex) -> Z. Axiom ket_to_int_spec : forall (m:matrix complex), (is_a_ket_basis_elt m) -> (0%Z <= (ket_to_int m))%Z. Axiom ket_to_int_spec1 : forall (m:matrix complex), (is_a_ket_basis_elt m) -> ((ket_to_int m) < (power 2%Z (ket_length m)))%Z. Axiom ket_to_int_spec2 : forall (m:matrix complex), (is_a_ket_basis_elt m) -> ((get m (ket_to_int m) 0%Z) = c_one). Axiom ket_to_int_spec3 : forall (m:matrix complex), (is_a_ket_basis_elt m) -> (m = (ket (ket_length m) (ket_to_int m))). Axiom ket_to_int_spec4 : forall (m:matrix complex), (is_a_ket_basis_elt m) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z (ket_length m)))%Z) -> (m = (ket (ket_length m) i)) -> (i = (ket_to_int m)). Axiom ket_to_int_ket : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((ket_to_int (ket n i)) = i). Axiom equal_ket_by_int : forall (m:matrix complex) (n:matrix complex) (l:Z), (is_a_ket_l m l) -> (is_a_ket_l n l) -> (is_a_ket_basis_elt n) -> (is_a_ket_basis_elt m) -> ((ket_to_int m) = (ket_to_int n)) -> (m = n). Parameter bin_to_ket: Z -> (Z -> Z) -> matrix complex. Axiom bin_to_ket_def : forall (n:Z) (bvx:Z -> Z), (n >= 0%Z)%Z -> (binary bvx) -> ((bin_to_ket n bvx) = (ket n (bin_to_int bvx n))). Axiom bin_to_ket_spec : forall (n:Z) (bvx:Z -> Z), (n >= 0%Z)%Z -> (binary bvx) -> is_a_ket_basis_elt (bin_to_ket n bvx). Axiom bin_to_ket_spec1 : forall (n:Z) (bvx:Z -> Z), (n >= 0%Z)%Z -> (binary bvx) -> ((ket_length (bin_to_ket n bvx)) = n). Axiom bin_to_ket_spec2 : forall (n:Z) (bvx:Z -> Z), (n >= 0%Z)%Z -> (binary bvx) -> ((ket_to_int (bin_to_ket n bvx)) = (bin_to_int bvx n)). Axiom bin_to_ket_spec3 : forall (n:Z) (bvx:Z -> Z), (n >= 0%Z)%Z -> (binary bvx) -> ((rows (bin_to_ket n bvx)) = (power 2%Z n)). Axiom bin_to_ket_spec4 : forall (n:Z) (bvx:Z -> Z), (n >= 0%Z)%Z -> (binary bvx) -> ((columns (bin_to_ket n bvx)) = 1%Z). Axiom bin_to_ket_spec5 : forall (n:Z) (bvx:Z -> Z), (n >= 0%Z)%Z -> (binary bvx) -> is_a_ket (bin_to_ket n bvx). Axiom bin_to_ket_spec6 : forall (n:Z) (bvx:Z -> Z), (n >= 0%Z)%Z -> (binary bvx) -> is_a_ket_l (bin_to_ket n bvx) n. Axiom bin_to_ket_l : forall (n:Z) (n':Z) (bvx:Z -> Z), (n >= 0%Z)%Z -> (n = n') -> (binary bvx) -> is_a_ket_l (bin_to_ket n bvx) n'. Axiom bin_to_ket_eq : forall (n1:Z) (n2:Z) (bvx1:Z -> Z) (bvx2:Z -> Z), (n1 >= 0%Z)%Z -> (binary bvx1) -> (binary bvx2) -> (n2 = n1) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < n1)%Z) -> ((bvx1 i) = (bvx2 i))) -> ((bin_to_ket n1 bvx1) = (bin_to_ket n2 bvx2)). Axiom kronecker_kets_bin_to_ket : forall (f1:Z -> Z) (f2:Z -> Z) (n1:Z) (n2:Z), (binary f1) -> (binary f2) -> (0%Z <= n1)%Z -> (0%Z <= n2)%Z -> ((kronecker (bin_to_ket n1 f1) (bin_to_ket n2 f2)) = (bin_to_ket (n1 + n2)%Z ((((fun (y0:Z -> Z) (y1:Z -> Z) (y2:Z) (y3:Z) => (concat_fun y0 y1 y2 y3)) f1) f2) n1))). Axiom kronecker_ket_to_int : forall (x:matrix complex) (y:matrix complex), (is_a_ket_basis_elt x) -> (is_a_ket_basis_elt y) -> is_a_ket_basis_elt (kronecker x y). Axiom kronecker_ket_to_int1 : forall (x:matrix complex) (y:matrix complex), (is_a_ket_basis_elt x) -> (is_a_ket_basis_elt y) -> ((ket_length (kronecker x y)) = ((ket_length x) + (ket_length y))%Z). Axiom kronecker_ket_to_int2 : forall (x:matrix complex) (y:matrix complex), (is_a_ket_basis_elt x) -> (is_a_ket_basis_elt y) -> ((kronecker x y) = (ket ((ket_length x) + (ket_length y))%Z (((ket_to_int x) * (power 2%Z (ket_length y)))%Z + (ket_to_int y))%Z)). Axiom kronecker_ket_to_int3 : forall (x:matrix complex) (y:matrix complex), (is_a_ket_basis_elt x) -> (is_a_ket_basis_elt y) -> ((ket_to_int (kronecker x y)) = (((ket_to_int x) * (power 2%Z (ket_length y)))%Z + (ket_to_int y))%Z). Axiom ket_ket_to_int : forall (x:matrix complex), (is_a_ket_basis_elt x) -> ((ket (ket_length x) (ket_to_int x)) = x). Axiom ket_ket_to_int_values : forall (x:matrix complex), (is_a_ket_basis_elt x) -> forall (i:Z) (j:Z), (valid_index x i j) -> ((get x i j) = (indic i (ket_to_int x))). Parameter ket_basis_projection: (matrix complex) -> Z -> matrix complex. Axiom ket_basis_projection_def : forall (m:matrix complex) (j:Z), (is_a_ket m) -> ((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length m)))%Z) -> ((ket_basis_projection m j) = (infix_asdtdt (get m j 0%Z) (ket (ket_length m) j))). Axiom ket_basis_projection_spec : forall (m:matrix complex) (j:Z), (is_a_ket m) -> ((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length m)))%Z) -> ((ket_basis_projection m j) = (basis_projection m j 0%Z)). Axiom ket_basis_projection_columns : forall (m:matrix complex) (j:Z), (is_a_ket m) -> ((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length m)))%Z) -> ((columns (ket_basis_projection m j)) = 1%Z). Axiom ket_basis_projection_rows : forall (m:matrix complex) (j:Z), (is_a_ket m) -> ((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length m)))%Z) -> ((rows (ket_basis_projection m j)) = (rows m)). Parameter ket_basis_projections: (matrix complex) -> set (matrix complex). Parameter result17: (matrix complex) -> Z -> matrix complex. Axiom result_def17 : forall (m:matrix complex) (j:Z), ((mem j (to_fset 0%Z (power 2%Z (ket_length m)))) -> (((result17 m) j) = (ket_basis_projection m j))) /\ (~ (mem j (to_fset 0%Z (power 2%Z (ket_length m)))) -> (((result17 m) j) = m)). Axiom ket_basis_projections_def : forall (m:matrix complex), (is_a_ket m) -> ((ket_basis_projections m) = (map (result17 m) (to_fset 0%Z (power 2%Z (ket_length m))))). Axiom ket_basis_projections_spec : forall (m:matrix complex), (is_a_ket m) -> ((ket_basis_projections m) = (basis_projections m)). Parameter ket_basis_projections_antec: (matrix complex) -> unit. Axiom ket_basis_projections_antec_def : forall (m:matrix complex), (is_a_ket m) -> ((ket_basis_projections_antec m) = tt). Axiom ket_basis_projections_antec_spec : forall (m:matrix complex), (is_a_ket m) -> forall (e1:matrix complex), (mem e1 (ket_basis_projections m)) -> exists j:Z, ((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length m)))%Z) /\ (e1 = (ket_basis_projection m j)). Axiom ket_basis_projections_antec_spec1 : forall (m:matrix complex), (is_a_ket m) -> forall (e1:matrix complex), (exists j:Z, ((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length m)))%Z) /\ (e1 = (ket_basis_projection m j))) -> mem e1 (ket_basis_projections m). Axiom ket_basis_projections_antec_spec2 : forall (m:matrix complex), (is_a_ket m) -> forall (e1:matrix complex), (mem e1 (ket_basis_projections m)) -> exists j:Z, exists i:Z, (valid_index m j i) /\ (e1 = (basis_projection m j i)). Axiom ket_basis_projections_antec_spec3 : forall (m:matrix complex), (is_a_ket m) -> forall (e1:matrix complex), (exists j:Z, exists i:Z, (valid_index m j i) /\ (e1 = (basis_projection m j i))) -> mem e1 (ket_basis_projections m). Parameter ket_sum: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> matrix complex) -> matrix complex. Axiom ket_sum_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> is_a_ket (f e1)) -> (exists l:Z, forall (e1:a), (mem e1 s) -> ((ket_length (f e1)) = l)) -> ((ket_sum s f) = (mat_sum s f)). Axiom ket_sum_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> is_a_ket (f e1)) -> (exists l:Z, forall (e1:a), (mem e1 s) -> ((ket_length (f e1)) = l)) -> forall (i:Z), (ket_valid_index (ket_sum s f) i) -> ((get_ket (ket_sum s f) i) = (sum s (fun (e1:a) => (get_ket (f e1) i)))). Axiom ket_sum_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> is_a_ket (f e1)) -> (exists l:Z, forall (e1:a), (mem e1 s) -> ((ket_length (f e1)) = l)) -> is_a_ket (ket_sum s f). Axiom ket_sum_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex), ((cardinal s) > 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> is_a_ket (f e1)) -> (exists l:Z, forall (e1:a), (mem e1 s) -> ((ket_length (f e1)) = l)) -> forall (e1:a), (mem e1 s) -> ((ket_length (ket_sum s f)) = (ket_length (f e1))). Parameter ket_sum_l: forall {a:Type} {a_WT:WhyType a}, (set a) -> (a -> matrix complex) -> Z -> matrix complex. Axiom ket_sum_l_def : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((cardinal s) = 0%Z) -> ((ket_sum_l s f l) = (make_ket l (fun (us:Z) => c_zero))). Axiom ket_sum_l_def1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ~ ((cardinal s) = 0%Z) -> ((cardinal s) = 1%Z) -> ((ket_sum_l s f l) = (make_ket l ((fun (y0:matrix complex) (y1:Z) => (get_ket y0 y1)) (f (choose s))))). Axiom ket_sum_l_def2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ~ ((cardinal s) = 0%Z) -> ~ ((cardinal s) = 1%Z) -> ((ket_sum_l s f l) = (add_ket (ket_sum_l (remove (choose s) s) f l) (make_ket l ((fun (y0:matrix complex) (y1:Z) => (get_ket y0 y1)) (f (choose s)))))). Axiom ket_sum_l_spec : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> (0%Z < (cardinal s))%Z -> ((ket_sum_l s f l) = (mat_sum s (fun (i:a) => (make_ket l (fun (j:Z) => (get (f i) j 0%Z)))))). Axiom ket_sum_l_spec1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> is_a_ket (ket_sum_l s f l). Axiom ket_sum_l_spec2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> forall (i:Z), (ket_valid_index (ket_sum_l s f l) i) -> ((get_ket (ket_sum_l s f l) i) = (sum s (fun (e1:a) => (get_ket (f e1) i)))). Axiom ket_sum_l_spec3 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> is_a_ket_l (ket_sum_l s f l) l. Axiom ket_sum_l_spec4 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> (0%Z < (cardinal s))%Z -> (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l) -> ((ket_sum_l s f l) = (mat_sum s f)). Axiom ket_sum_l_spec5 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((ket_length (ket_sum_l s f l)) = l). Axiom ket_sum_l_to_mat_sum : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((cardinal s) > 0%Z)%Z -> ((ket_sum_l s f l) = (mat_sum s (fun (i:a) => (make_ket l (fun (j:Z) => (get (f i) j 0%Z)))))). Axiom ket_sum_l_rows : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((cardinal s) > 0%Z)%Z -> ((rows (ket_sum_l s f l)) = (power 2%Z l)). Axiom ket_sum_l_value : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z) (i:Z) (j:Z), (0%Z <= l)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z l))%Z) -> (j = 0%Z) -> ((get (ket_sum_l s f l) i j) = (sum s (fun (e1:a) => (get (f e1) i 0%Z)))). Axiom get_ket_sum_l_value : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z) (i:Z), (0%Z <= l)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z l))%Z) -> ((get_ket (ket_sum_l s f l) i) = (sum s (fun (e1:a) => (get_ket (f e1) i)))). Axiom ket_sum_l_columns : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((columns (ket_sum_l s f l)) = 1%Z). Axiom ket_sum_null_but_maybe_one_elt : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a) (e1:a), ((cardinal s) > 1%Z)%Z -> (forall (e2:a), (mem e2 s) -> is_a_ket (f e2)) -> (constant_size s f) -> (mem e1 s) -> (forall (e':a), (mem e' s) -> ~ (e1 = e') -> null_mat (f e')) -> ((ket_sum s f) = (f e1)). Axiom ket_sum_null : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), ((cardinal s) > 1%Z)%Z -> (l >= 0%Z)%Z -> (forall (e1:a), (mem e1 s) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z l))%Z) -> ((get_ket (f e1) i) = c_zero)) -> forall (j:Z), ((0%Z <= j)%Z /\ (j < (power 2%Z l))%Z) -> ((get_ket (ket_sum_l s f l) j) = c_zero). Axiom ket_sum_l_null_but_maybe_one_elt : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> matrix complex) (s:set a) (e1:a) (l:Z), (0%Z <= l)%Z -> ((cardinal s) > 1%Z)%Z -> (mem e1 s) -> (forall (e':a), (mem e' s) -> ~ (e' = e1) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z l))%Z) -> ((get_ket (f e') i) = c_zero)) -> ((ket_sum_l s f l) = (make_ket l ((fun (y0:matrix complex) (y1:Z) => (get_ket y0 y1)) (f e1)))). Axiom ket_sum_ket_l : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> is_a_ket_l (ket_sum_l s f l) l. Axiom ket_sum_ket_l_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z) (l':Z), (0%Z <= l)%Z -> (l = l') -> is_a_ket_l (ket_sum_l s f l) l'. Axiom add_ket_l_eq1 : forall (m:matrix complex) (o:matrix complex) (m':matrix complex) (o':matrix complex) (l:Z), (0%Z <= l)%Z -> (m = m') -> (o = o') -> ((add_ket_l m o l) = (add_ket_l m' o' l)). Axiom add_ket_l_eq_scal : forall (m:matrix complex) (o:matrix complex) (m':matrix complex) (o':matrix complex) (a:complex) (b:complex) (a':complex) (b':complex) (l:Z), (0%Z <= l)%Z -> (m = m') -> (o = o') -> (a = a') -> (b = b') -> ((add_ket_l (infix_asdtdt a m) (infix_asdtdt b o) l) = (add_ket_l (infix_asdtdt a' m') (infix_asdtdt b' o') l)). Axiom add_ket_l_scal : forall (x:matrix complex) (y:matrix complex) (a:complex) (l:Z), (is_a_ket_l x l) -> (is_a_ket_l y l) -> ((add_ket_l (infix_asdtdt a x) (infix_asdtdt a y) l) = (infix_asdtdt a (add_ket_l x y l))). Axiom add_ket_l_scal_rev : forall (x:matrix complex) (y:matrix complex) (a:complex) (l:Z), (is_a_ket_l x l) -> (is_a_ket_l y l) -> ((infix_asdtdt a (add_ket_l x y l)) = (add_ket_l (infix_asdtdt a x) (infix_asdtdt a y) l)). Axiom get_ket_scalar : forall (x:matrix complex) (a:complex) (i:Z), ((get_ket (infix_asdtdt a x) i) = (infix_asdt a (get_ket x i))). Axiom scal_add_scal_ket_l : forall (g:complex) (a:complex) (x:matrix complex) (a':complex) (x':matrix complex) (n:Z), (0%Z <= n)%Z -> ((infix_asdtdt g (add_ket_l (infix_asdtdt a x) (infix_asdtdt a' x') n)) = (add_ket_l (infix_asdtdt (infix_asdt g a) x) (infix_asdtdt (infix_asdt g a') x') n)). Axiom add_ket_l_switch : forall (a:matrix complex) (b:matrix complex) (c:matrix complex) (d:matrix complex) (n:Z), (0%Z <= n)%Z -> ((add_ket_l (add_ket_l a b n) (add_ket_l c d n) n) = (add_ket_l (add_ket_l a c n) (add_ket_l b d n) n)). Axiom add_ket_scal_fact : forall (a:matrix complex) (n:Z) (s:complex) (s':complex), (is_a_ket_l a n) -> (0%Z <= n)%Z -> ((add_ket_l (infix_asdtdt s a) (infix_asdtdt s' a) n) = (infix_asdtdt (infix_pldt s s') a)). Axiom ket_sum_comp_l : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> matrix complex) (g:b -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((ket_sum_l s (fun (k:b) => (add_ket_l (f k) (g k) l)) l) = (add_ket_l (ket_sum_l s f l) (ket_sum_l s g l) l)). Axiom ket_sum_comp_l_rev : forall {b:Type} {b_WT:WhyType b}, forall (s:set b) (f:b -> matrix complex) (g:b -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((add_ket_l (ket_sum_l s f l) (ket_sum_l s g l) l) = (ket_sum_l s (fun (k:b) => (add_ket_l (f k) (g k) l)) l)). Axiom ket_sum_scalar_l : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (a1:complex) (l:Z), (0%Z <= l)%Z -> ((ket_sum_l s (fun (k:a) => (infix_asdtdt a1 (f k))) l) = (infix_asdtdt a1 (ket_sum_l s f l))). Axiom ket_l_ket_sum_scalar : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (a1:complex) (l:Z) (n:Z), (0%Z <= l)%Z -> (l = n) -> is_a_ket_l (infix_asdtdt a1 (ket_sum_l s f l)) n. Axiom scal_ket_sum_scalar_l : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (b:complex) (l:Z) (l':Z), (0%Z <= l)%Z -> (l = l') -> is_a_ket_l (infix_asdtdt b (ket_sum_l s f l)) l'. Axiom ket_sum_scalar_rev_l : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (a1:complex) (l:Z), (0%Z <= l)%Z -> ((infix_asdtdt a1 (ket_sum_l s f l)) = (ket_sum_l s (fun (k:a) => (infix_asdtdt a1 (f k))) l)). Axiom ket_sum_eq : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (f:a -> matrix complex) (g:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> (s = s') -> (forall (a1:a), (mem a1 s) -> ((f a1) = (g a1))) -> ((ket_sum_l s f l) = (ket_sum_l s' g l)). Axiom ket_sum_eq_gen : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (f:a -> matrix complex) (g:a -> matrix complex) (l1:Z) (l2:Z), (0%Z <= l1)%Z -> (s = s') -> (l1 = l2) -> (forall (a1:a), (mem a1 s) -> ((f a1) = (g a1))) -> ((ket_sum_l s f l1) = (ket_sum_l s' g l2)). Axiom ket_sum_eq_by_sum : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s':set a) (f:a -> matrix complex) (g:a -> matrix complex) (l1:Z) (l2:Z), (0%Z <= l1)%Z -> (s = s') -> (l1 = l2) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z l1))%Z) -> ((sum s (fun (e1:a) => (get_ket (f e1) i))) = (sum s (fun (e1:a) => (get_ket (g e1) i))))) -> ((ket_sum_l s f l1) = (ket_sum_l s' g l2)). Axiom ket_sum_bvs_eq : forall (n1:Z) (n2:Z) (f:bitvec -> matrix complex) (g:bitvec -> matrix complex) (l1:Z) (l2:Z), (0%Z <= l1)%Z -> (l1 = l2) -> (n1 = n2) -> (n1 >= 0%Z)%Z -> (forall (e1:bitvec), (mem e1 (n_bvs n1)) -> ((f e1) = (g e1))) -> ((ket_sum_l (n_bvs n1) f l1) = (ket_sum_l (n_bvs n2) g l2)). Axiom ket_sum_scal_bvs_eq : forall (n1:Z) (n2:Z) (f:bitvec -> matrix complex) (g:bitvec -> matrix complex) (l1:Z) (l2:Z) (s1:complex) (s2:complex), (0%Z <= l1)%Z -> (l1 = l2) -> (n1 = n2) -> (s1 = s2) -> (n1 >= 0%Z)%Z -> (forall (e1:bitvec), (mem e1 (n_bvs n1)) -> ((f e1) = (g e1))) -> ((infix_asdtdt s1 (ket_sum_l (n_bvs n1) f l1)) = (infix_asdtdt s2 (ket_sum_l (n_bvs n2) g l2))). Axiom ket_sum_sum_bvs_eq : forall (n1:Z) (n2:Z) (n1':Z) (n2':Z) (f:bitvec -> bitvec -> matrix complex) (g:bitvec -> bitvec -> matrix complex) (l1:Z) (l2:Z) (l1':Z) (l2':Z), (0%Z <= l1)%Z -> ((l1 = l2) /\ ((l2 = l1') /\ (l1' = l2'))) -> (n1 = n1') -> (n1 >= 0%Z)%Z -> (n2 = n2') -> (n2 >= 0%Z)%Z -> (forall (e1:bitvec) (e':bitvec), (mem e1 (n_bvs n1)) -> (mem e' (n_bvs n2)) -> (((f e1) e') = ((g e1) e'))) -> ((ket_sum_l (n_bvs n1) (fun (k:bitvec) => (ket_sum_l (n_bvs n2) (f k) l1)) l2) = (ket_sum_l (n_bvs n1') (fun (k:bitvec) => (ket_sum_l (n_bvs n2') (g k) l1')) l2')). Axiom ket_sum_sum_scal_bvs_eq : forall (n1:Z) (n2:Z) (n1':Z) (n2':Z) (f:bitvec -> bitvec -> matrix complex) (g:bitvec -> bitvec -> matrix complex) (l1:Z) (l2:Z) (l1':Z) (l2':Z) (s1:complex) (s2:complex), (0%Z <= l1)%Z -> ((l1 = l2) /\ ((l2 = l1') /\ (l1' = l2'))) -> (n1 = n1') -> (n1 >= 0%Z)%Z -> (n2 = n2') -> (s1 = s2) -> (n2 >= 0%Z)%Z -> (forall (e1:bitvec) (e':bitvec), (mem e1 (n_bvs n1)) -> (mem e' (n_bvs n2)) -> (((f e1) e') = ((g e1) e'))) -> ((infix_asdtdt s1 (ket_sum_l (n_bvs n1) (fun (k:bitvec) => (ket_sum_l (n_bvs n2) (f k) l1)) l2)) = (infix_asdtdt s1 (ket_sum_l (n_bvs n1') (fun (k:bitvec) => (ket_sum_l (n_bvs n2') (g k) l1')) l2'))). Axiom ket_sum_sum_scal_mult_bvs_eq : forall (n1:Z) (n2:Z) (n1':Z) (n2':Z) (f:bitvec -> bitvec -> matrix complex) (g:bitvec -> bitvec -> matrix complex) (l1:Z) (l2:Z) (l1':Z) (l2':Z) (s1:complex) (s2:complex) (s3:complex), (0%Z <= l1)%Z -> ((l1 = l2) /\ ((l2 = l1') /\ (l1' = l2'))) -> (n1 = n1') -> (n1 >= 0%Z)%Z -> (s3 = (infix_asdt s1 s2)) -> (n2 = n2') -> (n2 >= 0%Z)%Z -> (forall (e1:bitvec) (e':bitvec), (mem e1 (n_bvs n1)) -> (mem e' (n_bvs n2)) -> (((f e1) e') = ((g e1) e'))) -> ((infix_asdtdt s1 (ket_sum_l (n_bvs n1') (fun (k:bitvec) => (infix_asdtdt s2 (ket_sum_l (n_bvs n2') (f k) l1'))) l2')) = (infix_asdtdt s3 (ket_sum_l (n_bvs n1) (fun (k:bitvec) => (ket_sum_l (n_bvs n2) (g k) l1)) l2))). Axiom ket_sum_l_cardone : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((cardinal s) = 1%Z) -> (is_a_ket_l (f (choose s)) l) -> ((ket_sum_l s f l) = (f (choose s))). Axiom ket_sum_l_empty : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((cardinal s) = 0%Z) -> ((ket_sum_l s f l) = (make_ket l (fun (us:Z) => c_zero))). Axiom ket_sum_l_cardone_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((cardinal s) = 1%Z) -> ((ket_sum_l s f l) = (make_ket l ((fun (y0:matrix complex) (y1:Z) => (get_ket y0 y1)) (f (choose s))))). Axiom ket_sum_l_plus_one : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (e1:a) (f:a -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((cardinal s) > 0%Z)%Z -> ~ (mem e1 s) -> ((ket_sum_l (add e1 s) f l) = (add_ket_l (ket_sum_l s f l) (f e1) l)). Axiom ket_sum_bitvec_one : forall (f:bitvec -> matrix complex) (l:Z), (0%Z <= l)%Z -> ((ket_sum_l (n_bvs 1%Z) f l) = (add_ket_l (f (int_to_bv 0%Z 1%Z)) (f (int_to_bv 1%Z 1%Z)) l)). Axiom ket_sum_bitvec_zero : forall (f:bitvec -> matrix complex) (l:Z) (m:Z), (0%Z <= l)%Z -> (m = 0%Z) -> (is_a_ket_l (f (int_to_bv 0%Z 0%Z)) l) -> ((ket_sum_l (n_bvs m) f l) = (f (int_to_bv 0%Z 0%Z))). Axiom ket_sum_l_valid_index : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (l:Z) (i:Z), (0%Z <= l)%Z -> (0%Z < (cardinal s))%Z -> ((0%Z <= i)%Z /\ (i < (power_ 1%Z l))%Z) -> ket_valid_index (ket_sum_l s f l) i. Axiom ket_sum_const : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (x:matrix complex) (l:Z), (0%Z <= l)%Z -> (is_a_ket_l x l) -> ((ket_sum_l s (fun (us:a) => x) l) = (infix_asdtdt (i_to_c (cardinal s)) x)). Axiom ket_sum_const_w : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (x:matrix complex) (l:Z), (0%Z <= l)%Z -> (0%Z < (cardinal s))%Z -> (is_a_ket_l x l) -> ((infix_asdtdt (infix_sldt c_one (i_to_c (cardinal s))) (ket_sum_l s (fun (us:a) => x) l)) = x). Axiom map_ket_sum_l : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (f:b -> matrix complex) (s:set a) (t:a -> b) (n:Z), (0%Z <= n)%Z -> (p_injective t s) -> ((ket_sum_l (map t s) f n) = (ket_sum_l s (fun (a1:a) => (f (t a1))) n)). Axiom pre_injective_bv_to_int : forall (bv1:bitvec) (bv2:bitvec), ((length bv1) = (length bv2)) -> ~ (bv1 = bv2) -> ~ ((bv_to_int bv1) = (bv_to_int bv2)). Axiom injective_bv_to_int : forall (n:Z), (0%Z <= n)%Z -> p_injective (fun (y0:bitvec) => (bv_to_int y0)) (n_bvs n). Axiom bijective_to_int : forall (n:Z), (0%Z < n)%Z -> p_bijective (fun (y0:bitvec) => (bv_to_int y0)) (n_bvs n) (to_fset 0%Z (power 2%Z n)). Axiom injective_int_to_bv : forall (n:Z), (0%Z <= n)%Z -> p_injective (fun (i:Z) => (int_to_bv i n)) (to_fset 0%Z (power 2%Z n)). Axiom n_bvs_card : forall (n:Z), (0%Z <= n)%Z -> ((cardinal (n_bvs n)) = (power 2%Z n)). Axiom concat_first_term_zero : forall (e1:bitvec) (i:Z), (0%Z <= i)%Z -> (mem e1 (map (fun (bv:bitvec) => (concat_l bv 0%Z)) (n_bvs i))) -> (((getbv e1) 0%Z) = 0%Z). Axiom concat_first_term_one : forall (e1:bitvec) (i:Z), (0%Z <= i)%Z -> (mem e1 (map (fun (bv:bitvec) => (concat_l bv 1%Z)) (n_bvs i))) -> (((getbv e1) 0%Z) = 1%Z). Axiom bv_sum_to_int_sum : forall (n:Z) (f:Z -> complex) (g:bitvec -> complex), (0%Z <= n)%Z -> (forall (x:bitvec), ((length x) = n) -> ((g x) = (f (bv_to_int x)))) -> ((sum (n_bvs n) g) = (sum (to_fset 0%Z (power 2%Z n)) f)). Axiom sum_concat : forall (f:bitvec -> matrix complex) (i:Z) (r:Z) (c:Z), (i > 0%Z)%Z -> (forall (bv:bitvec), ((rows (f bv)) = r)) -> (forall (bv:bitvec), ((columns (f bv)) = c)) -> ((mat_sum (n_bvs i) (fun (bv:bitvec) => (add_mat (f (concat_l bv 0%Z)) (f (concat_l bv 1%Z))))) = (mat_sum (n_bvs (i + 1%Z)%Z) f)). Axiom geometric_series_bv : forall (a:complex) (q:complex) (n:Z), (n >= 1%Z)%Z -> ~ (q = c_one) -> ((sum (n_bvs n) (fun (i:bitvec) => (infix_asdt a (cpower q (bv_to_int i))))) = (infix_sldt (infix_asdt a (infix_mndt c_one (cpower q (power_ 2%Z n)))) (infix_mndt c_one q))). Axiom geometric_series_bv_init_one : forall (q:complex) (n:Z), (n >= 1%Z)%Z -> ~ (q = c_one) -> ((sum (n_bvs n) (fun (i:bitvec) => (cpower q (bv_to_int i)))) = (infix_sldt (infix_mndt c_one (cpower q (power_ 2%Z n))) (infix_mndt c_one q))). Axiom ket_sum_l_to_n_bvs : forall (f:Z -> matrix complex) (l:Z) (n:Z), (0%Z <= n)%Z -> (0%Z <= l)%Z -> ((ket_sum_l (to_fset 0%Z (power_ 2%Z l)) f n) = (ket_sum_l (n_bvs l) (fun (a:bitvec) => (f (bv_to_int a))) n)). Axiom ket_sum_l_to_fset : forall (f:bitvec -> matrix complex) (l:Z) (n:Z), (0%Z <= n)%Z -> (0%Z <= l)%Z -> ((ket_sum_l (n_bvs l) f n) = (ket_sum_l (to_fset 0%Z (power_ 2%Z l)) (fun (i:Z) => (f (int_to_bv i l))) n)). Axiom ket_sum_partition : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (s1:set a) (s2:set a) (f:a -> matrix complex) (n:Z), (0%Z <= n)%Z -> (s = (union s1 s2)) -> ((inter s1 s2) = (empty : set a)) -> ((ket_sum_l s f n) = (add_ket_l (ket_sum_l s1 f n) (ket_sum_l s2 f n) n)). Axiom ket_decomp : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (is_a_ket m) -> ((ket_length m) = n) -> (m = (mat_sum (to_fset 0%Z (power 2%Z n)) (fun (j:Z) => (infix_asdtdt (get m j 0%Z) (ket n j))))). Axiom ket_decomp_bv : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (is_a_ket m) -> ((ket_length m) = n) -> (m = (ket_sum_l (n_bvs n) (fun (bvx:bitvec) => (infix_asdtdt (get m (bv_to_int bvx) 0%Z) (ket n (bv_to_int bvx)))) n)). Axiom ket_recomp : forall (f:Z -> complex) (n:Z), (0%Z <= n)%Z -> ((mat_sum (to_fset 0%Z (power 2%Z n)) (fun (j:Z) => (infix_asdtdt (f j) (ket n j)))) = (make_f (power 2%Z n) 1%Z (fun (x:Z) (us:Z) => (f x)))). Axiom ket_decomp_quant : forall (m:matrix complex), (is_a_ket m) -> (m = (mat_sum (to_fset 0%Z (power 2%Z (ket_length m))) (fun (j:Z) => (infix_asdtdt (get m j 0%Z) (ket (ket_length m) j))))). Axiom mat_mult_ket_basis : forall (m:matrix complex) (x:matrix complex), (is_a_ket_basis_elt x) -> (((columns m) = (rows m)) /\ ((rows m) = (rows x))) -> ((mat_mult m x) = (mat_sum (to_fset 0%Z (rows x)) (fun (k:Z) => (infix_asdtdt (get m k (ket_to_int x)) (ket (ket_length x) k))))). Axiom ket_mult_diag : forall (m:matrix complex) (x:matrix complex), ((ket_length x) >= 1%Z)%Z -> (is_a_ket_basis_elt x) -> ((rows m) = (power 2%Z (ket_length x))) -> ((columns m) = (power 2%Z (ket_length x))) -> (forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z (ket_length x)))%Z) -> ((0%Z <= j)%Z /\ (j < (power 2%Z (ket_length x)))%Z) -> ~ (i = j) -> ((get m i j) = c_zero)) -> ((mat_mult m x) = (infix_asdtdt (get m (ket_to_int x) (ket_to_int x)) (ket (ket_length x) (ket_to_int x)))). Axiom mat_mult_ket_basis_bv : forall (m:matrix complex) (x:matrix complex) (n:Z), ((ket_length x) = n) -> (is_a_ket_basis_elt x) -> (((columns m) = (rows m)) /\ ((rows m) = (rows x))) -> ((mat_mult m x) = (ket_sum_l (n_bvs n) (fun (bvx:bitvec) => (infix_asdtdt (get m (bv_to_int bvx) (ket_to_int x)) (ket n (bv_to_int bvx)))) n)). Axiom mat_mult_ket_basis_bv_gen : forall (m:matrix complex) (x:matrix complex), (is_a_ket_basis_elt x) -> (((columns m) = (rows m)) /\ ((rows m) = (rows x))) -> ((mat_mult m x) = (ket_sum_l (n_bvs (ket_length x)) (fun (bvx:bitvec) => (infix_asdtdt (get m (bv_to_int bvx) (ket_to_int x)) (ket (ket_length x) (bv_to_int bvx)))) (ket_length x))). Axiom mat_mult_ket_bv : forall (m:matrix complex) (x:matrix complex) (n:Z), (is_a_ket_l x n) -> (((columns m) = (rows m)) /\ (((rows m) = (rows x)) /\ ((rows x) = (power 2%Z n)))) -> ((mat_mult m x) = (ket_sum_l (n_bvs n) (fun (bvx:bitvec) => (infix_asdtdt (get_ket x (bv_to_int bvx)) (mat_mult m (ket n (bv_to_int bvx))))) n)). Axiom mat_mult_ket_bv_gen : forall (m:matrix complex) (x:matrix complex), (is_a_ket x) -> (((columns m) = (rows m)) /\ ((rows m) = (rows x))) -> ((mat_mult m x) = (ket_sum_l (n_bvs (ket_length x)) (fun (bvx:bitvec) => (infix_asdtdt (get_ket x (bv_to_int bvx)) (mat_mult m (ket (ket_length x) (bv_to_int bvx))))) (ket_length x))). Axiom mat_mult_ket_sum_l : forall {a:Type} {a_WT:WhyType a}, forall (m:matrix complex) (s:set a) (f:a -> matrix complex) (l:Z), (0%Z < (cardinal s))%Z -> (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l) -> (((columns m) = (rows m)) /\ ((rows m) = (power_ 2%Z l))) -> ((mat_mult m (ket_sum_l s f l)) = (ket_sum_l s (fun (x:a) => (mat_mult m (f x))) l)). Axiom fun_inversion_pre : forall (f:Z -> Z) (s:set Z) (s':set Z) (a:Z -> complex) (n:Z), (0%Z <= n)%Z -> ((cardinal s) > 0%Z)%Z -> (p_bijective f s s') -> (subset s (to_fset 0%Z n)) -> (subset s' (to_fset 0%Z n)) -> ((mat_sum s (fun (j:Z) => (infix_asdtdt (a j) (set1 (make n 1%Z c_zero) (f j) 0%Z c_one)))) = (mat_sum s' (fun (j:Z) => (infix_asdtdt (a (inv_func f s s' j)) (set1 (make n 1%Z c_zero) j 0%Z c_one))))). Axiom ket_fun_inversion : forall (f:Z -> Z) (a:Z -> complex) (m:matrix complex) (pow_2_n:Z), (pow_2_n = (power 2%Z (ket_length m))) -> (is_a_ket m) -> (pow_2_n > 0%Z)%Z -> (p_bijective f (to_fset 0%Z pow_2_n) (to_fset 0%Z pow_2_n)) -> (m = (mat_sum (to_fset 0%Z pow_2_n) (fun (j:Z) => (infix_asdtdt (a j) (ket (ket_length m) (f j)))))) -> (m = (mat_sum (to_fset 0%Z pow_2_n) (fun (j:Z) => (infix_asdtdt (a (inv_ f (to_fset 0%Z pow_2_n) (to_fset 0%Z pow_2_n) j)) (ket (ket_length m) j))))). Axiom ket_sum_partition_filter : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (p1:a -> bool) (p2:a -> bool) (n:Z), (0%Z <= n)%Z -> (forall (e1:a), (mem e1 s) -> ((p1 e1) = true) <-> ~ ((p2 e1) = true)) -> ((ket_sum_l s f n) = (add_ket_l (ket_sum_l (my_filter s p1) f n) (ket_sum_l (my_filter s p2) f n) n)). Parameter ket_to_bv: (matrix complex) -> bitvec. Axiom ket_to_bv_def : forall (x:matrix complex), (is_a_ket_basis_elt x) -> ((ket_to_bv x) = (int_to_bv (ket_to_int x) (ket_length x))). Axiom ket_to_bv_spec : forall (x:matrix complex), (is_a_ket_basis_elt x) -> ((bv_to_int (ket_to_bv x)) = (ket_to_int x)). Axiom ket_to_bv_spec1 : forall (x:matrix complex), (is_a_ket_basis_elt x) -> ((length (ket_to_bv x)) = (ket_length x)). Axiom ket_to_bv_spec2 : forall (x:matrix complex), (is_a_ket_basis_elt x) -> mem (ket_to_bv x) (n_bvs (ket_length x)). Axiom ket_to_bv_length : forall (x:matrix complex) (n:Z), (is_a_ket_basis_elt x) -> ((ket_length x) = n) -> ((length (ket_to_bv x)) = n). Parameter bv_to_ket: bitvec -> matrix complex. Axiom bv_to_ket_def : forall (bv:bitvec), ((bv_to_ket bv) = (ket (length bv) (bv_to_int bv))). Axiom bv_to_ket_spec : forall (bv:bitvec), is_a_ket_basis_elt (bv_to_ket bv). Axiom bv_to_ket_spec1 : forall (bv:bitvec), ((ket_to_int (bv_to_ket bv)) = (bv_to_int bv)). Axiom bv_to_ket_spec2 : forall (bv:bitvec), is_a_ket_l (bv_to_ket bv) (length bv). Axiom bv_to_ket_spec3 : forall (bv:bitvec), ((rows (bv_to_ket bv)) = (power 2%Z (length bv))). Axiom bv_to_ket_spec4 : forall (bv:bitvec), ((columns (bv_to_ket bv)) = 1%Z). Axiom bv_to_ket_spec5 : forall (bv:bitvec), ((bv_to_ket bv) = (bin_to_ket (length bv) (getbv bv))). Axiom ket_to_bv_ket_length : forall (i:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((length (ket_to_bv (ket n i))) = n). Axiom is_a_ket_l_bv_to_ket : forall (bv:bitvec) (l:Z), ((length bv) = l) -> is_a_ket_l (bv_to_ket bv) l. Axiom bin_to_ket_to_bv_to_ket : forall (f:Z -> Z) (n:Z), (0%Z <= n)%Z -> (binary f) -> ((bin_to_ket n f) = (bv_to_ket (make_bv f n))). Axiom bin_to_ket_to_bv_to_ket_abs : forall (f:Z -> Z) (n:Z) (a:bitvec), (0%Z <= n)%Z -> (a = (make_bv f n)) -> (binary f) -> ((bin_to_ket n f) = (bv_to_ket a)). Axiom ket_to_int_to_bv_to_ket : forall (n:Z) (e1:bitvec), (0%Z <= n)%Z -> (mem e1 (n_bvs n)) -> ((ket n (bv_to_int e1)) = (bv_to_ket e1)). Axiom ket_to_bv_ket : forall (n:Z) (i:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((ket_to_bv (ket n i)) = (int_to_bv i n)). Axiom bv_to_ket_length : forall (bv:bitvec), ((ket_length (bv_to_ket bv)) = (length bv)). Axiom get_ket_bv_to_ket_length : forall (bv:bitvec) (k:Z), ((0%Z <= k)%Z /\ (k < (power 2%Z (length bv)))%Z) -> ((k = (bv_to_int bv)) -> ((get_ket (bv_to_ket bv) k) = c_one)) /\ (~ (k = (bv_to_int bv)) -> ((get_ket (bv_to_ket bv) k) = c_zero)). Axiom is_a_ket_l_bvs : forall (e1:bitvec) (n:Z), (0%Z <= n)%Z -> (mem e1 (n_bvs n)) -> is_a_ket_l (bv_to_ket e1) n. Axiom is_a_ket_l_scal_bvs : forall (e1:bitvec) (n:Z) (a:complex), (0%Z <= n)%Z -> (mem e1 (n_bvs n)) -> is_a_ket_l (infix_asdtdt a (bv_to_ket e1)) n. Axiom ket_to_bv_concat : forall (x:bitvec) (y:bitvec), ((bv_to_ket (concat x y)) = (kronecker (bv_to_ket x) (bv_to_ket y))). Axiom bv_to_ket_concat_rev : forall (x:bitvec) (y:bitvec), ((kronecker (bv_to_ket x) (bv_to_ket y)) = (bv_to_ket (concat x y))). Axiom bv_to_ket_to_bv : forall (bv:bitvec), ((ket_to_bv (bv_to_ket bv)) = bv). Axiom ket_to_bv_to_ket : forall (x:matrix complex), (is_a_ket_basis_elt x) -> ((bv_to_ket (ket_to_bv x)) = x). Axiom bv_to_ket_eq : forall (bv1:bitvec) (bv2:bitvec), ((length bv1) = (length bv2)) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < (length bv1))%Z) -> (((getbv bv1) i) = ((getbv bv2) i))) -> ((bv_to_ket bv1) = (bv_to_ket bv2)). Axiom ket_decomp_ : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (is_a_ket m) -> ((ket_length m) = n) -> (m = (ket_sum_l (n_bvs n) (fun (bvx:bitvec) => (infix_asdtdt (get_ket m (bv_to_int bvx)) (bv_to_ket bvx))) n)). Axiom ket_to_bv_kronecker : forall (x:matrix complex) (y:matrix complex), (is_a_ket_basis_elt x) -> (is_a_ket_basis_elt y) -> ((ket_to_bv (kronecker x y)) = (concat (ket_to_bv x) (ket_to_bv y))). Axiom ket_decomp_bv_ket : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> (is_a_ket m) -> ((ket_length m) = n) -> (m = (ket_sum_l (n_bvs n) (fun (bvx:bitvec) => (infix_asdtdt (get_ket m (bv_to_int bvx)) (ket n (bv_to_int bvx)))) n)). Axiom ket_zero : forall (n:Z), (n >= 0%Z)%Z -> is_a_ket_l (ket n 0%Z) n. Axiom ket_zero1 : forall (n:Z), (n >= 0%Z)%Z -> is_a_ket_basis_elt (ket n 0%Z). Axiom ket_zero2 : forall (n:Z), (n >= 0%Z)%Z -> ((ket_to_bv (ket n 0%Z)) = (make_bv (fun (us:Z) => 0%Z) n)). Axiom ket_zero3 : forall (n:Z), (n >= 0%Z)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((getbv (ket_to_bv (ket n 0%Z))) i) = 0%Z). Axiom uniform_ket_norm_l : forall (x:matrix complex) (f:bitvec -> complex) (n:Z), (is_a_ket_l x n) -> (forall (e1:bitvec), (mem e1 (n_bvs n)) -> ((modulus (f e1)) = c_one)) -> (x = (infix_asdtdt (pow_inv_sqrt_2 n) (ket_sum_l (n_bvs n) (fun (x1:bitvec) => (infix_asdtdt (f x1) (bv_to_ket x1))) n))) -> ((ket_norm_l x n) = c_one). Parameter ket_sum_l_diag: (bitvec -> complex) -> Z -> matrix complex. Axiom ket_sum_l_diag_def : forall (f:bitvec -> complex) (l:Z), (0%Z <= l)%Z -> ((ket_sum_l_diag f l) = (ket_sum_l (n_bvs l) (fun (x:bitvec) => (infix_asdtdt (f x) (bv_to_ket x))) l)). Axiom ket_sum_l_diag_spec : forall (f:bitvec -> complex) (l:Z), (0%Z <= l)%Z -> is_a_ket_l (ket_sum_l_diag f l) l. Axiom ket_sum_l_diag_spec1 : forall (f:bitvec -> complex) (l:Z), (0%Z <= l)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z l))%Z) -> ((get_ket (ket_sum_l_diag f l) i) = (f (int_to_bv i l))). Axiom ket_sum_of_scalars : forall (f:bitvec -> complex) (n:Z), (n >= 0%Z)%Z -> is_a_ket_l (ket_sum_l (n_bvs n) (fun (x:bitvec) => (infix_asdtdt (f x) (bv_to_ket x))) n) n. Axiom ket_sum_of_scalars1 : forall (f:bitvec -> complex) (n:Z), (n >= 0%Z)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((get (ket_sum_l (n_bvs n) (fun (x:bitvec) => (infix_asdtdt (f x) (bv_to_ket x))) n) i 0%Z) = (f (int_to_bv i n))). Axiom mat_sum_sum_cartesian_product_pre : forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, forall (s1:set a) (s2:set b) (f:a -> b -> matrix complex) (r:Z) (c:Z), (0%Z < r)%Z -> (0%Z < c)%Z -> (forall (a1:a) (b1:b), (mem a1 s1) -> (mem b1 s2) -> ((rows ((f a1) b1)) = r)) -> (forall (a1:a) (b1:b), (mem a1 s1) -> (mem b1 s2) -> ((columns ((f a1) b1)) = c)) -> ((cardinal s1) > 0%Z)%Z -> ((cardinal s2) > 0%Z)%Z -> ((mat_sum s1 (fun (a1:a) => (mat_sum s2 (f a1)))) = (mat_sum (cartesian_product s1 s2) (fun (o:(a* b)%type) => ((f (fir o)) (sec o))))). Axiom mat_sum_comp1 : forall (f:bitvec -> bitvec -> matrix complex) (l:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> (0%Z <= l)%Z -> (forall (bvx:bitvec) (bvy:bitvec), (mem bvx (n_bvs x)) -> (mem bvy (n_bvs y)) -> is_a_ket ((f bvy) bvx)) -> (forall (bvx:bitvec) (bvy:bitvec), (mem bvx (n_bvs x)) -> (mem bvy (n_bvs y)) -> ((ket_length ((f bvy) bvx)) = l)) -> ((mat_sum (n_bvs y) (fun (bvy:bitvec) => (mat_sum (n_bvs x) (fun (bvx:bitvec) => ((f bvy) bvx))))) = (mat_sum (n_bvs (x + y)%Z) (fun (bv:bitvec) => ((f (hpart bv y)) (tpart bv y))))). Axiom mat_sum_comp_rev : forall (f:bitvec -> bitvec -> matrix complex) (l:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> (0%Z <= l)%Z -> (forall (bvx:bitvec) (bvy:bitvec), (mem bvx (n_bvs x)) -> (mem bvy (n_bvs y)) -> is_a_ket ((f bvy) bvx)) -> (forall (bvx:bitvec) (bvy:bitvec), (mem bvx (n_bvs x)) -> (mem bvy (n_bvs y)) -> ((ket_length ((f bvy) bvx)) = l)) -> ((mat_sum (n_bvs (x + y)%Z) (fun (bv:bitvec) => ((f (hpart bv y)) (tpart bv y)))) = (mat_sum (n_bvs y) (fun (bvy:bitvec) => (mat_sum (n_bvs x) (fun (bvx:bitvec) => ((f bvy) bvx)))))). Axiom ket_sum_bin_comp_l : forall (f:bitvec -> bitvec -> matrix complex) (scal:bitvec -> complex) (l:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> (0%Z <= l)%Z -> ((ket_sum_l (n_bvs y) (fun (bvy:bitvec) => (infix_asdtdt (scal bvy) (ket_sum_l (n_bvs x) (fun (bvx:bitvec) => ((f bvy) bvx)) l))) l) = (ket_sum_l (n_bvs (x + y)%Z) (fun (bv:bitvec) => (infix_asdtdt (scal (hpart bv y)) ((f (hpart bv y)) (tpart bv y)))) l)). Axiom ket_sum_bin_comp : forall (f:bitvec -> bitvec -> matrix complex) (l:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> (0%Z <= l)%Z -> ((ket_sum_l (n_bvs y) (fun (bvy:bitvec) => (ket_sum_l (n_bvs x) (fun (bvx:bitvec) => ((f bvy) bvx)) l)) l) = (ket_sum_l (n_bvs (x + y)%Z) (fun (bv:bitvec) => ((f (hpart bv y)) (tpart bv y))) l)). Axiom ket_sum_bin_comp_rev : forall (f:bitvec -> bitvec -> matrix complex) (l:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> (0%Z <= l)%Z -> ((ket_sum_l (n_bvs (x + y)%Z) (fun (bv:bitvec) => ((f (hpart bv y)) (tpart bv y))) l) = (ket_sum_l (n_bvs y) (fun (bvy:bitvec) => (ket_sum_l (n_bvs x) (fun (bvx:bitvec) => ((f bvy) bvx)) l)) l)). Axiom ket_sum_bin_comp_rev_ : forall (f:bitvec -> bitvec -> matrix complex) (l:Z) (x:Z) (y:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z -> (0%Z <= l)%Z -> ((ket_sum_l (n_bvs (x + y)%Z) (fun (bv:bitvec) => ((f (hpart bv x)) (tpart bv x))) l) = (ket_sum_l (n_bvs x) (fun (bvx:bitvec) => (ket_sum_l (n_bvs y) (fun (bvy:bitvec) => ((f bvx) bvy)) l)) l)). Axiom ket_sum_bv_to_ints : forall (n:Z) (f:bitvec -> matrix complex) (g:Z -> matrix complex), (n >= 0%Z)%Z -> (forall (x:bitvec), ((length x) = n) -> ((f x) = (g (bv_to_int x)))) -> ((ket_sum_l (n_bvs n) f n) = (ket_sum_l (to_fset 0%Z (power 2%Z n)) g n)). Axiom ket_sum_sum_rev : forall (f:bitvec -> bitvec -> matrix complex) (l:Z) (l1:Z) (l2:Z), (0%Z <= l)%Z -> ((0%Z <= l1)%Z /\ (l1 = l2)) -> ((ket_sum_l (n_bvs l1) (fun (x:bitvec) => (ket_sum_l (n_bvs l2) (f x) l)) l) = (ket_sum_l (n_bvs l2) (fun (y:bitvec) => (ket_sum_l (n_bvs l1) (f y) l)) l)). Axiom get_ket_sum : forall (f:bitvec -> complex) (n:Z) (i:Z), ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (n >= 0%Z)%Z -> ((get_ket (ket_sum_l (n_bvs n) (fun (y:bitvec) => (infix_asdtdt (f y) (bv_to_ket y))) n) i) = (f (int_to_bv i n))). Axiom get_ket_scalar_zero : forall (x:matrix complex) (a:complex), ((get_ket (infix_asdtdt a x) 0%Z) = (infix_asdt a (get_ket x 0%Z))). Axiom ket_sum_sum_complex : forall (f:bitvec -> bitvec -> complex) (sx:set bitvec) (sy:set bitvec) (l:Z), (0%Z <= l)%Z -> (forall (x:bitvec), (mem x sx) -> ((length x) = l)) -> (forall (y:bitvec), (mem y sy) -> ((length y) = l)) -> ((ket_sum_l sx (fun (x:bitvec) => (ket_sum_l sy (fun (y:bitvec) => (infix_asdtdt ((f x) y) (bv_to_ket y))) l)) l) = (ket_sum_l sy (fun (y:bitvec) => (infix_asdtdt (sum sx (fun (x:bitvec) => ((f x) y))) (bv_to_ket y))) l)). Axiom mat_mult_ket_basis_bv_value : forall (m:matrix complex) (x:bitvec) (i:Z) (l:Z), ((length x) = l) -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z l))%Z) -> (((columns m) = (rows m)) /\ ((rows m) = (power_ 2%Z l))) -> ((get_ket (mat_mult m (bv_to_ket x)) i) = (get m i (bv_to_int x))). Axiom mat_mult_ket_basis_bv_value_gen : forall (m:matrix complex) (l:Z), (((columns m) = (rows m)) /\ ((rows m) = (power_ 2%Z l))) -> forall (x:bitvec), forall (i:Z), ((length x) = l) -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z l))%Z) -> ((get_ket (mat_mult m (bv_to_ket x)) i) = (get m i (bv_to_int x))). Axiom mat_mult_ket_injec_eq_left : forall (m:matrix complex) (n:matrix complex) (l:Z), ((rows m) = (power_ 2%Z l)) -> ((columns m) = (power_ 2%Z l)) -> ((rows n) = (power_ 2%Z l)) -> ((columns n) = (power_ 2%Z l)) -> (forall (x:bitvec), ((length x) = l) -> ((mat_mult m (bv_to_ket x)) = (mat_mult n (bv_to_ket x)))) -> (m = n). Axiom pps : Type. Parameter pps_WhyType : WhyType pps. Existing Instance pps_WhyType. Parameter h_width: pps -> Z. Parameter h_range: pps -> Z. Parameter h_basis_ket: pps -> (Z -> Z) -> (Z -> Z) -> Z -> Z. Parameter h_angle: pps -> (Z -> Z) -> (Z -> Z) -> angle. Axiom pps'invariant : forall (self:pps), (0%Z <= (h_width self))%Z. Axiom pps'invariant1 : forall (self:pps), (0%Z <= (h_range self))%Z. Axiom pps'invariant2 : forall (self:pps), forall (x:Z -> Z) (y:Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_width self))%Z) -> (0%Z <= (x i))%Z /\ ((x i) < 2%Z)%Z) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_range self))%Z) -> (0%Z <= (y i))%Z /\ ((y i) < 2%Z)%Z) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_width self))%Z) -> (0%Z <= ((((h_basis_ket self) x) y) i))%Z. Axiom pps'invariant3 : forall (self:pps), forall (x:Z -> Z) (y:Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_width self))%Z) -> (0%Z <= (x i))%Z /\ ((x i) < 2%Z)%Z) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_range self))%Z) -> (0%Z <= (y i))%Z /\ ((y i) < 2%Z)%Z) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_width self))%Z) -> (((((h_basis_ket self) x) y) i) < 2%Z)%Z. Axiom pps'invariant4 : forall (self:pps), forall (x:Z -> Z) (x':Z -> Z) (y:Z -> Z) (y':Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_width self))%Z) -> ((x i) = (x' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_range self))%Z) -> ((y i) = (y' i))) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_width self))%Z) -> (((((h_basis_ket self) x) y) i) = ((((h_basis_ket self) x') y') i)). Axiom pps'invariant5 : forall (self:pps), forall (x:Z -> Z) (x':Z -> Z) (y:Z -> Z) (y':Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_width self))%Z) -> ((x i) = (x' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_range self))%Z) -> ((y i) = (y' i))) -> ((((h_angle self) x) y) = (((h_angle self) x') y')). Parameter build_pps: Z -> Z -> ((Z -> Z) -> (Z -> Z) -> Z -> Z) -> ((Z -> Z) -> (Z -> Z) -> angle) -> pps. Axiom build_pps_spec : forall (w:Z) (r:Z) (k:(Z -> Z) -> (Z -> Z) -> Z -> Z) (a:(Z -> Z) -> (Z -> Z) -> angle), (0%Z <= w)%Z -> (0%Z <= r)%Z -> (forall (x:Z -> Z) (y:Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> (0%Z <= (x i))%Z /\ ((x i) < 2%Z)%Z) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> (0%Z <= (y i))%Z /\ ((y i) < 2%Z)%Z) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> (0%Z <= (((k x) y) i))%Z /\ ((((k x) y) i) < 2%Z)%Z) -> (forall (x:Z -> Z) (x':Z -> Z) (y:Z -> Z) (y':Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((x i) = (x' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((y i) = (y' i))) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((((k x) y) i) = (((k x') y') i))) -> (forall (x:Z -> Z) (x':Z -> Z) (y:Z -> Z) (y':Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((x i) = (x' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((y i) = (y' i))) -> (((a x) y) = ((a x') y'))) -> ((h_width (build_pps w r k a)) = w). Axiom build_pps_spec1 : forall (w:Z) (r:Z) (k:(Z -> Z) -> (Z -> Z) -> Z -> Z) (a:(Z -> Z) -> (Z -> Z) -> angle), (0%Z <= w)%Z -> (0%Z <= r)%Z -> (forall (x:Z -> Z) (y:Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> (0%Z <= (x i))%Z /\ ((x i) < 2%Z)%Z) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> (0%Z <= (y i))%Z /\ ((y i) < 2%Z)%Z) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> (0%Z <= (((k x) y) i))%Z /\ ((((k x) y) i) < 2%Z)%Z) -> (forall (x:Z -> Z) (x':Z -> Z) (y:Z -> Z) (y':Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((x i) = (x' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((y i) = (y' i))) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((((k x) y) i) = (((k x') y') i))) -> (forall (x:Z -> Z) (x':Z -> Z) (y:Z -> Z) (y':Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((x i) = (x' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((y i) = (y' i))) -> (((a x) y) = ((a x') y'))) -> ((h_range (build_pps w r k a)) = r). Axiom build_pps_spec2 : forall (w:Z) (r:Z) (k:(Z -> Z) -> (Z -> Z) -> Z -> Z) (a:(Z -> Z) -> (Z -> Z) -> angle), (0%Z <= w)%Z -> (0%Z <= r)%Z -> (forall (x:Z -> Z) (y:Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> (0%Z <= (x i))%Z /\ ((x i) < 2%Z)%Z) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> (0%Z <= (y i))%Z /\ ((y i) < 2%Z)%Z) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> (0%Z <= (((k x) y) i))%Z /\ ((((k x) y) i) < 2%Z)%Z) -> (forall (x:Z -> Z) (x':Z -> Z) (y:Z -> Z) (y':Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((x i) = (x' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((y i) = (y' i))) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((((k x) y) i) = (((k x') y') i))) -> (forall (x:Z -> Z) (x':Z -> Z) (y:Z -> Z) (y':Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((x i) = (x' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((y i) = (y' i))) -> (((a x) y) = ((a x') y'))) -> forall (x:bitvec) (y:bitvec), forall (i:Z), ((length x) = w) -> ((length y) = r) -> ((0%Z <= i)%Z /\ (i < w)%Z) -> (((((h_basis_ket (build_pps w r k a)) (getbv x)) (getbv y)) i) = (int.EuclideanDivision.mod1 (((k (getbv x)) (getbv y)) i) 2%Z)). Axiom build_pps_spec3 : forall (w:Z) (r:Z) (k:(Z -> Z) -> (Z -> Z) -> Z -> Z) (a:(Z -> Z) -> (Z -> Z) -> angle), (0%Z <= w)%Z -> (0%Z <= r)%Z -> (forall (x:Z -> Z) (y:Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> (0%Z <= (x i))%Z /\ ((x i) < 2%Z)%Z) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> (0%Z <= (y i))%Z /\ ((y i) < 2%Z)%Z) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> (0%Z <= (((k x) y) i))%Z /\ ((((k x) y) i) < 2%Z)%Z) -> (forall (x:Z -> Z) (x':Z -> Z) (y:Z -> Z) (y':Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((x i) = (x' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((y i) = (y' i))) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((((k x) y) i) = (((k x') y') i))) -> (forall (x:Z -> Z) (x':Z -> Z) (y:Z -> Z) (y':Z -> Z), (forall (i:Z), ((0%Z <= i)%Z /\ (i < w)%Z) -> ((x i) = (x' i))) -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < r)%Z) -> ((y i) = (y' i))) -> (((a x) y) = ((a x') y'))) -> forall (x:bitvec) (y:bitvec), ((length x) = w) -> ((length y) = r) -> ((((h_angle (build_pps w r k a)) (getbv x)) (getbv y)) = ((a (getbv x)) (getbv y))). Parameter build_pps_bv: Z -> Z -> (bitvec -> bitvec -> bitvec) -> (bitvec -> bitvec -> angle) -> pps. Axiom build_pps_bv_def : forall (w:Z) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle), (0%Z <= w)%Z -> (0%Z <= r)%Z -> (forall (x:bitvec) (y:bitvec), ((length x) = w) -> ((length y) = r) -> ((length ((k x) y)) = w)) -> ((build_pps_bv w r k a) = (build_pps w r (fun (x:Z -> Z) (y:Z -> Z) => (getbv ((k (make_bv (fun (i:Z) => (int.EuclideanDivision.mod1 (x i) 2%Z)) w)) (make_bv (fun (i:Z) => (int.EuclideanDivision.mod1 (y i) 2%Z)) r)))) (fun (x:Z -> Z) (y:Z -> Z) => ((a (make_bv (fun (i:Z) => (int.EuclideanDivision.mod1 (x i) 2%Z)) w)) (make_bv (fun (i:Z) => (int.EuclideanDivision.mod1 (y i) 2%Z)) r))))). Axiom build_pps_bv_spec : forall (w:Z) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle), (0%Z <= w)%Z -> (0%Z <= r)%Z -> (forall (x:bitvec) (y:bitvec), ((length x) = w) -> ((length y) = r) -> ((length ((k x) y)) = w)) -> ((h_width (build_pps_bv w r k a)) = w). Axiom build_pps_bv_spec1 : forall (w:Z) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle), (0%Z <= w)%Z -> (0%Z <= r)%Z -> (forall (x:bitvec) (y:bitvec), ((length x) = w) -> ((length y) = r) -> ((length ((k x) y)) = w)) -> ((h_range (build_pps_bv w r k a)) = r). Axiom build_pps_bv_spec2 : forall (w:Z) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle), (0%Z <= w)%Z -> (0%Z <= r)%Z -> (forall (x:bitvec) (y:bitvec), ((length x) = w) -> ((length y) = r) -> ((length ((k x) y)) = w)) -> forall (x:bitvec) (y:bitvec), forall (i:Z), ((length x) = w) -> ((length y) = r) -> ((0%Z <= i)%Z /\ (i < w)%Z) -> (((((h_basis_ket (build_pps_bv w r k a)) (getbv x)) (getbv y)) i) = ((getbv ((k x) y)) i)). Axiom build_pps_bv_spec3 : forall (w:Z) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle), (0%Z <= w)%Z -> (0%Z <= r)%Z -> (forall (x:bitvec) (y:bitvec), ((length x) = w) -> ((length y) = r) -> ((length ((k x) y)) = w)) -> forall (x:bitvec) (y:bitvec), ((length x) = w) -> ((length y) = r) -> ((((h_angle (build_pps_bv w r k a)) (getbv x)) (getbv y)) = ((a x) y)). Parameter h_basis_ket_bv: pps -> bitvec -> bitvec -> bitvec. Axiom h_basis_ket_bv_def : forall (h:pps) (x:bitvec) (y:bitvec), ((length x) = (h_width h)) -> ((length y) = (h_range h)) -> ((h_basis_ket_bv h x y) = (make_bv (((h_basis_ket h) (getbv x)) (getbv y)) (h_width h))). Axiom h_basis_ket_bv_spec : forall (h:pps) (x:bitvec) (y:bitvec), ((length x) = (h_width h)) -> ((length y) = (h_range h)) -> ((length (h_basis_ket_bv h x y)) = (h_width h)). Axiom h_basis_ket_bv_spec1 : forall (h:pps) (x:bitvec) (y:bitvec), ((length x) = (h_width h)) -> ((length y) = (h_range h)) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (((getbv (h_basis_ket_bv h x y)) i) = ((((h_basis_ket h) (getbv x)) (getbv y)) i)). Parameter h_angle_bv: pps -> bitvec -> bitvec -> angle. Axiom h_angle_bv_def : forall (h:pps) (x:bitvec) (y:bitvec), ((length x) = (h_width h)) -> ((length y) = (h_range h)) -> ((h_angle_bv h x y) = (((h_angle h) (getbv x)) (getbv y))). Axiom pps_ket_bound : forall (h:pps) (x:Z -> Z) (y:Z -> Z) (i:Z), ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (h_width h))%Z) -> (0%Z <= (x i1))%Z /\ ((x i1) < 2%Z)%Z) -> (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (h_range h))%Z) -> (0%Z <= (y i1))%Z /\ ((y i1) < 2%Z)%Z) -> (0%Z <= ((((h_basis_ket h) x) y) i))%Z. Axiom pps_ket_bound1 : forall (h:pps) (x:Z -> Z) (y:Z -> Z) (i:Z), ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (h_width h))%Z) -> (0%Z <= (x i1))%Z /\ ((x i1) < 2%Z)%Z) -> (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (h_range h))%Z) -> (0%Z <= (y i1))%Z /\ ((y i1) < 2%Z)%Z) -> (((((h_basis_ket h) x) y) i) < 2%Z)%Z. Axiom low_pps_ket_bound : forall (h:pps) (x:Z -> Z) (y:Z -> Z) (i:Z), ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (h_width h))%Z) -> (0%Z <= (x i1))%Z /\ ((x i1) < 2%Z)%Z) -> (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (h_range h))%Z) -> (0%Z <= (y i1))%Z /\ ((y i1) < 2%Z)%Z) -> (0%Z <= ((((h_basis_ket h) x) y) i))%Z. Axiom high_pps_ket_bound : forall (h:pps) (x:Z -> Z) (y:Z -> Z) (i:Z), ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (h_width h))%Z) -> (0%Z <= (x i1))%Z /\ ((x i1) < 2%Z)%Z) -> (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (h_range h))%Z) -> (0%Z <= (y i1))%Z /\ ((y i1) < 2%Z)%Z) -> (((((h_basis_ket h) x) y) i) < 2%Z)%Z. Parameter pps_apply_basis: pps -> bitvec -> matrix complex. Axiom pps_apply_basis_def : forall (h:pps) (x:bitvec), ((length x) = (h_width h)) -> ((pps_apply_basis h x) = (infix_asdtdt (pow_inv_sqrt_2 (h_range h)) (ket_sum_l (n_bvs (h_range h)) (fun (y:bitvec) => (infix_asdtdt (ang_exp (((h_angle h) (getbv x)) (getbv y))) (bv_to_ket (make_bv (((h_basis_ket h) (getbv x)) (getbv y)) (h_width h))))) (h_width h)))). Axiom pps_apply_basis_spec : forall (h:pps) (x:bitvec), ((length x) = (h_width h)) -> is_a_ket_l (pps_apply_basis h x) (h_width h). Axiom pps_apply_basis_spec1 : forall (h:pps) (x:bitvec), ((length x) = (h_width h)) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z (h_width h)))%Z) -> ((get_ket (pps_apply_basis h x) i) = (infix_asdt (pow_inv_sqrt_2 (h_range h)) (sum (n_bvs (h_range h)) (fun (y:bitvec) => (infix_asdt (ang_exp (((h_angle h) (getbv x)) (getbv y))) (indic (bv_to_int (make_bv (((h_basis_ket h) (getbv x)) (getbv y)) (h_width h))) i)))))). Axiom pps_apply_basis_decomp : forall (h:pps) (x:bitvec), ((length x) = (h_width h)) -> ((pps_apply_basis h x) = (ket_sum_l (n_bvs (h_width h)) (fun (z:bitvec) => (infix_asdtdt (infix_asdt (pow_inv_sqrt_2 (h_range h)) (sum (n_bvs (h_range h)) (fun (y:bitvec) => (infix_asdt (ang_exp (((h_angle h) (getbv x)) (getbv y))) (indic (h_basis_ket_bv h x y) z))))) (ket (h_width h) (bv_to_int z)))) (h_width h))). Axiom pps_apply_basis_ket_l : forall (h:pps) (x:bitvec) (l:Z), ((length x) = l) -> (l = (h_width h)) -> is_a_ket_l (pps_apply_basis h x) l. Axiom pps_apply_basis_ket_length : forall (h:pps) (x:bitvec) (l:Z), ((length x) = l) -> (l = (h_width h)) -> ((ket_length (pps_apply_basis h x)) = l). Axiom pps_apply_basis_bv : forall (h:pps) (x:bitvec), ((length x) = (h_width h)) -> ((pps_apply_basis h x) = (infix_asdtdt (pow_inv_sqrt_2 (h_range h)) (ket_sum_l (n_bvs (h_range h)) (fun (y:bitvec) => (infix_asdtdt (ang_exp (h_angle_bv h x y)) (bv_to_ket (h_basis_ket_bv h x y)))) (h_width h)))). Axiom pps_apply_basis_value : forall (h:pps) (x:bitvec), ((length x) = (h_width h)) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < (power_ 2%Z (h_width h)))%Z) -> ((get_ket (pps_apply_basis h x) i) = (infix_asdt (pow_inv_sqrt_2 (h_range h)) (sum (n_bvs (h_range h)) (fun (y:bitvec) => (infix_asdt (ang_exp (h_angle_bv h x y)) (indic (h_basis_ket_bv h x y) (int_to_bv i (h_width h)))))))). Parameter pps_apply: pps -> (matrix complex) -> matrix complex. Parameter result18: pps -> (matrix complex) -> bitvec -> matrix complex. Axiom result_def18 : forall (h:pps) (x:matrix complex) (y:bitvec), (((length y) = (h_width h)) -> (((result18 h x) y) = (infix_asdtdt (get_ket x (bv_to_int y)) (pps_apply_basis h y)))) /\ (~ ((length y) = (h_width h)) -> (((result18 h x) y) = x)). Axiom pps_apply_def : forall (h:pps) (x:matrix complex), (is_a_ket_l x (h_width h)) -> ((pps_apply h x) = (ket_sum_l (n_bvs (h_width h)) (result18 h x) (h_width h))). Axiom pps_apply_spec : forall (h:pps) (x:matrix complex), (is_a_ket_l x (h_width h)) -> is_a_ket_l (pps_apply h x) (h_width h). Axiom get_pps_apply : forall (h:pps) (x:matrix complex), (is_a_ket_l x (h_width h)) -> ((pps_apply h x) = (ket_sum_l (n_bvs (h_width h)) (fun (y:bitvec) => (infix_asdtdt (get_ket x (bv_to_int y)) (pps_apply_basis h y))) (h_width h))). Axiom rewrite_pps_apply_basis : forall (h:pps) (x:matrix complex), (is_a_ket_l x (h_width h)) -> (is_a_ket_basis_elt x) -> ((pps_apply h x) = (pps_apply_basis h (ket_to_bv x))). Axiom rewrite_pps_apply_basis_rev : forall (h:pps) (x:bitvec), ((length x) = (h_width h)) -> ((pps_apply_basis h x) = (pps_apply h (bv_to_ket x))). Axiom pps_apply_decomp : forall (h:pps) (x:matrix complex), (is_a_ket_l x (h_width h)) -> ((pps_apply h x) = (ket_sum_l (n_bvs (h_width h)) (fun (z:bitvec) => (infix_asdtdt (get_ket x (bv_to_int z)) (pps_apply h (bv_to_ket z)))) (h_width h))). Axiom pps_apply_scal : forall (h:pps) (x:matrix complex) (a:complex), (is_a_ket_l x (h_width h)) -> ((pps_apply h (infix_asdtdt a x)) = (infix_asdtdt a (pps_apply h x))). Axiom pps_apply_add : forall (h:pps) (x:matrix complex) (y:matrix complex) (l:Z), (is_a_ket_l x (h_width h)) -> (is_a_ket_l y (h_width h)) -> (l = (h_width h)) -> ((pps_apply h (add_ket_l x y l)) = (add_ket_l (pps_apply h x) (pps_apply h y) l)). Axiom pps_apply_sum : forall {a:Type} {a_WT:WhyType a}, forall (h:pps) (s:set a) (f:a -> matrix complex) (l:Z), (1%Z <= (cardinal s))%Z -> (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) (h_width h)) -> (l = (h_width h)) -> ((pps_apply h (ket_sum_l s f l)) = (ket_sum_l s (fun (e1:a) => (pps_apply h (f e1))) l)). Parameter pps_id: pps. Axiom pps_id_def : ((h_width pps_id) = 1%Z). Axiom pps_id_def1 : ((h_range pps_id) = 0%Z). Axiom pps_id_def2 : forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (((((h_basis_ket pps_id) x) y) i) = (x i)). Axiom pps_id_def3 : forall (x:Z -> Z) (y:Z -> Z), ((((h_angle pps_id) x) y) = ang_zero). Parameter pps_swap: pps. Axiom pps_swap_def : ((h_width pps_swap) = 2%Z). Axiom pps_swap_def1 : ((h_range pps_swap) = 0%Z). Axiom pps_swap_def2 : forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (((x 0%Z) = (x 1%Z)) -> (((((h_basis_ket pps_swap) x) y) i) = (x i))) /\ (~ ((x 0%Z) = (x 1%Z)) -> (((((h_basis_ket pps_swap) x) y) i) = (x (1%Z - i)%Z))). Axiom pps_swap_def3 : forall (x:Z -> Z) (y:Z -> Z), ((((h_angle pps_swap) x) y) = ang_zero). Parameter pps_phase: Z -> pps. Axiom pps_phase_spec : forall (k:Z), ((h_width (pps_phase k)) = 1%Z). Axiom pps_phase_spec1 : forall (k:Z), ((h_range (pps_phase k)) = 0%Z). Axiom pps_phase_spec2 : forall (k:Z), forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (((((h_basis_ket (pps_phase k)) x) y) i) = (x i)). Axiom pps_phase_spec3 : forall (k:Z), forall (x:Z -> Z) (y:Z -> Z), ((0%Z <= k)%Z -> ((((h_angle (pps_phase k)) x) y) = (int_to_ang 1%Z k))) /\ (~ (0%Z <= k)%Z -> ((((h_angle (pps_phase k)) x) y) = (int_to_ang (-1%Z)%Z (-k)%Z))). Parameter pps_rz: Z -> pps. Axiom pps_rz_spec : forall (k:Z), ((h_width (pps_rz k)) = 1%Z). Axiom pps_rz_spec1 : forall (k:Z), ((h_range (pps_rz k)) = 0%Z). Axiom pps_rz_spec2 : forall (k:Z), forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (((((h_basis_ket (pps_rz k)) x) y) i) = (x i)). Axiom pps_rz_spec3 : forall (k:Z), forall (x:Z -> Z) (y:Z -> Z), (((x 0%Z) = 0%Z) -> ((((h_angle (pps_rz k)) x) y) = ang_zero)) /\ (~ ((x 0%Z) = 0%Z) -> ((0%Z <= k)%Z -> ((((h_angle (pps_rz k)) x) y) = (int_to_ang 1%Z k))) /\ (~ (0%Z <= k)%Z -> ((((h_angle (pps_rz k)) x) y) = (int_to_ang (-1%Z)%Z (-k)%Z)))). Parameter pps_hadamard: pps. Axiom pps_hadamard_def : ((h_width pps_hadamard) = 1%Z). Axiom pps_hadamard_def1 : ((h_range pps_hadamard) = 1%Z). Axiom pps_hadamard_def2 : forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (((((h_basis_ket pps_hadamard) x) y) i) = (y i)). Axiom pps_hadamard_def3 : forall (x:Z -> Z) (y:Z -> Z), ((((x 0%Z) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((((h_angle pps_hadamard) x) y) = ang_minus_one)) /\ (~ (((x 0%Z) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((((h_angle pps_hadamard) x) y) = ang_zero)). Parameter pps_cnot: pps. Axiom pps_cnot_def : ((h_width pps_cnot) = 2%Z). Axiom pps_cnot_def1 : ((h_range pps_cnot) = 0%Z). Axiom pps_cnot_def2 : forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((i = 0%Z) -> (((((h_basis_ket pps_cnot) x) y) i) = (x i))) /\ (~ (i = 0%Z) -> (((((h_basis_ket pps_cnot) x) y) i) = (int.EuclideanDivision.mod1 ((x 0%Z) + (x i))%Z 2%Z))). Axiom pps_cnot_def3 : forall (x:Z -> Z) (y:Z -> Z), ((((h_angle pps_cnot) x) y) = ang_zero). Axiom pps_id_apply_basis : forall (x:bitvec), ((length x) = 1%Z) -> ((pps_apply_basis pps_id x) = (bv_to_ket x)). Axiom pps_swap_apply_basis : forall (x:bitvec), ((length x) = 2%Z) -> (((bv_to_int x) = 0%Z) -> ((pps_apply_basis pps_swap x) = (ket 2%Z 0%Z))) /\ (~ ((bv_to_int x) = 0%Z) -> (((bv_to_int x) = 1%Z) -> ((pps_apply_basis pps_swap x) = (ket 2%Z 2%Z))) /\ (~ ((bv_to_int x) = 1%Z) -> (((bv_to_int x) = 2%Z) -> ((pps_apply_basis pps_swap x) = (ket 2%Z 1%Z))) /\ (~ ((bv_to_int x) = 2%Z) -> ((pps_apply_basis pps_swap x) = (ket 2%Z 3%Z))))). Axiom pps_cnot_apply_basis : forall (x:bitvec), ((length x) = 2%Z) -> (((bv_to_int x) = 0%Z) -> ((pps_apply_basis pps_cnot x) = (ket 2%Z 0%Z))) /\ (~ ((bv_to_int x) = 0%Z) -> (((bv_to_int x) = 1%Z) -> ((pps_apply_basis pps_cnot x) = (ket 2%Z 1%Z))) /\ (~ ((bv_to_int x) = 1%Z) -> (((bv_to_int x) = 2%Z) -> ((pps_apply_basis pps_cnot x) = (ket 2%Z 3%Z))) /\ (~ ((bv_to_int x) = 2%Z) -> ((pps_apply_basis pps_cnot x) = (ket 2%Z 2%Z))))). Axiom pps_phase_apply_basis : forall (k:Z) (x:bitvec), ((length x) = 1%Z) -> ((0%Z <= k)%Z -> ((pps_apply_basis (pps_phase k) x) = (infix_asdtdt (ang_exp (int_to_ang 1%Z k)) (bv_to_ket x)))) /\ (~ (0%Z <= k)%Z -> ((pps_apply_basis (pps_phase k) x) = (infix_asdtdt (ang_exp (int_to_ang (-1%Z)%Z (-k)%Z)) (bv_to_ket x)))). Axiom pps_rz_apply_basis : forall (k:Z) (x:bitvec), ((length x) = 1%Z) -> ((((getbv x) 0%Z) = 0%Z) -> ((pps_apply_basis (pps_rz k) x) = (bv_to_ket x))) /\ (~ (((getbv x) 0%Z) = 0%Z) -> ((0%Z <= k)%Z -> ((pps_apply_basis (pps_rz k) x) = (infix_asdtdt (ang_exp (int_to_ang 1%Z k)) (bv_to_ket x)))) /\ (~ (0%Z <= k)%Z -> ((pps_apply_basis (pps_rz k) x) = (infix_asdtdt (ang_exp (int_to_ang (-1%Z)%Z (-k)%Z)) (bv_to_ket x))))). Axiom pps_hadamard_apply_basis : forall (x:bitvec), ((length x) = 1%Z) -> ((((getbv x) 0%Z) = 0%Z) -> ((pps_apply_basis pps_hadamard x) = (infix_asdtdt (pow_inv_sqrt_2 1%Z) (add_ket_l (ket 1%Z 0%Z) (ket 1%Z 1%Z) 1%Z)))) /\ (~ (((getbv x) 0%Z) = 0%Z) -> ((pps_apply_basis pps_hadamard x) = (infix_asdtdt (pow_inv_sqrt_2 1%Z) (add_ket_l (ket 1%Z 0%Z) (infix_asdtdt (prefix_mndt c_one) (ket 1%Z 1%Z)) 1%Z)))). Parameter pps_seq: pps -> pps -> pps. Axiom pps_seq_spec : forall (h1:pps) (h2:pps), ((h_width h1) = (h_width h2)) -> ((h_width (pps_seq h1 h2)) = (h_width h1)). Axiom pps_seq_spec1 : forall (h1:pps) (h2:pps), ((h_width h1) = (h_width h2)) -> ((h_range (pps_seq h1 h2)) = ((h_range h1) + (h_range h2))%Z). Axiom pps_seq_spec2 : forall (h1:pps) (h2:pps), ((h_width h1) = (h_width h2)) -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (((((h_basis_ket (pps_seq h1 h2)) x) y) i) = ((((h_basis_ket h2) (((h_basis_ket h1) x) y)) fun (k:Z) => (y (k + (h_range h1))%Z)) i)). Axiom pps_seq_spec3 : forall (h1:pps) (h2:pps), ((h_width h1) = (h_width h2)) -> forall (x:Z -> Z) (y:Z -> Z), ((((h_angle (pps_seq h1 h2)) x) y) = (ang_add (((h_angle h1) x) y) (((h_angle h2) (((h_basis_ket h1) x) y)) fun (k:Z) => (y (k + (h_range h1))%Z)))). Axiom h_basis_ket_bv_seq : forall (h1:pps) (h2:pps) (x:bitvec) (y:bitvec), ((h_width h1) = (h_width h2)) -> ((length x) = (h_width h1)) -> ((length y) = ((h_range h1) + (h_range h2))%Z) -> ((h_basis_ket_bv (pps_seq h1 h2) x y) = (h_basis_ket_bv h2 (h_basis_ket_bv h1 x (hpart y (h_range h1))) (tpart y (h_range h1)))). Axiom h_angle_bv_seq : forall (h1:pps) (h2:pps) (x:bitvec) (y:bitvec), ((h_width h1) = (h_width h2)) -> ((length x) = (h_width h1)) -> ((length y) = ((h_range h1) + (h_range h2))%Z) -> ((h_angle_bv (pps_seq h1 h2) x y) = (ang_add (h_angle_bv h1 x (hpart y (h_range h1))) (h_angle_bv h2 (h_basis_ket_bv h1 x (hpart y (h_range h1))) (tpart y (h_range h1))))). Parameter pps_par: pps -> pps -> pps. Axiom pps_par_spec : forall (h1:pps) (h2:pps), ((h_width (pps_par h1 h2)) = ((h_width h1) + (h_width h2))%Z). Axiom pps_par_spec1 : forall (h1:pps) (h2:pps), ((h_range (pps_par h1 h2)) = ((h_range h1) + (h_range h2))%Z). Axiom pps_par_spec2 : forall (h1:pps) (h2:pps), forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((i < (h_width h1))%Z -> (((((h_basis_ket (pps_par h1 h2)) x) y) i) = ((((h_basis_ket h1) x) y) i))) /\ (~ (i < (h_width h1))%Z -> (((((h_basis_ket (pps_par h1 h2)) x) y) i) = ((((h_basis_ket h2) fun (k:Z) => (x (k + (h_width h1))%Z)) fun (k:Z) => (y (k + (h_range h1))%Z)) (i - (h_width h1))%Z))). Axiom pps_par_spec3 : forall (h1:pps) (h2:pps), forall (x:Z -> Z) (y:Z -> Z), ((((h_angle (pps_par h1 h2)) x) y) = (ang_add (((h_angle h1) x) y) (((h_angle h2) fun (k:Z) => (x (k + (h_width h1))%Z)) fun (k:Z) => (y (k + (h_range h1))%Z)))). Axiom h_basis_ket_bv_par : forall (h1:pps) (h2:pps) (x:bitvec) (y:bitvec), ((length x) = ((h_width h1) + (h_width h2))%Z) -> ((length y) = ((h_range h1) + (h_range h2))%Z) -> ((h_basis_ket_bv (pps_par h1 h2) x y) = (concat (h_basis_ket_bv h1 (hpart x (h_width h1)) (hpart y (h_range h1))) (h_basis_ket_bv h2 (tpart x (h_width h1)) (tpart y (h_range h1))))). Axiom h_angle_bv_par : forall (h1:pps) (h2:pps) (x:bitvec) (y:bitvec), ((length x) = ((h_width h1) + (h_width h2))%Z) -> ((length y) = ((h_range h1) + (h_range h2))%Z) -> ((h_angle_bv (pps_par h1 h2) x y) = (ang_add (h_angle_bv h1 (hpart x (h_width h1)) (hpart y (h_range h1))) (h_angle_bv h2 (tpart x (h_width h1)) (tpart y (h_range h1))))). Axiom kron_to_ket_l : forall (x:matrix complex) (l:Z), (0%Z <= l)%Z -> (is_a_ket_l (kronecker x (ket 1%Z 0%Z)) (l + 1%Z)%Z) -> is_a_ket_l x l. Parameter pps_anc: pps -> pps. Axiom pps_anc_spec : forall (h1:pps), (1%Z <= (h_width h1))%Z -> ((h_width (pps_anc h1)) = ((h_width h1) - 1%Z)%Z). Axiom pps_anc_spec1 : forall (h1:pps), (1%Z <= (h_width h1))%Z -> ((h_range (pps_anc h1)) = (h_range h1)). Parameter fc11: pps -> (Z -> Z) -> Z -> Z. Axiom fc_def11 : forall (h1:pps) (x:Z -> Z) (k:Z), ((k = ((h_width h1) - 1%Z)%Z) -> (((fc11 h1 x) k) = 0%Z)) /\ (~ (k = ((h_width h1) - 1%Z)%Z) -> (((fc11 h1 x) k) = (x k))). Axiom pps_anc_spec2 : forall (h1:pps), (1%Z <= (h_width h1))%Z -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (((((h_basis_ket (pps_anc h1)) x) y) i) = ((((h_basis_ket h1) (fc11 h1 x)) y) i)). Parameter fc12: pps -> (Z -> Z) -> Z -> Z. Axiom fc_def12 : forall (h1:pps) (x:Z -> Z) (k:Z), ((k = ((h_width h1) - 1%Z)%Z) -> (((fc12 h1 x) k) = 0%Z)) /\ (~ (k = ((h_width h1) - 1%Z)%Z) -> (((fc12 h1 x) k) = (x k))). Axiom pps_anc_spec3 : forall (h1:pps), (1%Z <= (h_width h1))%Z -> forall (x:Z -> Z) (y:Z -> Z), ((((h_angle (pps_anc h1)) x) y) = (((h_angle h1) (fc12 h1 x)) y)). Axiom h_basis_ket_bv_anc : forall (h:pps) (x:bitvec) (y:bitvec), (1%Z <= (h_width h))%Z -> ((length x) = ((h_width h) - 1%Z)%Z) -> ((length y) = (h_range h)) -> ((h_basis_ket_bv (pps_anc h) x y) = (hpart (h_basis_ket_bv h (concat x (make_bv (fun (us:Z) => 0%Z) 1%Z)) y) ((h_width h) - 1%Z)%Z)). Axiom h_basis_ket_bv_anc_ : forall (h:pps) (x:bitvec) (y:bitvec) (l:Z), (1%Z <= (h_width h))%Z -> (((getbv x) ((h_width h) - 1%Z)%Z) = 0%Z) -> ((length x) = (h_width h)) -> (l = ((h_width h) - 1%Z)%Z) -> ((length y) = (h_range h)) -> ((h_basis_ket_bv (pps_anc h) (hpart x l) y) = (hpart (h_basis_ket_bv h x y) ((h_width h) - 1%Z)%Z)). Axiom h_angle_bv_anc : forall (h:pps) (x:bitvec) (y:bitvec), (1%Z <= (h_width h))%Z -> ((length x) = ((h_width h) - 1%Z)%Z) -> ((length y) = (h_range h)) -> ((h_angle_bv (pps_anc h) x y) = (h_angle_bv h (concat x (make_bv (fun (us:Z) => 0%Z) 1%Z)) y)). Axiom h_angle_bv_anc_ : forall (h:pps) (x:bitvec) (y:bitvec) (l:Z), (1%Z <= (h_width h))%Z -> (((getbv x) ((h_width h) - 1%Z)%Z) = 0%Z) -> ((length x) = (h_width h)) -> (l = ((h_width h) - 1%Z)%Z) -> ((length y) = (h_range h)) -> ((h_angle_bv (pps_anc h) (hpart x l) y) = (h_angle_bv h x y)). Parameter is_diagonal: (matrix complex) -> Prop. Parameter fc13: (Z -> complex) -> Z -> Z -> complex. Axiom fc_def13 : forall (f:Z -> complex) (i:Z) (j:Z), ((i = j) -> ((((fc13 f) i) j) = (f i))) /\ (~ (i = j) -> ((((fc13 f) i) j) = c_zero)). Axiom is_diagonal_def : forall (m:matrix complex), (is_diagonal m) -> exists f:Z -> complex, (m = (make_f (rows m) (rows m) (fc13 f))). Parameter fc14: (Z -> complex) -> Z -> Z -> complex. Axiom fc_def14 : forall (f:Z -> complex) (i:Z) (j:Z), ((i = j) -> ((((fc14 f) i) j) = (f i))) /\ (~ (i = j) -> ((((fc14 f) i) j) = c_zero)). Axiom is_diagonal_def1 : forall (m:matrix complex), (exists f:Z -> complex, (m = (make_f (rows m) (rows m) (fc14 f)))) -> is_diagonal m. Parameter diag_mat: (Z -> complex) -> Z -> matrix complex. Parameter result19: (Z -> complex) -> Z -> Z -> complex. Axiom result_def19 : forall (f:Z -> complex) (i:Z) (j:Z), ((i = j) -> ((((result19 f) i) j) = (f i))) /\ (~ (i = j) -> ((((result19 f) i) j) = c_zero)). Axiom diag_mat_def : forall (f:Z -> complex) (s:Z), (0%Z < s)%Z -> ((diag_mat f s) = (make_f s s (result19 f))). Axiom diag_mat_spec : forall (f:Z -> complex) (s:Z), (0%Z < s)%Z -> is_diagonal (diag_mat f s). Axiom diag_mat_spec1 : forall (f:Z -> complex) (s:Z), (0%Z < s)%Z -> ((rows (diag_mat f s)) = s). Axiom diag_mat_spec2 : forall (f:Z -> complex) (s:Z), (0%Z < s)%Z -> ((columns (diag_mat f s)) = s). Axiom diag_mat_rows : forall (f:Z -> complex) (s:Z), (0%Z < s)%Z -> ((rows (diag_mat f s)) = s). Axiom diag_mat_columns : forall (f:Z -> complex) (s:Z), (0%Z < s)%Z -> ((columns (diag_mat f s)) = s). Axiom diag_mat_values : forall (f:Z -> complex) (s:Z) (i:Z) (j:Z), (0%Z < s)%Z -> ((0%Z <= i)%Z /\ (i < s)%Z) -> ((0%Z <= j)%Z /\ (j < s)%Z) -> ((i = j) -> ((get (diag_mat f s) i j) = (f i))) /\ (~ (i = j) -> ((get (diag_mat f s) i j) = c_zero)). Parameter diagonal: (matrix complex) -> Z -> complex. Axiom diagonal_def : forall (m:matrix complex) (i:Z), ((0%Z <= i)%Z /\ (i < (rows m))%Z) -> (is_diagonal m) -> ((diagonal m i) = (get m i i)). Axiom diag_mat_add : forall (f:Z -> complex) (g:Z -> complex) (h:Z -> complex) (s:Z), (0%Z < s)%Z -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> ((infix_pldt (f i) (g i)) = (h i))) -> ((add_mat (diag_mat f s) (diag_mat g s)) = (diag_mat h s)). Axiom diag_mat_subst : forall (f:Z -> complex) (g:Z -> complex) (h:Z -> complex) (s:Z), (0%Z < s)%Z -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> ((infix_mndt (f i) (g i)) = (h i))) -> ((diag_mat h s) = (mat_substr (diag_mat f s) (diag_mat g s))). Axiom diag_mat_scal : forall (f:Z -> complex) (g:Z -> complex) (s:Z) (a:complex), (0%Z < s)%Z -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> ((g i) = (infix_asdt a (f i)))) -> ((diag_mat g s) = (infix_asdtdt a (diag_mat f s))). Axiom diag_mat_eq : forall (f:Z -> complex) (g:Z -> complex) (s:Z) (s':Z), (0%Z < s)%Z -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < s)%Z) -> ((f i) = (g i))) -> (s = s') -> ((diag_mat f s) = (diag_mat g s')). Parameter id_mat: Z -> matrix complex. Axiom id_mat_def : forall (n:Z), (n >= 1%Z)%Z -> ((id_mat n) = (diag_mat (fun (i:Z) => c_one) n)). Axiom id_mat_spec : forall (n:Z), (n >= 1%Z)%Z -> forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> ((diagonal (id_mat n) i) = c_one). Axiom id_mat_spec1 : forall (n:Z), (n >= 1%Z)%Z -> ((rows (id_mat n)) = n). Axiom id_mat_spec2 : forall (n:Z), (n >= 1%Z)%Z -> ((columns (id_mat n)) = n). Axiom set_id_mat : forall (n:Z) (f:Z -> complex), (1%Z <= n)%Z -> (forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> ((f i) = c_one)) -> ((diag_mat f n) = (id_mat n)). Axiom id_mat_prod_r : forall (n:Z) (m:matrix complex), (1%Z <= n)%Z -> ((rows m) = n) -> ((mat_mult (id_mat n) m) = m). Axiom id_mat_prod_l : forall (n:Z) (m:matrix complex), (n >= 1%Z)%Z -> ((columns m) = n) -> ((mat_mult m (id_mat n)) = m). Axiom kronecker_scalar_distr : forall (m:matrix complex) (n:matrix complex) (a:complex), ((kronecker (infix_asdtdt a m) n) = (infix_asdtdt a (kronecker m n))). Axiom kronecker_scalar_distr_r : forall (m:matrix complex) (n:matrix complex) (a:complex), ((kronecker m (infix_asdtdt a n)) = (infix_asdtdt a (kronecker m n))). Axiom kronecker_scalar_distr_rev : forall (m:matrix complex) (n:matrix complex) (a:complex), ((infix_asdtdt a (kronecker m n)) = (kronecker (infix_asdtdt a m) n)). Axiom kronecker_scalar_distr_rev_r : forall (m:matrix complex) (n:matrix complex) (a:complex), ((infix_asdtdt a (kronecker m n)) = (kronecker m (infix_asdtdt a n))). Axiom kronecker_scalars : forall (m:matrix complex) (n:matrix complex) (a:complex) (b:complex), ((kronecker (infix_asdtdt a m) (infix_asdtdt b n)) = (infix_asdtdt (infix_asdt a b) (kronecker m n))). Parameter mat_k_id: (matrix complex) -> Z -> matrix complex. Axiom mat_k_id_def : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> ((mat_k_id m n) = (kronecker m (identity n))). Axiom mat_k_id_spec : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> ((mat_k_id m n) = (make_f ((rows m) * (power 2%Z n))%Z ((columns m) * (power 2%Z n))%Z (fun (i:Z) (j:Z) => (infix_asdt (indic (int.EuclideanDivision.mod1 i (power 2%Z n)) (int.EuclideanDivision.mod1 j (power 2%Z n))) (get m (int.EuclideanDivision.div i (power 2%Z n)) (int.EuclideanDivision.div j (power 2%Z n))))))). Axiom mat_k_id_values : forall (m:matrix complex) (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < ((rows m) * (power 2%Z n))%Z)%Z) -> ((0%Z <= j)%Z /\ (j < ((columns m) * (power 2%Z n))%Z)%Z) -> ((get (mat_k_id m n) i j) = (infix_asdt (indic (int.EuclideanDivision.mod1 i (power 2%Z n)) (int.EuclideanDivision.mod1 j (power 2%Z n))) (get m (int.EuclideanDivision.div i (power 2%Z n)) (int.EuclideanDivision.div j (power 2%Z n))))). Axiom mat_k_id_rows : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> ((rows (mat_k_id m n)) = ((rows m) * (power 2%Z n))%Z). Axiom mat_k_id_columns : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns (mat_k_id m n)) = ((columns m) * (power 2%Z n))%Z). Parameter id_k_mat: (matrix complex) -> Z -> matrix complex. Axiom id_k_mat_def : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> ((id_k_mat m n) = (kronecker (identity n) m)). Axiom id_k_mat_spec : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> ((id_k_mat m n) = (make_f ((rows m) * (power 2%Z n))%Z ((columns m) * (power 2%Z n))%Z (fun (i:Z) (j:Z) => (infix_asdt (indic (int.EuclideanDivision.div i (rows m)) (int.EuclideanDivision.div j (columns m))) (get m (int.EuclideanDivision.mod1 i (rows m)) (int.EuclideanDivision.mod1 j (columns m))))))). Axiom id_k_mat_values : forall (m:matrix complex) (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < ((rows m) * (power 2%Z n))%Z)%Z) -> ((0%Z <= j)%Z /\ (j < ((columns m) * (power 2%Z n))%Z)%Z) -> ((get (id_k_mat m n) i j) = (infix_asdt (indic (int.EuclideanDivision.div i (rows m)) (int.EuclideanDivision.div j (columns m))) (get m (int.EuclideanDivision.mod1 i (rows m)) (int.EuclideanDivision.mod1 j (columns m))))). Axiom id_k_mat_rows : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> ((rows (id_k_mat m n)) = ((rows m) * (power 2%Z n))%Z). Axiom id_k_mat_columns : forall (m:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns (id_k_mat m n)) = ((columns m) * (power 2%Z n))%Z). Parameter mat_prod_k_id: (matrix complex) -> (matrix complex) -> Z -> matrix complex. Axiom mat_prod_k_id_def : forall (m:matrix complex) (o:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((mat_prod_k_id m o n) = (kronecker (mat_mult m o) (identity n))). Axiom mat_prod_k_id_spec : forall (m:matrix complex) (o:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((mat_prod_k_id m o n) = (make_f ((rows m) * (power 2%Z n))%Z ((columns o) * (power 2%Z n))%Z (fun (i:Z) (j:Z) => (infix_asdt (indic (int.EuclideanDivision.mod1 i (power 2%Z n)) (int.EuclideanDivision.mod1 j (power 2%Z n))) (ind_sum (fun (k:Z) => (infix_asdt (get m (int.EuclideanDivision.div i (power 2%Z n)) k) (get o k (int.EuclideanDivision.div j (power 2%Z n))))) 0%Z (columns m)))))). Parameter id_k_mat_prod: (matrix complex) -> (matrix complex) -> Z -> matrix complex. Axiom id_k_mat_prod_def : forall (m:matrix complex) (o:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((id_k_mat_prod m o n) = (kronecker (identity n) (mat_mult m o))). Axiom id_k_mat_prod_spec : forall (m:matrix complex) (o:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((id_k_mat_prod m o n) = (make_f ((rows m) * (power 2%Z n))%Z ((columns o) * (power 2%Z n))%Z (fun (i:Z) (j:Z) => (infix_asdt (indic (int.EuclideanDivision.div i (rows m)) (int.EuclideanDivision.div j (columns o))) (ind_sum (fun (k:Z) => (infix_asdt (get m (int.EuclideanDivision.mod1 i (rows m)) k) (get o k (int.EuclideanDivision.mod1 j (columns o))))) 0%Z (columns m)))))). Axiom filter_sum_mod_indic : forall (v:Z) (n:Z) (p:Z) (g:Z -> complex), (n > 0%Z)%Z -> (v > 0%Z)%Z -> ((0%Z <= p)%Z /\ (p < v)%Z) -> ((sum (to_fset 0%Z (v * n)%Z) (fun (k:Z) => (infix_asdt (indic (int.EuclideanDivision.mod1 k v) p) (g (int.EuclideanDivision.div k v))))) = (sum (to_fset 0%Z n) g)). Axiom filter_sum_indic_div : forall (v:Z) (n:Z) (p:Z) (g:Z -> complex), (n > 0%Z)%Z -> (v > 0%Z)%Z -> ((0%Z <= p)%Z /\ (p < n)%Z) -> ((sum (to_fset 0%Z (v * n)%Z) (fun (k:Z) => (infix_asdt (g (int.EuclideanDivision.mod1 k v)) (indic (int.EuclideanDivision.div k v) p)))) = (sum (to_fset 0%Z v) g)). Axiom filtered_ind_sum_mod_indic : forall (v:Z) (n:Z) (p:Z) (g:Z -> complex), (n > 0%Z)%Z -> (v > 0%Z)%Z -> ((0%Z <= p)%Z /\ (p < v)%Z) -> ((ind_sum (fun (k:Z) => (infix_asdt (indic (int.EuclideanDivision.mod1 k v) p) (g (int.EuclideanDivision.div k v)))) 0%Z (v * n)%Z) = (ind_sum g 0%Z n)). Axiom filtered_ind_sum_indic_div : forall (v:Z) (n:Z) (p:Z) (g:Z -> complex), (n > 0%Z)%Z -> (v > 0%Z)%Z -> ((0%Z <= p)%Z /\ (p < n)%Z) -> ((ind_sum (fun (k:Z) => (infix_asdt (g (int.EuclideanDivision.mod1 k v)) (indic (int.EuclideanDivision.div k v) p))) 0%Z (v * n)%Z) = (ind_sum g 0%Z v)). Axiom prod_mat_k_id_pre : forall (m:matrix complex) (o:matrix complex) (i:Z) (j:Z) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((0%Z <= i)%Z /\ (i < ((rows m) * (power 2%Z n))%Z)%Z) -> ((0%Z <= j)%Z /\ (j < ((columns o) * (power 2%Z n))%Z)%Z) -> ((get (mat_mult (mat_k_id m n) (mat_k_id o n)) i j) = (infix_asdt (indic (int.EuclideanDivision.mod1 i (power 2%Z n)) (int.EuclideanDivision.mod1 j (power 2%Z n))) (ind_sum (fun (k:Z) => (infix_asdt (get m (int.EuclideanDivision.div i (power 2%Z n)) k) (get o k (int.EuclideanDivision.div j (power 2%Z n))))) 0%Z (columns m)))). Parameter prod_mat_k_id: (matrix complex) -> (matrix complex) -> Z -> matrix complex. Axiom prod_mat_k_id_def : forall (m:matrix complex) (o:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((prod_mat_k_id m o n) = (mat_mult (mat_k_id m n) (mat_k_id o n))). Axiom prod_mat_k_id_spec : forall (m:matrix complex) (o:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((prod_mat_k_id m o n) = (make_f ((rows m) * (power 2%Z n))%Z ((columns o) * (power 2%Z n))%Z (fun (i:Z) (j:Z) => (infix_asdt (indic (int.EuclideanDivision.mod1 i (power 2%Z n)) (int.EuclideanDivision.mod1 j (power 2%Z n))) (ind_sum (fun (k:Z) => (infix_asdt (get m (int.EuclideanDivision.div i (power 2%Z n)) k) (get o k (int.EuclideanDivision.div j (power 2%Z n))))) 0%Z (columns m)))))). Axiom prod_mat_k_id_dec : forall (m:matrix complex) (o:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((prod_mat_k_id m o n) = (mat_prod_k_id m o n)). Axiom k_id_prod_mat_pre : forall (m:matrix complex) (o:matrix complex) (i:Z) (j:Z) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((0%Z <= i)%Z /\ (i < ((rows m) * (power 2%Z n))%Z)%Z) -> ((0%Z <= j)%Z /\ (j < ((columns o) * (power 2%Z n))%Z)%Z) -> ((get (mat_mult (id_k_mat m n) (id_k_mat o n)) i j) = (infix_asdt (indic (int.EuclideanDivision.div i (rows m)) (int.EuclideanDivision.div j (columns o))) (ind_sum (fun (k:Z) => (infix_asdt (get m (int.EuclideanDivision.mod1 i (rows m)) k) (get o k (int.EuclideanDivision.mod1 j (columns o))))) 0%Z (columns m)))). Parameter k_id_prod_mat: (matrix complex) -> (matrix complex) -> Z -> matrix complex. Axiom k_id_prod_mat_def : forall (m:matrix complex) (o:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((k_id_prod_mat m o n) = (mat_mult (id_k_mat m n) (id_k_mat o n))). Axiom k_id_prod_mat_spec : forall (m:matrix complex) (o:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((k_id_prod_mat m o n) = (make_f ((rows m) * (power 2%Z n))%Z ((columns o) * (power 2%Z n))%Z (fun (i:Z) (j:Z) => (infix_asdt (indic (int.EuclideanDivision.div i (rows m)) (int.EuclideanDivision.div j (columns o))) (ind_sum (fun (k:Z) => (infix_asdt (get m (int.EuclideanDivision.mod1 i (rows m)) k) (get o k (int.EuclideanDivision.mod1 j (columns o))))) 0%Z (columns m)))))). Axiom k_id_prod_mat_dec : forall (m:matrix complex) (o:matrix complex) (n:Z), (0%Z <= n)%Z -> ((columns m) = (rows o)) -> ((k_id_prod_mat m o n) = (id_k_mat_prod m o n)). Axiom split_ne_pre : forall (m1:matrix complex) (m2:matrix complex) (nc1:Z) (nc2:Z) (nr1:Z) (nr2:Z) (i:Z) (j:Z), (0%Z <= nr1)%Z -> (0%Z <= nr2)%Z -> (0%Z <= nc1)%Z -> (0%Z <= nc2)%Z -> ((columns m1) = (power 2%Z nc1)) -> ((columns m2) = (power 2%Z nc2)) -> ((rows m1) = (power 2%Z nr1)) -> ((rows m2) = (power 2%Z nr2)) -> ((0%Z <= i)%Z /\ (i < ((power 2%Z nr1) * (power 2%Z nr2))%Z)%Z) -> ((0%Z <= j)%Z /\ (j < ((power 2%Z nc1) * (power 2%Z nc2))%Z)%Z) -> ((get (mat_mult (id_k_mat m1 nr2) (mat_k_id m2 nc1)) i j) = (get (kronecker m2 m1) i j)). Axiom split_nw_pre : forall (m1:matrix complex) (m2:matrix complex) (nc1:Z) (nc2:Z) (nr1:Z) (nr2:Z) (i:Z) (j:Z), (0%Z <= nr1)%Z -> (0%Z <= nr2)%Z -> (0%Z <= nc1)%Z -> (0%Z <= nc2)%Z -> ((columns m1) = (power 2%Z nc1)) -> ((columns m2) = (power 2%Z nc2)) -> ((rows m1) = (power 2%Z nr1)) -> ((rows m2) = (power 2%Z nr2)) -> ((0%Z <= i)%Z /\ (i < ((power 2%Z nr1) * (power 2%Z nr2))%Z)%Z) -> ((0%Z <= j)%Z /\ (j < ((power 2%Z nc1) * (power 2%Z nc2))%Z)%Z) -> ((get (mat_mult (mat_k_id m1 nr2) (id_k_mat m2 nc1)) i j) = (get (kronecker m1 m2) i j)). Axiom split_ne : forall (m1:matrix complex) (m2:matrix complex) (nc1:Z) (nc2:Z) (nr1:Z) (nr2:Z), (0%Z <= nr1)%Z -> (0%Z <= nr2)%Z -> (0%Z <= nc1)%Z -> (0%Z <= nc2)%Z -> ((columns m1) = (power 2%Z nc1)) -> ((columns m2) = (power 2%Z nc2)) -> ((rows m1) = (power 2%Z nr1)) -> ((rows m2) = (power 2%Z nr2)) -> ((mat_mult (id_k_mat m1 nr2) (mat_k_id m2 nc1)) = (kronecker m2 m1)). Axiom split_nw : forall (m1:matrix complex) (m2:matrix complex) (nc1:Z) (nc2:Z) (nr1:Z) (nr2:Z), (0%Z <= nr1)%Z -> (0%Z <= nr2)%Z -> (0%Z <= nc1)%Z -> (0%Z <= nc2)%Z -> ((columns m1) = (power 2%Z nc1)) -> ((columns m2) = (power 2%Z nc2)) -> ((rows m1) = (power 2%Z nr1)) -> ((rows m2) = (power 2%Z nr2)) -> ((mat_mult (mat_k_id m1 nr2) (id_k_mat m2 nc1)) = (kronecker m1 m2)). Axiom shift_k_id : forall (m1:matrix complex) (m2:matrix complex) (nc1:Z) (nc2:Z) (nr1:Z) (nr2:Z), (0%Z <= nr1)%Z -> (0%Z <= nr2)%Z -> (0%Z <= nc1)%Z -> (0%Z <= nc2)%Z -> ((columns m1) = (power 2%Z nc1)) -> ((columns m2) = (power 2%Z nc2)) -> ((rows m1) = (power 2%Z nr1)) -> ((rows m2) = (power 2%Z nr2)) -> ((mat_mult (mat_k_id m1 nr2) (id_k_mat m2 nc1)) = (mat_mult (id_k_mat m2 nr1) (mat_k_id m1 nc2))). Axiom kronecker_mult_commut : forall (a:matrix complex) (b:matrix complex) (c:matrix complex) (d:matrix complex) (ra:Z) (ca:Z) (cc:Z) (rb:Z) (cb:Z) (cd:Z), (0%Z <= ra)%Z -> (0%Z <= ca)%Z -> (0%Z <= cc)%Z -> (0%Z <= rb)%Z -> (0%Z <= cb)%Z -> (0%Z <= cd)%Z -> ((rows a) = (power 2%Z ra)) -> ((columns a) = (power 2%Z ca)) -> ((rows c) = (power 2%Z ca)) -> ((columns c) = (power 2%Z cc)) -> ((rows b) = (power 2%Z rb)) -> ((columns b) = (power 2%Z cb)) -> ((rows d) = (power 2%Z cb)) -> ((columns d) = (power 2%Z cd)) -> ((mat_mult (kronecker a b) (kronecker c d)) = (kronecker (mat_mult a c) (mat_mult b d))). Parameter isa_square: (matrix complex) -> Prop. Axiom isa_square_def : forall (m:matrix complex), (isa_square m) -> ((rows m) = (columns m)). Axiom isa_square_def1 : forall (m:matrix complex), ((rows m) = (columns m)) -> isa_square m. Parameter pow2dim: (matrix complex) -> Prop. Axiom pow2dim_def : forall (m:matrix complex), (pow2dim m) -> exists i:Z, exists j:Z, ((rows m) = (power 2%Z i)) /\ ((columns m) = (power 2%Z j)). Axiom pow2dim_def1 : forall (m:matrix complex), (exists i:Z, exists j:Z, ((rows m) = (power 2%Z i)) /\ ((columns m) = (power 2%Z j))) -> pow2dim m. Parameter pow2dim_square: (matrix complex) -> Prop. Axiom pow2dim_square_def : forall (m:matrix complex), (pow2dim_square m) -> exists i:Z, ((rows m) = (power 2%Z i)) /\ ((columns m) = (power 2%Z i)). Axiom pow2dim_square_def1 : forall (m:matrix complex), (exists i:Z, ((rows m) = (power 2%Z i)) /\ ((columns m) = (power 2%Z i))) -> pow2dim_square m. Axiom pow_2dim_kets : forall (m:matrix complex), (is_a_ket m) -> pow2dim m. Parameter lnr: (matrix complex) -> Z. Axiom lnr_spec : forall (m:matrix complex), (pow2dim m) -> ((rows m) = (power 2%Z (lnr m))). Axiom lnr_spec1 : forall (m:matrix complex), (pow2dim m) -> ((lnr m) >= 0%Z)%Z. Parameter lnc: (matrix complex) -> Z. Axiom lnc_spec : forall (m:matrix complex), (pow2dim m) -> ((columns m) = (power 2%Z (lnc m))). Axiom lnc_spec1 : forall (m:matrix complex), (pow2dim m) -> ((lnc m) >= 0%Z)%Z. Axiom get_pow2dim : forall (m:matrix complex), (pow2dim m) -> exists i:Z, exists j:Z, ((rows m) = (power 2%Z i)) /\ ((columns m) = (power 2%Z j)). Axiom set_pow2dim : forall (m:matrix complex), (exists i:Z, exists j:Z, ((rows m) = (power 2%Z i)) /\ ((columns m) = (power 2%Z j))) -> pow2dim m. Axiom get_pow2dim_elt : forall (m:matrix complex) (i:Z) (j:Z), (pow2dim m) -> ((lnr m) = i) -> ((lnc m) = j) -> ((rows m) = (power 2%Z i)). Axiom get_pow2dim_elt1 : forall (m:matrix complex) (i:Z) (j:Z), (pow2dim m) -> ((lnr m) = i) -> ((lnc m) = j) -> ((columns m) = (power 2%Z j)). Axiom set_pow2dim_elt : forall (m:matrix complex) (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> ((rows m) = (power 2%Z i)) -> ((columns m) = (power 2%Z j)) -> pow2dim m. Axiom set_pow2dim_elt1 : forall (m:matrix complex) (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> ((rows m) = (power 2%Z i)) -> ((columns m) = (power 2%Z j)) -> ((lnr m) = i). Axiom set_pow2dim_elt2 : forall (m:matrix complex) (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> ((rows m) = (power 2%Z i)) -> ((columns m) = (power 2%Z j)) -> ((lnc m) = j). Parameter mat_size: (matrix complex) -> Z. Axiom mat_size_def : forall (m:matrix complex), (isa_square m) -> ((mat_size m) = (rows m)). Axiom mat_size_spec : forall (m:matrix complex), (isa_square m) -> ((mat_size m) = (rows m)). Axiom mat_size_spec1 : forall (m:matrix complex), (isa_square m) -> ((mat_size m) = (columns m)). Axiom get_square : forall (m:matrix complex), (isa_square m) -> ((rows m) = (columns m)). Axiom set_square : forall (m:matrix complex), ((rows m) = (columns m)) -> isa_square m. Axiom set_square_elt : forall (m:matrix complex) (i:Z), ((rows m) = i) -> ((columns m) = i) -> isa_square m. Axiom set_square_elt1 : forall (m:matrix complex) (i:Z), ((rows m) = i) -> ((columns m) = i) -> ((mat_size m) = i). Axiom get_square_elt : forall (m:matrix complex) (i:Z), (isa_square m) -> ((mat_size m) = i) -> ((rows m) = i). Axiom get_square_elt1 : forall (m:matrix complex) (i:Z), (isa_square m) -> ((mat_size m) = i) -> ((columns m) = i). Axiom pow2dim_square_dec : forall (m:matrix complex), (isa_square m) -> (pow2dim m) -> pow2dim_square m. Axiom dec_pow2dim_square : forall (m:matrix complex), (pow2dim_square m) -> isa_square m. Axiom dec_pow2dim_square1 : forall (m:matrix complex), (pow2dim_square m) -> pow2dim m. Parameter ln_size: (matrix complex) -> Z. Axiom ln_size_def : forall (m:matrix complex), (pow2dim_square m) -> ((ln_size m) = (lnr m)). Axiom ln_size_spec : forall (m:matrix complex), (pow2dim_square m) -> ((ln_size m) = (lnc m)). Axiom ln_size_spec1 : forall (m:matrix complex), (pow2dim_square m) -> ((rows m) = (power 2%Z (ln_size m))). Axiom ln_size_spec2 : forall (m:matrix complex), (pow2dim_square m) -> ((columns m) = (power 2%Z (ln_size m))). Axiom set_ln_size_lnc : forall (m:matrix complex) (i:Z), (pow2dim_square m) -> ((lnc m) = i) -> ((ln_size m) = i). Axiom set_ln_size_lnr : forall (m:matrix complex) (i:Z), (pow2dim_square m) -> ((lnr m) = i) -> ((ln_size m) = i). Axiom set_ln_size_columns : forall (m:matrix complex) (i:Z), (0%Z <= i)%Z -> (pow2dim_square m) -> ((columns m) = (power 2%Z i)) -> ((ln_size m) = i). Axiom set_ln_size_rows : forall (m:matrix complex) (i:Z), (0%Z <= i)%Z -> (pow2dim_square m) -> ((rows m) = (power 2%Z i)) -> ((ln_size m) = i). Axiom set_pow2dim_square : forall (m:matrix complex), (exists i:Z, ((rows m) = (columns m)) /\ ((columns m) = (power 2%Z i))) -> pow2dim_square m. Axiom set_pow2dim_square_elt : forall (m:matrix complex) (i:Z), (0%Z <= i)%Z -> (((rows m) = (columns m)) /\ ((columns m) = (power 2%Z i))) -> pow2dim_square m. Axiom set_pow2dim_square_elt1 : forall (m:matrix complex) (i:Z), (0%Z <= i)%Z -> (((rows m) = (columns m)) /\ ((columns m) = (power 2%Z i))) -> ((ln_size m) = i). Axiom get_pow2dim_square_elt : forall (m:matrix complex) (i:Z), (pow2dim_square m) -> ((ln_size m) = i) -> ((rows m) = (power 2%Z i)). Axiom get_pow2dim_square_elt1 : forall (m:matrix complex) (i:Z), (pow2dim_square m) -> ((ln_size m) = i) -> ((columns m) = (power 2%Z i)). Axiom kronecker_mult_commut_p : forall (a:matrix complex) (b:matrix complex) (c:matrix complex) (d:matrix complex), ((columns a) = (rows c)) -> ((columns b) = (rows d)) -> (pow2dim a) -> (pow2dim b) -> (pow2dim c) -> (pow2dim d) -> ((mat_mult (kronecker a b) (kronecker c d)) = (kronecker (mat_mult a c) (mat_mult b d))). Axiom kronecker_mult_commut_p_quant : forall (a:matrix complex) (b:matrix complex), (pow2dim a) -> (pow2dim b) -> forall (c:matrix complex) (d:matrix complex), ((columns a) = (rows c)) -> ((columns b) = (rows d)) -> (pow2dim c) -> (pow2dim d) -> ((mat_mult (kronecker a b) (kronecker c d)) = (kronecker (mat_mult a c) (mat_mult b d))). Axiom kronecker_add_distr_l : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((rows (kronecker (add_mat m n) o)) = ((rows m) * (rows o))%Z). Axiom kronecker_add_distr_l1 : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((columns (kronecker (add_mat m n) o)) = ((columns m) * (columns o))%Z). Axiom kronecker_add_distr_l2 : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((kronecker (add_mat m n) o) = (add_mat (kronecker m o) (kronecker n o))). Axiom kronecker_add_distr_r : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((kronecker o (add_mat m n)) = (add_mat (kronecker o m) (kronecker o n))). Axiom kronecker_add_distr_r1 : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((rows (kronecker o (add_mat m n))) = ((rows m) * (rows o))%Z). Axiom kronecker_add_distr_r2 : forall (m:matrix complex) (n:matrix complex) (o:matrix complex), ((rows m) = (rows n)) -> ((columns m) = (columns n)) -> ((columns (kronecker o (add_mat m n))) = ((columns m) * (columns o))%Z). Axiom kronecker_ket_add_distr_r : forall (m:matrix complex) (n:matrix complex) (x:matrix complex) (l:Z) (l1:Z) (l2:Z), (l = (l1 + l2)%Z) -> (is_a_ket_l m l1) -> (is_a_ket_l n l1) -> (is_a_ket_l x l2) -> ((add_ket_l (kronecker m x) (kronecker n x) l) = (kronecker (add_ket_l m n l1) x)). Axiom kronecker_sum_distr_l : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((columns (mat_sum s (fun (k:a) => (kronecker (f k) m)))) = (columns ((fun (k:a) => (kronecker (f k) m)) (choose s)))). Axiom kronecker_sum_distr_l1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((columns ((fun (k:a) => (kronecker (f k) m)) (choose s))) = ((columns m) * (columns (f (choose s))))%Z). Axiom kronecker_sum_distr_l2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((rows (mat_sum s (fun (k:a) => (kronecker (f k) m)))) = (rows ((fun (k:a) => (kronecker (f k) m)) (choose s)))). Axiom kronecker_sum_distr_l3 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((rows ((fun (k:a) => (kronecker (f k) m)) (choose s))) = ((rows m) * (rows (f (choose s))))%Z). Axiom kronecker_sum_distr_l4 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((kronecker (mat_sum s f) m) = (mat_sum s (fun (k:a) => (kronecker (f k) m)))). Axiom kronecker_sum_distr_r : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((columns (mat_sum s (fun (k:a) => (kronecker m (f k))))) = (columns ((fun (k:a) => (kronecker m (f k))) (choose s)))). Axiom kronecker_sum_distr_r1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((columns ((fun (k:a) => (kronecker m (f k))) (choose s))) = ((columns m) * (columns (f (choose s))))%Z). Axiom kronecker_sum_distr_r2 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((rows (mat_sum s (fun (k:a) => (kronecker m (f k))))) = (rows ((fun (k:a) => (kronecker m (f k))) (choose s)))). Axiom kronecker_sum_distr_r3 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((rows ((fun (k:a) => (kronecker m (f k))) (choose s))) = ((rows m) * (rows (f (choose s))))%Z). Axiom kronecker_sum_distr_r4 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((kronecker m (mat_sum s f)) = (mat_sum s (fun (k:a) => (kronecker m (f k))))). Axiom mat_sum_scalar1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (a1:complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((mat_sum s (fun (k:a) => (infix_asdtdt a1 (f k)))) = (infix_asdtdt a1 (mat_sum s f))). Axiom kronecker_sum_distr_sc : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (a1:complex), (constant_size s f) -> ((cardinal s) > 0%Z)%Z -> ((mat_sum s (fun (k:a) => (kronecker (infix_asdtdt a1 (f k)) m))) = (infix_asdtdt a1 (mat_sum s (fun (k:a) => (kronecker (f k) m))))). Axiom kronecker_ket_sum_distr_l : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> ((cardinal s) > 0%Z)%Z -> is_a_ket_l (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + l2)%Z) (l1 + l2)%Z. Axiom kronecker_ket_sum_distr_l1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> ((cardinal s) > 0%Z)%Z -> ((kronecker (ket_sum_l s f l1) m) = (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + l2)%Z)). Axiom kronecker_ket_sum_distr_l_nol : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket m) -> ((cardinal s) > 0%Z)%Z -> is_a_ket_l (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + (ket_length m))%Z) (l1 + (ket_length m))%Z. Axiom kronecker_ket_sum_distr_l_nol1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket m) -> ((cardinal s) > 0%Z)%Z -> ((kronecker (ket_sum_l s f l1) m) = (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + (ket_length m))%Z)). Axiom kronecker_ket_sum_distr_l_rew : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket m) -> ((cardinal s) > 0%Z)%Z -> ((kronecker (ket_sum_l s f l1) m) = (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + (ket_length m))%Z)). Axiom kronecker_ket_sum_distr_r : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> ((cardinal s) > 0%Z)%Z -> is_a_ket_l (ket_sum_l s (fun (k:a) => (kronecker m (f k))) (l1 + l2)%Z) (l1 + l2)%Z. Axiom kronecker_ket_sum_distr_r1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> ((cardinal s) > 0%Z)%Z -> ((kronecker m (ket_sum_l s f l1)) = (ket_sum_l s (fun (k:a) => (kronecker m (f k))) (l1 + l2)%Z)). Axiom kronecker_ket_sum_distr_l_rev : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> ((cardinal s) > 0%Z)%Z -> is_a_ket_l (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + l2)%Z) (l1 + l2)%Z. Axiom kronecker_ket_sum_distr_l_rev1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> ((cardinal s) > 0%Z)%Z -> ((ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + l2)%Z) = (kronecker (ket_sum_l s f l1) m)). Axiom kronecker_ket_sum_distr_r_rev : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> ((cardinal s) > 0%Z)%Z -> is_a_ket_l (ket_sum_l s (fun (k:a) => (kronecker m (f k))) (l1 + l2)%Z) (l1 + l2)%Z. Axiom kronecker_ket_sum_distr_r_rev1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> ((cardinal s) > 0%Z)%Z -> ((ket_sum_l s (fun (k:a) => (kronecker m (f k))) (l1 + l2)%Z) = (kronecker m (ket_sum_l s f l1))). Axiom kronecker_ket_sum_distr_l_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> (0%Z <= l1)%Z -> is_a_ket_l (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + l2)%Z) (l1 + l2)%Z. Axiom kronecker_ket_sum_distr_l_1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> (0%Z <= l1)%Z -> ((kronecker (ket_sum_l s f l1) m) = (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + l2)%Z)). Axiom kronecker_ket_sum_distr_l_nol_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket m) -> (0%Z <= l1)%Z -> is_a_ket_l (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + (ket_length m))%Z) (l1 + (ket_length m))%Z. Axiom kronecker_ket_sum_distr_l_nol_1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket m) -> (0%Z <= l1)%Z -> ((kronecker (ket_sum_l s f l1) m) = (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + (ket_length m))%Z)). Axiom kronecker_ket_sum_distr_l_rew_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket m) -> (0%Z <= l1)%Z -> ((kronecker (ket_sum_l s f l1) m) = (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + (ket_length m))%Z)). Axiom kronecker_ket_sum_distr_r_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> (0%Z <= l1)%Z -> is_a_ket_l (ket_sum_l s (fun (k:a) => (kronecker m (f k))) (l1 + l2)%Z) (l1 + l2)%Z. Axiom kronecker_ket_sum_distr_r_1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> (0%Z <= l1)%Z -> ((kronecker m (ket_sum_l s f l1)) = (ket_sum_l s (fun (k:a) => (kronecker m (f k))) (l1 + l2)%Z)). Axiom kronecker_ket_sum_distr_l_rev_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> (0%Z <= l1)%Z -> is_a_ket_l (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + l2)%Z) (l1 + l2)%Z. Axiom kronecker_ket_sum_distr_l_rev_1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> (0%Z <= l1)%Z -> ((ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + l2)%Z) = (kronecker (ket_sum_l s f l1) m)). Axiom kronecker_ket_sum_distr_r_rev_ : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> (0%Z <= l1)%Z -> is_a_ket_l (ket_sum_l s (fun (k:a) => (kronecker m (f k))) (l1 + l2)%Z) (l1 + l2)%Z. Axiom kronecker_ket_sum_distr_r_rev_1 : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> (0%Z <= l1)%Z -> ((ket_sum_l s (fun (k:a) => (kronecker m (f k))) (l1 + l2)%Z) = (kronecker m (ket_sum_l s f l1))). Axiom kronecker_ket_sum_distr_r_rew : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (l1:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket m) -> ((cardinal s) > 0%Z)%Z -> ((kronecker m (ket_sum_l s f l1)) = (ket_sum_l s (fun (k:a) => (kronecker m (f k))) (l1 + (ket_length m))%Z)). Axiom ket_sum_scalar : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (a1:complex) (l:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l) -> ((cardinal s) > 0%Z)%Z -> ((ket_sum_l s (fun (k:a) => (infix_asdtdt a1 (f k))) l) = (infix_asdtdt a1 (ket_sum_l s f l))). Axiom kronecker_ket_sum_distr_sc : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> matrix complex) (m:matrix complex) (a1:complex) (l1:Z) (l2:Z), (forall (e1:a), (mem e1 s) -> is_a_ket_l (f e1) l1) -> (is_a_ket_l m l2) -> ((cardinal s) > 0%Z)%Z -> ((ket_sum_l s (fun (k:a) => (kronecker (infix_asdtdt a1 (f k)) m)) (l1 + l2)%Z) = (infix_asdtdt a1 (ket_sum_l s (fun (k:a) => (kronecker (f k) m)) (l1 + l2)%Z))). Axiom kronecker_decomp_r : forall (m:matrix complex) (n:matrix complex) (lm:Z) (ln:Z), (is_a_ket_l m lm) -> (is_a_ket_l n ln) -> ((kronecker m n) = (ket_sum_l (n_bvs ln) (fun (x:bitvec) => (infix_asdtdt (get_ket n (bv_to_int x)) (kronecker m (bv_to_ket x)))) (lm + ln)%Z)). Axiom kronecker_decomp_l : forall (m:matrix complex) (n:matrix complex) (lm:Z) (ln:Z), (is_a_ket_l m lm) -> (is_a_ket_l n ln) -> ((kronecker m n) = (ket_sum_l (n_bvs lm) (fun (x:bitvec) => (infix_asdtdt (get_ket m (bv_to_int x)) (kronecker (bv_to_ket x) n))) (lm + ln)%Z)). Axiom kronecker_ket_sum_distr_double : forall (i:Z) (j:Z) (f:bitvec -> matrix complex) (g:bitvec -> matrix complex) (l1:Z) (l2:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> (forall (bv:bitvec), (mem bv (n_bvs i)) -> is_a_ket_l (f bv) l1) -> (forall (bv:bitvec), (mem bv (n_bvs j)) -> is_a_ket_l (g bv) l2) -> ((kronecker (ket_sum_l (n_bvs i) f l1) (ket_sum_l (n_bvs j) g l2)) = (ket_sum_l (n_bvs (i + j)%Z) (fun (k:bitvec) => (kronecker (f (hpart k i)) (g (tpart k i)))) (l1 + l2)%Z)). Axiom kronecker_add_null : forall (m:matrix complex) (m1:matrix complex) (m2:matrix complex) (x:matrix complex) (x':matrix complex) (l1:Z) (l2:Z), (is_a_ket_l m l1) -> (is_a_ket_l m1 l1) -> (is_a_ket_l m2 l1) -> (is_a_ket_l x l2) -> (is_a_ket_l x' l2) -> (is_a_ket_basis_elt x) -> (is_a_ket_basis_elt x') -> ~ ((ket_to_int x) = (ket_to_int x')) -> ((kronecker m x) = (add_ket_l (kronecker m1 x) (kronecker m2 x') (l1 + l2)%Z)) -> null_mat (kronecker m2 x'). Axiom kronecker_add_null1 : forall (m:matrix complex) (m1:matrix complex) (m2:matrix complex) (x:matrix complex) (x':matrix complex) (l1:Z) (l2:Z), (is_a_ket_l m l1) -> (is_a_ket_l m1 l1) -> (is_a_ket_l m2 l1) -> (is_a_ket_l x l2) -> (is_a_ket_l x' l2) -> (is_a_ket_basis_elt x) -> (is_a_ket_basis_elt x') -> ~ ((ket_to_int x) = (ket_to_int x')) -> ((kronecker m x) = (add_ket_l (kronecker m1 x) (kronecker m2 x') (l1 + l2)%Z)) -> null_mat m2. Axiom kronecker_add_null2 : forall (m:matrix complex) (m1:matrix complex) (m2:matrix complex) (x:matrix complex) (x':matrix complex) (l1:Z) (l2:Z), (is_a_ket_l m l1) -> (is_a_ket_l m1 l1) -> (is_a_ket_l m2 l1) -> (is_a_ket_l x l2) -> (is_a_ket_l x' l2) -> (is_a_ket_basis_elt x) -> (is_a_ket_basis_elt x') -> ~ ((ket_to_int x) = (ket_to_int x')) -> ((kronecker m x) = (add_ket_l (kronecker m1 x) (kronecker m2 x') (l1 + l2)%Z)) -> forall (x'1:matrix complex), null_mat (kronecker m2 x'1). Axiom kronecker_injec_eq_left : forall (m:matrix complex) (m':matrix complex) (o:matrix complex), ((kronecker m o) = (kronecker m' o)) -> ~ (null_mat o) -> (m = m'). Parameter pps_apply_equiv: pps -> pps -> Prop. Axiom pps_apply_equiv_def : forall (h1:pps) (h2:pps), (pps_apply_equiv h1 h2) -> ((h_width h1) = (h_width h2)). Axiom pps_apply_equiv_def1 : forall (h1:pps) (h2:pps), (pps_apply_equiv h1 h2) -> forall (x:matrix complex), (is_a_ket_l x (h_width h1)) -> ((pps_apply h1 x) = (pps_apply h2 x)). Axiom pps_apply_equiv_def2 : forall (h1:pps) (h2:pps), (((h_width h1) = (h_width h2)) /\ forall (x:matrix complex), (is_a_ket_l x (h_width h1)) -> ((pps_apply h1 x) = (pps_apply h2 x))) -> pps_apply_equiv h1 h2. Axiom set_pps_apply_equiv : forall (h1:pps) (h2:pps), ((h_width h1) = (h_width h2)) -> (forall (x:bitvec), ((length x) = (h_width h1)) -> ((pps_apply_basis h1 x) = (pps_apply_basis h2 x))) -> pps_apply_equiv h1 h2. Axiom set_pps_apply_equiv_sim : forall (h1:pps) (h2:pps), ((h_width h1) = (h_width h2)) -> ((h_range h1) = (h_range h2)) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h1))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h1))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h1))%Z) -> (((((h_basis_ket h1) x) y) i) = ((((h_basis_ket h2) x) y) i))) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h1))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h1))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h1) x) y) = (((h_angle h2) x) y))) -> pps_apply_equiv h1 h2. Axiom get_pps_apply_equiv : forall (h1:pps) (h2:pps) (x:matrix complex), ((h_width h1) = (h_width h2)) -> (pps_apply_equiv h1 h2) -> (is_a_ket_l x (h_width h1)) -> ((pps_apply h1 x) = (pps_apply h2 x)). Axiom get_pps_apply_basis_equiv : forall (h1:pps) (h2:pps) (x:bitvec), ((h_width h1) = (h_width h2)) -> (pps_apply_equiv h1 h2) -> ((length x) = (h_width h1)) -> ((pps_apply_basis h1 x) = (pps_apply_basis h2 x)). Axiom reflexive_pps_apply_equiv : forall (h:pps), pps_apply_equiv h h. Axiom commut_pps_apply_equiv : forall (h:pps) (h':pps), (pps_apply_equiv h h') -> pps_apply_equiv h' h. Axiom transitive_pps_apply_equiv : forall (h:pps) (h':pps) (h'':pps), (pps_apply_equiv h h') -> (pps_apply_equiv h' h'') -> pps_apply_equiv h h''. Axiom pps_apply_basis_seq : forall (h1:pps) (h2:pps) (x:bitvec), ((length x) = (h_width h1)) -> ((h_width h1) = (h_width h2)) -> ((pps_apply_basis (pps_seq h1 h2) x) = (pps_apply h2 (pps_apply_basis h1 x))). Axiom pps_apply_seq : forall (h1:pps) (h2:pps) (x:matrix complex), ((h_width h1) = (h_width h2)) -> (is_a_ket_l x (h_width h1)) -> ((pps_apply (pps_seq h1 h2) x) = (pps_apply h2 (pps_apply h1 x))). Axiom pps_seq_pred : forall (h1:pps) (h2:pps) (h3:pps), (((h_width h1) = (h_width h2)) /\ ((h_width h2) = (h_width h3))) -> ((h_range h3) = ((h_range h1) + (h_range h2))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h3))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h3))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h3))%Z) -> (((((h_basis_ket h3) x) y) i) = ((((h_basis_ket h2) (((h_basis_ket h1) x) y)) fun (k:Z) => (y (k + (h_range h1))%Z)) i))) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h3))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h3))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h3) x) y) = (ang_add (((h_angle h1) x) y) (((h_angle h2) (((h_basis_ket h1) x) y)) fun (k:Z) => (y (k + (h_range h1))%Z))))) -> forall (x:matrix complex), (is_a_ket_l x (h_width h3)) -> ((pps_apply h3 x) = (pps_apply h2 (pps_apply h1 x))). Axiom pps_apply_basis_par : forall (h1:pps) (h2:pps) (x:bitvec), ((length x) = ((h_width h1) + (h_width h2))%Z) -> ((pps_apply_basis (pps_par h1 h2) x) = (kronecker (pps_apply_basis h1 (hpart x (h_width h1))) (pps_apply_basis h2 (tpart x (h_width h1))))). Axiom pps_apply_par : forall (h1:pps) (h2:pps) (x:matrix complex) (y:matrix complex), (is_a_ket_l x (h_width h1)) -> (is_a_ket_l y (h_width h2)) -> ((pps_apply (pps_par h1 h2) (kronecker x y)) = (kronecker (pps_apply h1 x) (pps_apply h2 y))). Axiom pps_par_pred : forall (h1:pps) (h2:pps) (h3:pps), ((h_width h3) = ((h_width h1) + (h_width h2))%Z) -> ((h_range h3) = ((h_range h1) + (h_range h2))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h3))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h3))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h3))%Z) -> ((i < (h_width h1))%Z /\ (((((h_basis_ket h3) x) y) i) = ((((h_basis_ket h1) x) y) i))) \/ (~ (i < (h_width h1))%Z /\ (((((h_basis_ket h3) x) y) i) = ((((h_basis_ket h2) fun (k:Z) => (x (k + (h_width h1))%Z)) fun (k:Z) => (y (k + (h_range h1))%Z)) (i - (h_width h1))%Z)))) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h3))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h3))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h3) x) y) = (ang_add (((h_angle h1) x) y) (((h_angle h2) fun (k:Z) => (x (k + (h_width h1))%Z)) fun (k:Z) => (y (k + (h_range h1))%Z))))) -> forall (x:matrix complex) (y:matrix complex), (is_a_ket_l x (h_width h1)) -> (is_a_ket_l y (h_width h2)) -> ((pps_apply h3 (kronecker x y)) = (kronecker (pps_apply h1 x) (pps_apply h2 y))). Axiom pps_apply_basis_anc : forall (h:pps) (x:bitvec) (y:matrix complex), (1%Z <= (h_width h))%Z -> ((length x) = (h_width h)) -> (((getbv x) ((h_width h) - 1%Z)%Z) = 0%Z) -> ((pps_apply_basis h x) = (kronecker y (ket 1%Z 0%Z))) -> (is_a_ket_l y ((h_width h) - 1%Z)%Z) -> ((pps_apply_basis (pps_anc h) (hpart x ((h_width h) - 1%Z)%Z)) = y). Axiom pps_apply_basis_anc_ : forall (h:pps) (x:bitvec) (y:matrix complex), (1%Z <= (h_width h))%Z -> ((length x) = ((h_width h) - 1%Z)%Z) -> ((pps_apply_basis h (concat x (make_bv (fun (us:Z) => 0%Z) 1%Z))) = (kronecker y (ket 1%Z 0%Z))) -> (is_a_ket_l y ((h_width h) - 1%Z)%Z) -> ((pps_apply_basis (pps_anc h) x) = y). Axiom pps_apply_anc : forall (h:pps) (path_sem_target:(matrix complex) -> matrix complex) (x:matrix complex), (1%Z <= (h_width h))%Z -> (is_a_ket_l x ((h_width h) - 1%Z)%Z) -> (forall (x1:matrix complex), (is_a_ket_l x1 ((h_width h) - 1%Z)%Z) -> ((pps_apply h (kronecker x1 (ket 1%Z 0%Z))) = (kronecker (path_sem_target x1) (ket 1%Z 0%Z)))) -> (is_a_ket_l x ((h_width h) - 1%Z)%Z) -> ((pps_apply (pps_anc h) x) = (path_sem_target x)). Parameter pps_anc_gen: pps -> Z -> pps. Axiom pps_anc_gen_def : forall (h:pps) (k:Z), (1%Z <= (h_width h))%Z -> (k = 1%Z) -> ((pps_anc_gen h k) = (pps_anc h)). Axiom pps_anc_gen_def1 : forall (h:pps) (k:Z), (1%Z <= (h_width h))%Z -> ~ (k = 1%Z) -> ((pps_anc_gen h k) = (pps_anc (pps_anc_gen h (k - 1%Z)%Z))). Axiom pps_apply_equiv_seq : forall (h1:pps) (h1':pps) (h2:pps) (h2':pps), (pps_apply_equiv h1 h1') -> (pps_apply_equiv h2 h2') -> ((h_width h1) = (h_width h2)) -> pps_apply_equiv (pps_seq h1 h2) (pps_seq h1' h2'). Axiom pps_apply_equiv_par : forall (h1:pps) (h1':pps) (h2:pps) (h2':pps), (pps_apply_equiv h1 h1') -> (pps_apply_equiv h2 h2') -> pps_apply_equiv (pps_par h1 h2) (pps_par h1' h2'). Axiom pps_apply_equiv_anc : forall (h:pps) (h':pps), (1%Z <= (h_width h))%Z -> (pps_apply_equiv h h') -> (exists path_sem_target:bitvec -> matrix complex, forall (y:bitvec), ((length y) = ((h_width h) - 1%Z)%Z) -> ((pps_apply_basis h (concat y (make_bv (fun (us:Z) => 0%Z) 1%Z))) = (kronecker (path_sem_target y) (ket 1%Z 0%Z)))) -> pps_apply_equiv (pps_anc h) (pps_anc h'). Parameter fc15: pps -> (Z -> Z) -> Z -> Z. Parameter fc16: pps -> (Z -> Z) -> Z -> Z. Axiom fc_def15 : forall (h1:pps) (x:Z -> Z) (k:Z), ((k = ((h_width h1) - 1%Z)%Z) -> (((fc15 h1 x) k) = 0%Z)) /\ (~ (k = ((h_width h1) - 1%Z)%Z) -> (((fc15 h1 x) k) = (x k))). Axiom fc_def16 : forall (h1:pps) (x:Z -> Z) (k:Z), ((k = ((h_width h1) - 1%Z)%Z) -> (((fc16 h1 x) k) = 0%Z)) /\ (~ (k = ((h_width h1) - 1%Z)%Z) -> (((fc16 h1 x) k) = (x k))). Axiom pps_anc_pred : forall (h1:pps) (h2:pps) (path_sem_target:bitvec -> matrix complex), (1%Z <= (h_width h1))%Z -> (forall (y:bitvec), ((length y) = ((h_width h1) - 1%Z)%Z) -> ((pps_apply_basis h1 (concat y (make_bv (fun (us:Z) => 0%Z) 1%Z))) = (kronecker (path_sem_target y) (ket 1%Z 0%Z)))) -> ((h_width h2) = ((h_width h1) - 1%Z)%Z) -> ((h_range h2) = (h_range h1)) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h2))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h2))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h2))%Z) -> (((((h_basis_ket h2) x) y) i) = ((((h_basis_ket h1) (fc15 h1 x)) y) i))) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h2))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h2))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h2) x) y) = (((h_angle h1) (fc16 h1 x)) y))) -> forall (x:bitvec), ((length x) = (h_width h2)) -> ((pps_apply_basis h2 x) = (path_sem_target x)). Parameter fc17: pps -> (Z -> Z) -> Z -> Z. Parameter fc18: pps -> (Z -> Z) -> Z -> Z. Axiom fc_def17 : forall (h1:pps) (x:Z -> Z) (k:Z), ((k = ((h_width h1) - 1%Z)%Z) -> (((fc17 h1 x) k) = 0%Z)) /\ (~ (k = ((h_width h1) - 1%Z)%Z) -> (((fc17 h1 x) k) = (x k))). Axiom fc_def18 : forall (h1:pps) (x:Z -> Z) (k:Z), ((k = ((h_width h1) - 1%Z)%Z) -> (((fc18 h1 x) k) = 0%Z)) /\ (~ (k = ((h_width h1) - 1%Z)%Z) -> (((fc18 h1 x) k) = (x k))). Axiom pps_anc_pred_ : forall (h1:pps) (h2:pps), (1%Z <= (h_width h1))%Z -> (exists path_sem_target:bitvec -> matrix complex, forall (y:bitvec), ((length y) = ((h_width h1) - 1%Z)%Z) -> ((pps_apply_basis h1 (concat y (make_bv (fun (us:Z) => 0%Z) 1%Z))) = (kronecker (path_sem_target y) (ket 1%Z 0%Z)))) -> ((h_width h2) = ((h_width h1) - 1%Z)%Z) -> ((h_range h2) = (h_range h1)) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h2))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h2))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h2))%Z) -> (((((h_basis_ket h2) x) y) i) = ((((h_basis_ket h1) (fc17 h1 x)) y) i))) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h2))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h2))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h2) x) y) = (((h_angle h1) (fc18 h1 x)) y))) -> forall (x:bitvec), ((length x) = (h_width h2)) -> ((pps_apply_basis h1 (concat x (make_bv (fun (us:Z) => 0%Z) 1%Z))) = (kronecker (pps_apply_basis h2 x) (ket 1%Z 0%Z))). Parameter pps_to_mat: pps -> matrix complex. Parameter result20: pps -> bitvec -> bitvec -> Z -> Z -> complex. Parameter result21: pps -> bitvec -> bitvec -> matrix complex. Axiom result_def20 : forall (h:pps) (x:bitvec) (y:bitvec) (i:Z) (j:Z), (((i = (bv_to_int (h_basis_ket_bv h x y))) /\ (j = (bv_to_int x))) -> ((((result20 h x y) i) j) = (ang_exp (h_angle_bv h x y)))) /\ (~ ((i = (bv_to_int (h_basis_ket_bv h x y))) /\ (j = (bv_to_int x))) -> ((((result20 h x y) i) j) = c_zero)). Axiom result_def21 : forall (h:pps) (x:bitvec) (y:bitvec), ((((length x) = (h_width h)) /\ ((length y) = (h_range h))) -> (((result21 h x) y) = (make_f (power_ 2%Z (h_width h)) (power_ 2%Z (h_width h)) (result20 h x y)))) /\ (~ (((length x) = (h_width h)) /\ ((length y) = (h_range h))) -> (((result21 h x) y) = (make_f (power_ 2%Z (h_width h)) (power_ 2%Z (h_width h)) (fun (i:Z) (j:Z) => c_zero)))). Axiom pps_to_mat_def : forall (h:pps), ((pps_to_mat h) = (infix_asdtdt (pow_inv_sqrt_2 (h_range h)) (mat_sum_dim (n_bvs (h_width h)) (fun (x:bitvec) => (mat_sum_dim (n_bvs (h_range h)) (result21 h x) (power_ 2%Z (h_width h)) (power_ 2%Z (h_width h)))) (power_ 2%Z (h_width h)) (power_ 2%Z (h_width h))))). Parameter fc19: pps -> bitvec -> bitvec -> Z -> Z -> complex. Axiom fc_def19 : forall (h:pps) (x:bitvec) (y:bitvec) (i:Z) (j:Z), (((i = (bv_to_int (h_basis_ket_bv h x y))) /\ (j = (bv_to_int x))) -> ((((fc19 h x y) i) j) = (ang_exp (h_angle_bv h x y)))) /\ (~ ((i = (bv_to_int (h_basis_ket_bv h x y))) /\ (j = (bv_to_int x))) -> ((((fc19 h x y) i) j) = c_zero)). Axiom pps_to_mat_spec : forall (h:pps), ((pps_to_mat h) = (infix_asdtdt (pow_inv_sqrt_2 (h_range h)) (mat_sum_dim (n_bvs (h_width h)) (fun (x:bitvec) => (mat_sum_dim (n_bvs (h_range h)) (fun (y:bitvec) => (make_f (power_ 2%Z (h_width h)) (power_ 2%Z (h_width h)) (fc19 h x y))) (power_ 2%Z (h_width h)) (power_ 2%Z (h_width h)))) (power_ 2%Z (h_width h)) (power_ 2%Z (h_width h))))). Parameter fc20: pps -> bitvec -> bitvec -> Z -> Z -> complex. Axiom fc_def20 : forall (h:pps) (x:bitvec) (y:bitvec) (i:Z) (j:Z), (((i = (bv_to_int (h_basis_ket_bv h x y))) /\ (j = (bv_to_int x))) -> ((((fc20 h x y) i) j) = (ang_exp (h_angle_bv h x y)))) /\ (~ ((i = (bv_to_int (h_basis_ket_bv h x y))) /\ (j = (bv_to_int x))) -> ((((fc20 h x y) i) j) = c_zero)). Axiom pps_to_mat_spec1 : forall (h:pps), ((pps_to_mat h) = (infix_asdtdt (pow_inv_sqrt_2 (h_range h)) (mat_sum (n_bvs (h_width h)) (fun (x:bitvec) => (mat_sum (n_bvs (h_range h)) (fun (y:bitvec) => (make_f (power_ 2%Z (h_width h)) (power_ 2%Z (h_width h)) (fc20 h x y)))))))). Axiom pps_to_mat_spec2 : forall (h:pps), ((rows (pps_to_mat h)) = (power_ 2%Z (h_width h))). Axiom pps_to_mat_spec3 : forall (h:pps), ((columns (pps_to_mat h)) = (power_ 2%Z (h_width h))). Axiom pps_to_mat_spec4 : forall (h:pps), forall (x:bitvec), ((length x) = (h_width h)) -> ((mat_mult (pps_to_mat h) (bv_to_ket x)) = (pps_apply_basis h x)). Axiom pps_to_mat_spec5 : forall (h:pps), forall (x:matrix complex), (is_a_ket_l x (h_width h)) -> ((mat_mult (pps_to_mat h) x) = (pps_apply h x)). Parameter min_set: (set Z) -> Z. Axiom min_set_def : forall (s:set Z), ((cardinal s) > 0%Z)%Z -> ((cardinal s) = 1%Z) -> ((min_set s) = (choose s)). Axiom min_set_def1 : forall (s:set Z), ((cardinal s) > 0%Z)%Z -> ~ ((cardinal s) = 1%Z) -> ((min_set s) = (ZArith.BinInt.Z.min (choose s) (min_set (remove (choose s) s)))). Axiom min_set_spec : forall (s:set Z), ((cardinal s) > 0%Z)%Z -> mem (min_set s) s. Axiom min_set_spec1 : forall (s:set Z), ((cardinal s) > 0%Z)%Z -> forall (e1:Z), (mem e1 s) -> (e1 >= (min_set s))%Z. Parameter max_set: (set Z) -> Z. Axiom max_set_def : forall (s:set Z), ((cardinal s) > 0%Z)%Z -> ((cardinal s) = 1%Z) -> ((max_set s) = (choose s)). Axiom max_set_def1 : forall (s:set Z), ((cardinal s) > 0%Z)%Z -> ~ ((cardinal s) = 1%Z) -> ((max_set s) = (ZArith.BinInt.Z.max (choose s) (max_set (remove (choose s) s)))). Axiom max_set_spec : forall (s:set Z), ((cardinal s) > 0%Z)%Z -> mem (max_set s) s. Axiom max_set_spec1 : forall (s:set Z), ((cardinal s) > 0%Z)%Z -> forall (e1:Z), (mem e1 s) -> (e1 <= (max_set s))%Z. Parameter max3: Z -> Z -> Z -> Z. Axiom max3_def : forall (a:Z) (b:Z) (c:Z), ((max3 a b c) = (ZArith.BinInt.Z.max (ZArith.BinInt.Z.max a b) c)). Axiom max3_spec : forall (a:Z) (b:Z) (c:Z), ((max3 a b c) = (ZArith.BinInt.Z.max a (ZArith.BinInt.Z.max b c))). Parameter min_filter: (set Z) -> (Z -> bool) -> Z. Axiom min_filter_def : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> ((p (min_set s)) = true) -> ((min_filter s p) = (min_set s)). Axiom min_filter_def1 : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> ~ ((p (min_set s)) = true) -> ((min_filter s p) = (min_filter (remove (min_set s) s) p)). Axiom min_filter_spec : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> ((p (min_filter s p)) = true). Axiom min_filter_spec1 : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> mem (min_filter s p) s. Axiom min_filter_spec2 : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> forall (e1:Z), (mem e1 s) -> ((p e1) = true) -> ((min_filter s p) <= e1)%Z. Axiom min_filter_spec3 : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> forall (e1:Z), (mem e1 s) -> (e1 < (min_filter s p))%Z -> ~ ((p e1) = true). Parameter max_filter: (set Z) -> (Z -> bool) -> Z. Axiom max_filter_def : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> ((p (max_set s)) = true) -> ((max_filter s p) = (max_set s)). Axiom max_filter_def1 : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> ~ ((p (max_set s)) = true) -> ((max_filter s p) = (max_filter (remove (max_set s) s) p)). Axiom max_filter_spec : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> ((p (max_filter s p)) = true). Axiom max_filter_spec1 : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> mem (max_filter s p) s. Axiom max_filter_spec2 : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> forall (e1:Z), (mem e1 s) -> ((p e1) = true) -> (e1 <= (max_filter s p))%Z. Axiom max_filter_spec3 : forall (s:set Z) (p:Z -> bool), (exists e1:Z, (mem e1 s) /\ ((p e1) = true)) -> forall (e1:Z), (mem e1 s) -> ((max_filter s p) < e1)%Z -> ~ ((p e1) = true). Axiom appr_pre : forall (theta:complex) (n:Z), (0%Z < n)%Z -> (real_ theta) -> ((infix_lsdt c_zero theta) /\ (infix_lseqdt theta c_one)) -> exists k:Z, (mem k (to_fset 0%Z (n + 1%Z)%Z)) /\ (infix_lseqdt (modulus (infix_mndt theta (infix_sldt (i_to_c k) (i_to_c n)))) (infix_sldt c_one (i_to_c (n * 2%Z)%Z))). Axiom appr : forall (theta:complex) (n:Z), (0%Z < n)%Z -> (real_ theta) -> ((infix_lsdt c_zero theta) /\ (infix_lseqdt theta c_one)) -> exists k:Z, (mem k (to_fset 0%Z (n + 1%Z)%Z)) /\ (infix_lseqdt (modulus (infix_mndt theta (infix_sldt (i_to_c k) (i_to_c n)))) (infix_sldt c_one (i_to_c (n * 2%Z)%Z))). Axiom circuit : Type. Parameter circuit_WhyType : WhyType circuit. Existing Instance circuit_WhyType. Parameter circ_to_pps: circuit -> pps. Axiom circ_to_pps_spec : forall (c:circuit), (1%Z <= (h_width (circ_to_pps c)))%Z. Parameter width: circuit -> Z. Axiom width_spec : forall (c:circuit), (1%Z <= (width c))%Z. Axiom width_spec1 : forall (c:circuit), ((width c) = (h_width (circ_to_pps c))). Parameter size: circuit -> Z. Axiom size_spec : forall (c:circuit), (0%Z <= (size c))%Z. Parameter ancillas: circuit -> Z. Axiom ancillas_spec : forall (c:circuit), (0%Z <= (ancillas c))%Z. Parameter range: circuit -> Z. Axiom range_spec : forall (c:circuit), (0%Z <= (range c))%Z. Axiom range_spec1 : forall (c:circuit), ((range c) = (h_range (circ_to_pps c))). Parameter basis_ket: circuit -> (Z -> Z) -> (Z -> Z) -> Z -> Z. Axiom basis_ket_spec : forall (c:circuit) (x:Z -> Z) (y:Z -> Z) (i:Z), ((basis_ket c x y i) = ((((h_basis_ket (circ_to_pps c)) x) y) i)). Axiom basis_ket_spec1 : forall (c:circuit) (x:Z -> Z) (y:Z -> Z) (i:Z), (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (width c))%Z) -> (0%Z <= (x i1))%Z /\ ((x i1) < 2%Z)%Z) -> (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (range c))%Z) -> (0%Z <= (y i1))%Z /\ ((y i1) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (width c))%Z) -> (0%Z <= (basis_ket c x y i))%Z. Axiom basis_ket_spec2 : forall (c:circuit) (x:Z -> Z) (y:Z -> Z) (i:Z), (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (width c))%Z) -> (0%Z <= (x i1))%Z /\ ((x i1) < 2%Z)%Z) -> (forall (i1:Z), ((0%Z <= i1)%Z /\ (i1 < (range c))%Z) -> (0%Z <= (y i1))%Z /\ ((y i1) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (width c))%Z) -> ((basis_ket c x y i) < 2%Z)%Z. Parameter ang_ind: circuit -> (Z -> Z) -> (Z -> Z) -> angle. Axiom ang_ind_spec : forall (c:circuit) (x:Z -> Z) (y:Z -> Z), ((ang_ind c x y) = (((h_angle (circ_to_pps c)) x) y)). Axiom circ_to_pps_width : forall (c:circuit), ((h_width (circ_to_pps c)) = (width c)). Axiom circ_to_pps_range : forall (c:circuit), ((h_range (circ_to_pps c)) = (range c)). Axiom circ_to_pps_basis_ket : forall (c:circuit) (x:Z -> Z) (y:Z -> Z) (i:Z), (((((h_basis_ket (circ_to_pps c)) x) y) i) = (basis_ket c x y i)). Axiom circ_to_pps_basis_ket_gen : forall (c:circuit) (x:Z -> Z) (y:Z -> Z), ((((h_basis_ket (circ_to_pps c)) x) y) = ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) c) x) y)). Axiom circ_to_pps_angle : forall (c:circuit) (x:Z -> Z) (y:Z -> Z), ((((h_angle (circ_to_pps c)) x) y) = (ang_ind c x y)). Parameter path_sem_basis: circuit -> (matrix complex) -> matrix complex. Axiom path_sem_basis_spec : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> is_a_ket_l (path_sem_basis c x) (width c). Axiom path_sem_basis_spec1 : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> ((path_sem_basis c x) = (pps_apply_basis (circ_to_pps c) (ket_to_bv x))). Parameter path_sem: circuit -> (matrix complex) -> matrix complex. Axiom path_sem_spec : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> is_a_ket_l (path_sem c x) (width c). Axiom path_sem_spec1 : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> ((path_sem c x) = (pps_apply (circ_to_pps c) x)). Parameter sem: circuit -> (matrix complex) -> (matrix complex) -> Prop. Axiom sem_def : forall (c:circuit) (x:matrix complex) (y:matrix complex), (sem c x y) -> is_a_ket_l x (width c). Axiom sem_def1 : forall (c:circuit) (x:matrix complex) (y:matrix complex), (sem c x y) -> infix_eqeq y (path_sem c x). Axiom sem_def2 : forall (c:circuit) (x:matrix complex) (y:matrix complex), ((is_a_ket_l x (width c)) /\ (infix_eqeq y (path_sem c x))) -> sem c x y. Parameter id: circuit. Axiom id_def : ((circ_to_pps id) = pps_id). Axiom id_def1 : ((ancillas id) = 0%Z). Axiom id_def2 : ((size id) = 0%Z). Axiom id_def3 : ((range id) = 0%Z). Axiom id_def4 : ((width id) = 1%Z). Axiom id_def5 : forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((basis_ket id x y i) = (x i)). Axiom id_def6 : forall (x:Z -> Z) (y:Z -> Z), ((ang_ind id x y) = ang_zero). Parameter swap: circuit. Axiom swap_def : ((circ_to_pps swap) = pps_swap). Axiom swap_def1 : ((ancillas swap) = 0%Z). Axiom swap_def2 : ((size swap) = 0%Z). Axiom swap_def3 : ((range swap) = 0%Z). Axiom swap_def4 : ((width swap) = 2%Z). Axiom swap_def5 : forall (x:Z -> Z) (y:Z -> Z), ((basis_ket swap x y 0%Z) = (x 1%Z)). Axiom swap_def6 : forall (x:Z -> Z) (y:Z -> Z), ((basis_ket swap x y 1%Z) = (x 0%Z)). Axiom swap_def7 : forall (x:Z -> Z) (y:Z -> Z), ((ang_ind swap x y) = ang_zero). Parameter phase: Z -> circuit. Axiom phase_spec : forall (k:Z), ((circ_to_pps (phase k)) = (pps_phase k)). Axiom phase_spec1 : forall (k:Z), ((ancillas (phase k)) = 0%Z). Axiom phase_spec2 : forall (k:Z), ((size (phase k)) = 1%Z). Axiom phase_spec3 : forall (k:Z), ((range (phase k)) = 0%Z). Axiom phase_spec4 : forall (k:Z), ((width (phase k)) = 1%Z). Axiom phase_spec5 : forall (k:Z), forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((basis_ket (phase k) x y i) = (x i)). Axiom phase_spec6 : forall (k:Z), (0%Z <= k)%Z -> forall (x:Z -> Z) (y:Z -> Z), ((ang_ind (phase k) x y) = (int_to_ang 1%Z k)). Axiom phase_spec7 : forall (k:Z), (k < 0%Z)%Z -> forall (x:Z -> Z) (y:Z -> Z), ((ang_ind (phase k) x y) = (int_to_ang (-1%Z)%Z (-k)%Z)). Parameter rz: Z -> circuit. Axiom rz_spec : forall (k:Z), ((circ_to_pps (rz k)) = (pps_rz k)). Axiom rz_spec1 : forall (k:Z), ((ancillas (rz k)) = 0%Z). Axiom rz_spec2 : forall (k:Z), ((size (rz k)) = 1%Z). Axiom rz_spec3 : forall (k:Z), ((range (rz k)) = 0%Z). Axiom rz_spec4 : forall (k:Z), ((width (rz k)) = 1%Z). Axiom rz_spec5 : forall (k:Z), forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((basis_ket (rz k) x y i) = (x i)). Axiom rz_spec6 : forall (k:Z), (0%Z <= k)%Z -> forall (x:Z -> Z) (y:Z -> Z), (((x 0%Z) = 0%Z) -> ((ang_ind (rz k) x y) = ang_zero)) /\ (~ ((x 0%Z) = 0%Z) -> ((ang_ind (rz k) x y) = (int_to_ang 1%Z k))). Axiom rz_spec7 : forall (k:Z), (k < 0%Z)%Z -> forall (x:Z -> Z) (y:Z -> Z), (((x 0%Z) = 0%Z) -> ((ang_ind (rz k) x y) = ang_zero)) /\ (~ ((x 0%Z) = 0%Z) -> ((ang_ind (rz k) x y) = (int_to_ang (-1%Z)%Z (-k)%Z))). Parameter hadamard: circuit. Axiom hadamard_def : ((circ_to_pps hadamard) = pps_hadamard). Axiom hadamard_def1 : ((ancillas hadamard) = 0%Z). Axiom hadamard_def2 : ((size hadamard) = 1%Z). Axiom hadamard_def3 : ((range hadamard) = 1%Z). Axiom hadamard_def4 : ((width hadamard) = 1%Z). Axiom hadamard_def5 : forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((basis_ket hadamard x y i) = (y i)). Axiom hadamard_def6 : forall (x:Z -> Z) (y:Z -> Z), ((((x 0%Z) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((ang_ind hadamard x y) = ang_minus_one)) /\ (~ (((x 0%Z) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((ang_ind hadamard x y) = ang_zero)). Parameter cnot: circuit. Axiom cnot_def : ((circ_to_pps cnot) = pps_cnot). Axiom cnot_def1 : ((ancillas cnot) = 0%Z). Axiom cnot_def2 : ((size cnot) = 1%Z). Axiom cnot_def3 : ((range cnot) = 0%Z). Axiom cnot_def4 : ((width cnot) = 2%Z). Axiom cnot_def5 : forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((i = 0%Z) -> ((basis_ket cnot x y i) = (x i))) /\ (~ (i = 0%Z) -> ((basis_ket cnot x y i) = (int.EuclideanDivision.mod1 ((x 0%Z) + (x i))%Z 2%Z))). Axiom cnot_def6 : forall (x:Z -> Z) (y:Z -> Z), ((ang_ind cnot x y) = ang_zero). Parameter parallel: circuit -> circuit -> circuit. Axiom parallel_spec : forall (d:circuit) (e1:circuit), ((circ_to_pps (parallel d e1)) = (pps_par (circ_to_pps d) (circ_to_pps e1))). Axiom parallel_spec1 : forall (d:circuit) (e1:circuit), ((ancillas (parallel d e1)) = ((ancillas d) + (ancillas e1))%Z). Axiom parallel_spec2 : forall (d:circuit) (e1:circuit), ((size (parallel d e1)) = ((size d) + (size e1))%Z). Axiom parallel_spec3 : forall (d:circuit) (e1:circuit), ((width (parallel d e1)) = ((width d) + (width e1))%Z). Axiom parallel_spec4 : forall (d:circuit) (e1:circuit), ((range (parallel d e1)) = ((range d) + (range e1))%Z). Axiom parallel_spec5 : forall (d:circuit) (e1:circuit), forall (x:Z -> Z) (y:Z -> Z), ((ang_ind (parallel d e1) x y) = (ang_add (ang_ind d x y) (ang_ind e1 (fun (k:Z) => (x (k + (width d))%Z)) (fun (k:Z) => (y (k + (range d))%Z))))). Axiom parallel_spec6 : forall (d:circuit) (e1:circuit), forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((i < (width d))%Z -> ((basis_ket (parallel d e1) x y i) = (basis_ket d x y i))) /\ (~ (i < (width d))%Z -> ((basis_ket (parallel d e1) x y i) = (basis_ket e1 (fun (k:Z) => (x (k + (width d))%Z)) (fun (k:Z) => (y (k + (range d))%Z)) (i - (width d))%Z))). Parameter sequence: circuit -> circuit -> circuit. Axiom sequence_spec : forall (d:circuit) (e1:circuit), ((width d) = (width e1)) -> ((circ_to_pps (sequence d e1)) = (pps_seq (circ_to_pps d) (circ_to_pps e1))). Axiom sequence_spec1 : forall (d:circuit) (e1:circuit), ((width d) = (width e1)) -> ((ancillas (sequence d e1)) = (ZArith.BinInt.Z.max (ancillas d) (ancillas e1))). Axiom sequence_spec2 : forall (d:circuit) (e1:circuit), ((width d) = (width e1)) -> ((size (sequence d e1)) = ((size d) + (size e1))%Z). Axiom sequence_spec3 : forall (d:circuit) (e1:circuit), ((width d) = (width e1)) -> ((width (sequence d e1)) = (width d)). Axiom sequence_spec4 : forall (d:circuit) (e1:circuit), ((width d) = (width e1)) -> ((range (sequence d e1)) = ((range d) + (range e1))%Z). Axiom sequence_spec5 : forall (d:circuit) (e1:circuit), ((width d) = (width e1)) -> forall (x:Z -> Z) (y:Z -> Z), ((ang_ind (sequence d e1) x y) = (ang_add (ang_ind d x y) (ang_ind e1 ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) d) x) y) (fun (k:Z) => (y (k + (range d))%Z))))). Axiom sequence_spec6 : forall (d:circuit) (e1:circuit), ((width d) = (width e1)) -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((basis_ket (sequence d e1) x y i) = (basis_ket e1 ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) d) x) y) (fun (k:Z) => (y (k + (range d))%Z)) i)). Parameter ancilla: circuit -> circuit. Axiom ancilla_spec : forall (c:circuit), (2%Z <= (width c))%Z -> (exists path_sem_target:(matrix complex) -> matrix complex, forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((circ_to_pps (ancilla c)) = (pps_anc (circ_to_pps c))). Axiom ancilla_spec1 : forall (c:circuit), (2%Z <= (width c))%Z -> (exists path_sem_target:(matrix complex) -> matrix complex, forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((ancillas (ancilla c)) = ((ancillas c) + 1%Z)%Z). Axiom ancilla_spec2 : forall (c:circuit), (2%Z <= (width c))%Z -> (exists path_sem_target:(matrix complex) -> matrix complex, forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((size (ancilla c)) = (size c)). Parameter correct_path_sum_basis: circuit -> pps -> bitvec -> Prop. Parameter correct_path_sum: circuit -> pps -> Prop. Axiom correct_main_path_sum : forall (c:circuit), correct_path_sum c (circ_to_pps c). Axiom path_sem_basis_apply : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> ((path_sem_basis c x) = (pps_apply_basis (circ_to_pps c) (ket_to_bv x))). Axiom path_sem_basis_value : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> ((path_sem_basis c x) = (infix_asdtdt (pow_inv_sqrt_2 (range c)) (ket_sum_l (n_bvs (range c)) (fun (y:bitvec) => (infix_asdtdt (ang_exp (ang_ind c (getbv (ket_to_bv x)) (getbv y))) (bv_to_ket (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) c) (getbv (ket_to_bv x))) (getbv y)) (width c))))) (width c)))). Axiom path_sem_value_for_basis : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> ((path_sem c x) = (infix_asdtdt (pow_inv_sqrt_2 (range c)) (ket_sum_l (n_bvs (range c)) (fun (y:bitvec) => (infix_asdtdt (ang_exp (ang_ind c (getbv (ket_to_bv x)) (getbv y))) (bv_to_ket (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) c) (getbv (ket_to_bv x))) (getbv y)) (width c))))) (width c)))). Axiom apply_path_sem_basis : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> ((pps_apply_basis (circ_to_pps c) (ket_to_bv x)) = (path_sem_basis c x)). Axiom path_sem_apply : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> ((path_sem c x) = (pps_apply (circ_to_pps c) x)). Axiom apply_path_sem : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> ((pps_apply (circ_to_pps c) x) = (path_sem c x)). Axiom path_sem_ket_l : forall (c:circuit) (x:matrix complex) (l:Z), (is_a_ket_l x (width c)) -> (l = (width c)) -> is_a_ket_l (path_sem c x) l. Axiom path_sem_ket_length : forall (c:circuit) (x:matrix complex) (l:Z), (is_a_ket_l x (width c)) -> (l = (width c)) -> ((ket_length (path_sem c x)) = l). Axiom get_path_sem : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> ((path_sem c x) = (ket_sum_l (n_bvs (width c)) (fun (y:bitvec) => (infix_asdtdt (get_ket x (bv_to_int y)) (path_sem_basis c (bv_to_ket y)))) (width c))). Axiom get_path_sem_basis : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> ((path_sem c x) = (path_sem_basis c x)). Axiom circ_to_pps_parallel : forall (d:circuit) (e1:circuit), ((circ_to_pps (parallel d e1)) = (pps_par (circ_to_pps d) (circ_to_pps e1))). Axiom parallel_width : forall (d:circuit) (e1:circuit), ((width (parallel d e1)) = ((width d) + (width e1))%Z). Axiom parallel_range : forall (d:circuit) (e1:circuit), ((range (parallel d e1)) = ((range d) + (range e1))%Z). Axiom parallel_basis_ket : forall (d:circuit) (e1:circuit) (x:Z -> Z) (y:Z -> Z) (i:Z), ((i < (width d))%Z -> ((basis_ket (parallel d e1) x y i) = (basis_ket d x y i))) /\ (~ (i < (width d))%Z -> ((basis_ket (parallel d e1) x y i) = (basis_ket e1 (fun (k:Z) => (x (k + (width d))%Z)) (fun (k:Z) => (y (k + (range d))%Z)) (i - (width d))%Z))). Axiom parallel_angle : forall (d:circuit) (e1:circuit) (x:Z -> Z) (y:Z -> Z), ((ang_ind (parallel d e1) x y) = (ang_add (ang_ind d x y) (ang_ind e1 (fun (k:Z) => (x (k + (width d))%Z)) (fun (k:Z) => (y (k + (range d))%Z))))). Axiom circ_to_pps_sequence : forall (d:circuit) (e1:circuit), ((width d) = (width e1)) -> ((circ_to_pps (sequence d e1)) = (pps_seq (circ_to_pps d) (circ_to_pps e1))). Axiom sequence_width : forall (d:circuit) (e1:circuit), ((width d) = (width e1)) -> ((width (sequence d e1)) = (width d)). Axiom sequence_range : forall (d:circuit) (e1:circuit), ((width d) = (width e1)) -> ((range (sequence d e1)) = ((range d) + (range e1))%Z). Axiom sequence_basis_ket : forall (d:circuit) (e1:circuit) (x:Z -> Z) (y:Z -> Z) (i:Z), ((width d) = (width e1)) -> ((basis_ket (sequence d e1) x y i) = (basis_ket e1 ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) d) x) y) (fun (k:Z) => (y (k + (range d))%Z)) i)). Axiom sequence_angle : forall (d:circuit) (e1:circuit) (x:Z -> Z) (y:Z -> Z), ((width d) = (width e1)) -> ((ang_ind (sequence d e1) x y) = (ang_add (ang_ind d x y) (ang_ind e1 ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) d) x) y) (fun (k:Z) => (y (k + (range d))%Z))))). Axiom circ_to_pps_ancilla : forall (c:circuit), (2%Z <= (width c))%Z -> (exists path_sem_target:(matrix complex) -> matrix complex, forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((circ_to_pps (ancilla c)) = (pps_anc (circ_to_pps c))). Axiom ancilla_width : forall (c:circuit), (2%Z <= (width c))%Z -> (exists path_sem_target:(matrix complex) -> matrix complex, forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((width (ancilla c)) = ((width c) - 1%Z)%Z). Axiom ancilla_range : forall (c:circuit), (2%Z <= (width c))%Z -> (exists path_sem_target:(matrix complex) -> matrix complex, forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((range (ancilla c)) = (range c)). Parameter fc21: circuit -> (Z -> Z) -> Z -> Z. Axiom fc_def21 : forall (c:circuit) (x:Z -> Z) (k:Z), ((k = ((width c) - 1%Z)%Z) -> (((fc21 c x) k) = 0%Z)) /\ (~ (k = ((width c) - 1%Z)%Z) -> (((fc21 c x) k) = (x k))). Axiom ancilla_basis_ket : forall (c:circuit) (x:Z -> Z) (y:Z -> Z) (i:Z), (2%Z <= (width c))%Z -> (exists path_sem_target:(matrix complex) -> matrix complex, forall (x1:matrix complex), (is_a_ket_l x1 ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x1 (ket 1%Z 0%Z))) = (kronecker (path_sem_target x1) (ket 1%Z 0%Z)))) -> ((basis_ket (ancilla c) x y i) = (basis_ket c (fc21 c x) y i)). Parameter fc22: circuit -> (Z -> Z) -> Z -> Z. Axiom fc_def22 : forall (c:circuit) (x:Z -> Z) (k:Z), ((k = ((width c) - 1%Z)%Z) -> (((fc22 c x) k) = 0%Z)) /\ (~ (k = ((width c) - 1%Z)%Z) -> (((fc22 c x) k) = (x k))). Axiom ancilla_angle : forall (c:circuit) (x:Z -> Z) (y:Z -> Z), (2%Z <= (width c))%Z -> (exists path_sem_target:(matrix complex) -> matrix complex, forall (x1:matrix complex), (is_a_ket_l x1 ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x1 (ket 1%Z 0%Z))) = (kronecker (path_sem_target x1) (ket 1%Z 0%Z)))) -> ((ang_ind (ancilla c) x y) = (ang_ind c (fc22 c x) y)). Axiom sequence_eq : forall (d:circuit) (d':circuit) (e1:circuit) (e':circuit), ((width d) = (width e1)) -> (d = d') -> (e1 = e') -> ((sequence d e1) = (sequence d' e')). Axiom ancilla_eq : forall (c:circuit) (c':circuit) (path_sem_target:(matrix complex) -> matrix complex), (forall (x:matrix complex), (is_a_ket_l x (width c)) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((width c) = (width c')) -> (c = c') -> ((ancilla c) = (ancilla c')). Axiom parallel_eq : forall (d:circuit) (d':circuit) (e1:circuit) (e':circuit), (d = d') -> (e1 = e') -> ((parallel d e1) = (parallel d' e')). Axiom path_sem_decomp : forall (c:circuit) (x:matrix complex), (is_a_ket_l x (width c)) -> ((path_sem c x) = (ket_sum_l (n_bvs (width c)) (fun (z:bitvec) => (infix_asdtdt (get_ket x (bv_to_int z)) (path_sem c (bv_to_ket z)))) (width c))). Axiom path_sem_scal_ : forall (c:circuit) (x:matrix complex) (y:matrix complex) (sc:complex), (is_a_ket_l x (width c)) -> ((path_sem c x) = y) -> ((path_sem c (infix_asdtdt sc x)) = (infix_asdtdt sc y)). Axiom path_sem_scal : forall (c:circuit) (x:matrix complex) (sc:complex), (is_a_ket_l x (width c)) -> ((path_sem c (infix_asdtdt sc x)) = (infix_asdtdt sc (path_sem c x))). Axiom path_sem_scal_rev : forall (c:circuit) (x:matrix complex) (sc:complex), (is_a_ket_l x (width c)) -> ((infix_asdtdt sc (path_sem c x)) = (path_sem c (infix_asdtdt sc x))). Axiom path_sem_add : forall (c:circuit) (x:matrix complex) (x':matrix complex) (y:matrix complex) (y':matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_l x' (width c)) -> ((path_sem c x) = y) -> ((path_sem c x') = y') -> ((path_sem c (add_ket_l x x' (width c))) = (add_ket_l y y' (width c))). Axiom path_sem_scal_add_ket_l : forall (c:circuit) (x:matrix complex) (x':matrix complex) (a:complex) (a':complex) (n:Z), ((width c) = n) -> (is_a_ket_l x n) -> (is_a_ket_l x' n) -> ((path_sem c (add_ket_l (infix_asdtdt a x) (infix_asdtdt a' x') n)) = (add_ket_l (infix_asdtdt a (path_sem c x)) (infix_asdtdt a' (path_sem c x')) n)). Axiom path_sem_substr : forall (c:circuit) (x:matrix complex) (x':matrix complex) (y:matrix complex) (y':matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_l x' (width c)) -> ((path_sem c x) = y) -> ((path_sem c x') = y') -> ((path_sem c (mat_substr x x')) = (mat_substr y y')). Axiom path_sem_scal_add : forall (c:circuit) (x:matrix complex) (x':matrix complex) (y:matrix complex) (y':matrix complex) (scal:complex), (is_a_ket_l x (width c)) -> (is_a_ket_l x' (width c)) -> ((path_sem c x) = y) -> ((path_sem c x') = y') -> ((path_sem c (infix_asdtdt scal (add_ket_l x x' (width c)))) = (infix_asdtdt scal (add_ket_l y y' (width c)))). Axiom path_sem_scal_substr : forall (c:circuit) (x:matrix complex) (x':matrix complex) (y:matrix complex) (y':matrix complex) (scal:complex), (is_a_ket_l x (width c)) -> (is_a_ket_l x' (width c)) -> ((path_sem c x) = y) -> ((path_sem c x') = y') -> ((path_sem c (infix_asdtdt scal (mat_substr x x'))) = (infix_asdtdt scal (mat_substr y y'))). Axiom path_sem_sum : forall {a:Type} {a_WT:WhyType a}, forall (c:circuit) (s:set a) (f:a -> matrix complex) (g:a -> matrix complex) (n:Z), ((cardinal s) >= 1%Z)%Z -> (n = (width c)) -> (forall (x:a), (mem x s) -> is_a_ket_l (f x) (width c)) -> (forall (x:a), (mem x s) -> ((path_sem c (f x)) = (g x))) -> ((path_sem c (ket_sum_l s f n)) = (ket_sum_l s g n)). Axiom path_sem_sum_diag : forall (c:circuit) (s:set bitvec) (f:bitvec -> complex) (l:Z), (s = (n_bvs l)) -> (l = (width c)) -> ((path_sem c (ket_sum_l_diag f l)) = (ket_sum_l s (fun (x:bitvec) => (infix_asdtdt (f x) (path_sem c (bv_to_ket x)))) l)). Axiom path_sem_sum_ : forall {a:Type} {a_WT:WhyType a}, forall (c:circuit) (s:set a) (f:a -> matrix complex) (n:Z), ((cardinal s) >= 1%Z)%Z -> (n = (width c)) -> (forall (x:a), (mem x s) -> is_a_ket_l (f x) (width c)) -> ((path_sem c (ket_sum_l s f n)) = (ket_sum_l s (fun (x:a) => (path_sem c (f x))) n)). Axiom path_sem_sum_gen : forall {a:Type} {a_WT:WhyType a}, forall (c:circuit) (s:set a) (f:a -> matrix complex) (g:a -> matrix complex) (n:Z), ((cardinal s) >= 1%Z)%Z -> (n = (width c)) -> (forall (x:a), (mem x s) -> is_a_ket_l (f x) (width c)) -> (forall (x:a), (mem x s) -> ((path_sem c (f x)) = (g x))) -> ((path_sem c (ket_sum_l s f n)) = (ket_sum_l s g n)). Axiom scal_path_sem_sum_gen : forall {a:Type} {a_WT:WhyType a}, forall (c:circuit) (s:set a) (f:a -> matrix complex) (g:a -> matrix complex) (n:Z) (n':Z) (a1:complex) (b:complex), ((cardinal s) >= 1%Z)%Z -> (n = (width c)) -> (forall (x:a), (mem x s) -> is_a_ket_l (f x) (width c)) -> (forall (x:a), (mem x s) -> ((path_sem c (f x)) = (g x))) -> (a1 = b) -> (n = n') -> ((infix_asdtdt a1 (path_sem c (ket_sum_l s f n))) = (infix_asdtdt b (ket_sum_l s g n'))). Axiom scal_path_sem_sum : forall {a:Type} {a_WT:WhyType a}, forall (c:circuit) (s:set a) (f:a -> matrix complex) (n:Z) (a1:complex), ((cardinal s) >= 1%Z)%Z -> (n = (width c)) -> (forall (x:a), (mem x s) -> is_a_ket_l (f x) (width c)) -> ((infix_asdtdt a1 (path_sem c (ket_sum_l s f n))) = (infix_asdtdt a1 (ket_sum_l s (fun (x:a) => (path_sem c (f x))) n))). Axiom path_sem_scal_sum : forall {a:Type} {a_WT:WhyType a}, forall (c:circuit) (s:set a) (f:a -> matrix complex) (n:Z) (a1:complex), ((cardinal s) >= 1%Z)%Z -> (n = (width c)) -> (forall (x:a), (mem x s) -> is_a_ket_l (f x) (width c)) -> ((path_sem c (infix_asdtdt a1 (ket_sum_l s f n))) = (infix_asdtdt a1 (ket_sum_l s (fun (x:a) => (path_sem c (f x))) n))). Axiom path_sem_comp : forall (d:circuit) (e1:circuit) (x:matrix complex) (y:matrix complex) (z:matrix complex), (is_a_ket_l x (width d)) -> ((path_sem d x) = y) -> ((path_sem e1 y) = z) -> ((width d) = (width e1)) -> ((path_sem (sequence d e1) x) = z). Axiom sem_comp : forall (d:circuit) (e1:circuit) (x:matrix complex) (y:matrix complex) (z:matrix complex), (sem d x y) -> (sem e1 y z) -> ((width d) = (width e1)) -> sem (sequence d e1) x z. Axiom path_sem_kron : forall (d:circuit) (e1:circuit) (x:matrix complex) (x':matrix complex) (y:matrix complex) (y':matrix complex), (is_a_ket_l x (width d)) -> (is_a_ket_l y (width e1)) -> ((path_sem d x) = x') -> ((path_sem e1 y) = y') -> ((path_sem (parallel d e1) (kronecker x y)) = (kronecker x' y')). Axiom path_sem_kron_ : forall (d:circuit) (e1:circuit) (x:matrix complex) (y:matrix complex), (is_a_ket_l x (width d)) -> (is_a_ket_l y (width e1)) -> ((path_sem (parallel d e1) (kronecker x y)) = (kronecker (path_sem d x) (path_sem e1 y))). Axiom path_sem_sequence_parallel : forall (a:circuit) (b:circuit) (d:circuit) (e1:circuit) (x:matrix complex), (is_a_ket_l x ((width a) + (width b))%Z) -> ((width a) = (width d)) -> ((width b) = (width e1)) -> ((path_sem (sequence (parallel a b) (parallel d e1)) x) = (path_sem (parallel (sequence a d) (sequence b e1)) x)). Axiom path_sem_id_basis : forall (x:matrix complex), (is_a_ket_l x 1%Z) -> (is_a_ket_basis_elt x) -> ((path_sem_basis id x) = x). Axiom path_sem_id : forall (x:matrix complex), (is_a_ket_l x 1%Z) -> ((path_sem id x) = x). Axiom path_sem_phase_basis : forall (x:matrix complex) (k:Z), (is_a_ket_l x 1%Z) -> (is_a_ket_basis_elt x) -> ((0%Z <= k)%Z -> ((path_sem (phase k) x) = (infix_asdtdt (ang_exp (int_to_ang 1%Z k)) x))) /\ (~ (0%Z <= k)%Z -> ((path_sem (phase k) x) = (infix_asdtdt (ang_exp (int_to_ang (-1%Z)%Z (-k)%Z)) x))). Axiom path_sem_phase_basis_inv : forall (x:matrix complex) (k:Z), (is_a_ket_l x 1%Z) -> (is_a_ket_basis_elt x) -> ((path_sem (phase k) (path_sem (phase (-k)%Z) x)) = x). Axiom path_sem_phase_inv : forall (x:matrix complex) (k:Z), (is_a_ket_l x 1%Z) -> ((path_sem (phase k) (path_sem (phase (-k)%Z) x)) = x). Axiom path_sem_rz_basis : forall (x:matrix complex) (k:Z), (is_a_ket_l x 1%Z) -> (is_a_ket_basis_elt x) -> (((ket_to_int x) = 0%Z) -> ((path_sem (rz k) x) = x)) /\ (~ ((ket_to_int x) = 0%Z) -> ((0%Z <= k)%Z -> ((path_sem (rz k) x) = (infix_asdtdt (ang_exp (int_to_ang 1%Z k)) x))) /\ (~ (0%Z <= k)%Z -> ((path_sem (rz k) x) = (infix_asdtdt (ang_exp (int_to_ang (-1%Z)%Z (-k)%Z)) x)))). Axiom path_sem_rz_basis_inv : forall (x:matrix complex) (k:Z), (is_a_ket_l x 1%Z) -> (is_a_ket_basis_elt x) -> ((path_sem (rz k) (path_sem (rz (-k)%Z) x)) = x). Axiom path_sem_rz_inv : forall (x:matrix complex) (k:Z), (is_a_ket_l x 1%Z) -> ((path_sem (rz k) (path_sem (rz (-k)%Z) x)) = x). Parameter qbit_zero: unit -> matrix complex. Axiom qbit_zero_def : forall (us:unit), ((qbit_zero us) = (ket 1%Z 0%Z)). Axiom qbit_zero_spec : forall (us:unit), ((get_ket (qbit_zero us) 0%Z) = c_one). Axiom qbit_zero_spec1 : forall (us:unit), ((get_ket (qbit_zero us) 1%Z) = c_zero). Axiom qbit_zero_spec2 : forall (us:unit), is_a_ket_l (qbit_zero us) 1%Z. Axiom qbit_zero_spec3 : forall (us:unit), ((rows (qbit_zero us)) = 2%Z). Axiom qbit_zero_spec4 : forall (us:unit), ((columns (qbit_zero us)) = 1%Z). Axiom qbit_zero_spec5 : forall (us:unit), ((get (qbit_zero us) 0%Z 0%Z) = c_one). Axiom qbit_zero_spec6 : forall (us:unit), ((get (qbit_zero us) 1%Z 0%Z) = c_zero). Axiom qbit_zero_spec7 : forall (us:unit), is_a_ket_basis_elt (qbit_zero us). Parameter qbit_one: unit -> matrix complex. Axiom qbit_one_def : forall (us:unit), ((qbit_one us) = (ket 1%Z 1%Z)). Axiom qbit_one_spec : forall (us:unit), ((get_ket (qbit_one us) 0%Z) = c_zero). Axiom qbit_one_spec1 : forall (us:unit), ((get_ket (qbit_one us) 1%Z) = c_one). Axiom qbit_one_spec2 : forall (us:unit), is_a_ket_l (qbit_one us) 1%Z. Axiom qbit_one_spec3 : forall (us:unit), ((rows (qbit_one us)) = 2%Z). Axiom qbit_one_spec4 : forall (us:unit), ((columns (qbit_one us)) = 1%Z). Axiom qbit_one_spec5 : forall (us:unit), ((get (qbit_one us) 0%Z 0%Z) = c_zero). Axiom qbit_one_spec6 : forall (us:unit), ((get (qbit_one us) 1%Z 0%Z) = c_one). Axiom qbit_one_spec7 : forall (us:unit), is_a_ket_basis_elt (qbit_one us). Parameter qbit_plus: unit -> matrix complex. Axiom qbit_plus_def : forall (us:unit), ((qbit_plus us) = (pps_apply pps_hadamard (qbit_zero tt))). Axiom qbit_plus_spec : forall (us:unit), ((qbit_plus us) = (infix_asdtdt (pow_inv_sqrt_2 1%Z) (add_ket_l (qbit_zero tt) (qbit_one tt) 1%Z))). Axiom qbit_plus_spec1 : forall (us:unit), is_a_ket_l (qbit_plus us) 1%Z. Axiom qbit_plus_spec2 : forall (us:unit), ((rows (qbit_plus us)) = 2%Z). Axiom qbit_plus_spec3 : forall (us:unit), ((columns (qbit_plus us)) = 1%Z). Axiom qbit_plus_spec4 : forall (us:unit), ((get_ket (qbit_plus us) 0%Z) = (pow_inv_sqrt_2 1%Z)). Axiom qbit_plus_spec5 : forall (us:unit), ((get_ket (qbit_plus us) 1%Z) = (pow_inv_sqrt_2 1%Z)). Parameter qbit_minus: unit -> matrix complex. Axiom qbit_minus_def : forall (us:unit), ((qbit_minus us) = (pps_apply pps_hadamard (qbit_one tt))). Axiom qbit_minus_spec : forall (us:unit), ((qbit_minus us) = (infix_asdtdt (pow_inv_sqrt_2 1%Z) (add_ket_l (qbit_zero tt) (infix_asdtdt (prefix_mndt c_one) (qbit_one tt)) 1%Z))). Axiom qbit_minus_spec1 : forall (us:unit), is_a_ket_l (qbit_minus us) 1%Z. Axiom qbit_minus_spec2 : forall (us:unit), ((rows (qbit_minus us)) = 2%Z). Axiom qbit_minus_spec3 : forall (us:unit), ((columns (qbit_minus us)) = 1%Z). Axiom qbit_minus_spec4 : forall (us:unit), ((get_ket (qbit_minus us) 0%Z) = (pow_inv_sqrt_2 1%Z)). Axiom qbit_minus_spec5 : forall (us:unit), ((get_ket (qbit_minus us) 1%Z) = (prefix_mndt (pow_inv_sqrt_2 1%Z))). Axiom add_plus_minus : ((add_ket_l (qbit_plus tt) (qbit_minus tt) 1%Z) = (infix_asdtdt squarert_two (qbit_zero tt))). Axiom add_plus_minus1 : ((add_ket_l (infix_asdtdt (pow_inv_sqrt_2 1%Z) (qbit_plus tt)) (infix_asdtdt (pow_inv_sqrt_2 1%Z) (qbit_minus tt)) 1%Z) = (qbit_zero tt)). Axiom substr_plus_minus : ((add_ket_l (qbit_plus tt) (infix_asdtdt (prefix_mndt c_one) (qbit_minus tt)) 1%Z) = (infix_asdtdt squarert_two (qbit_one tt))). Axiom substr_plus_minus1 : ((add_ket_l (infix_asdtdt (pow_inv_sqrt_2 1%Z) (qbit_plus tt)) (infix_asdtdt (prefix_mndt (pow_inv_sqrt_2 1%Z)) (qbit_minus tt)) 1%Z) = (qbit_one tt)). Axiom plus_to_zero : ((pps_apply pps_hadamard (qbit_plus tt)) = (qbit_zero tt)). Axiom plus_to_one : ((pps_apply pps_hadamard (qbit_minus tt)) = (qbit_one tt)). Axiom hadamard_comp : forall (x:bitvec), ((length x) = 1%Z) -> ((pps_apply pps_hadamard (pps_apply pps_hadamard (bv_to_ket x))) = (bv_to_ket x)). Axiom set_equal_qbit : forall (a:matrix complex) (b:matrix complex), (is_a_ket_l a 1%Z) -> (is_a_ket_l b 1%Z) -> ((get_ket a 0%Z) = (get_ket b 0%Z)) -> ((get_ket a 1%Z) = (get_ket b 1%Z)) -> (a = b). Parameter xor_qbits: (matrix complex) -> (matrix complex) -> matrix complex. Parameter result22: (matrix complex) -> (matrix complex) -> Z -> complex. Axiom result_def22 : forall (x:matrix complex) (y:matrix complex) (i:Z), ((i = 0%Z) -> (((result22 x y) i) = (infix_pldt (infix_asdt (get_ket x 0%Z) (get_ket y 0%Z)) (infix_asdt (get_ket x 1%Z) (get_ket y 1%Z))))) /\ (~ (i = 0%Z) -> (((result22 x y) i) = (infix_pldt (infix_asdt (get_ket x 0%Z) (get_ket y 1%Z)) (infix_asdt (get_ket x 1%Z) (get_ket y 0%Z))))). Axiom xor_qbits_def : forall (x:matrix complex) (y:matrix complex), (is_a_ket_l x 1%Z) -> (is_a_ket_l y 1%Z) -> ((xor_qbits x y) = (make_ket 1%Z (result22 x y))). Axiom xor_qbits_spec : forall (x:matrix complex) (y:matrix complex), (is_a_ket_l x 1%Z) -> (is_a_ket_l y 1%Z) -> is_a_ket_l (xor_qbits x y) 1%Z. Axiom xor_qbits_spec1 : forall (x:matrix complex) (y:matrix complex), (is_a_ket_l x 1%Z) -> (is_a_ket_l y 1%Z) -> (is_a_ket_basis_elt x) -> (is_a_ket_basis_elt y) -> ((xor_qbits x y) = (ket 1%Z (xor_i (ket_to_int x) (ket_to_int y)))). Axiom xor_qbits_spec2 : forall (x:matrix complex) (y:matrix complex), (is_a_ket_l x 1%Z) -> (is_a_ket_l y 1%Z) -> ((get_ket (xor_qbits x y) 0%Z) = (infix_pldt (infix_asdt (get_ket x 0%Z) (get_ket y 0%Z)) (infix_asdt (get_ket x 1%Z) (get_ket y 1%Z)))). Axiom xor_qbits_spec3 : forall (x:matrix complex) (y:matrix complex), (is_a_ket_l x 1%Z) -> (is_a_ket_l y 1%Z) -> ((get_ket (xor_qbits x y) 1%Z) = (infix_pldt (infix_asdt (get_ket x 0%Z) (get_ket y 1%Z)) (infix_asdt (get_ket x 1%Z) (get_ket y 0%Z)))). Axiom xor_int_to_ket : forall (x:matrix complex) (i:Z), (is_a_ket_l x 1%Z) -> is_a_ket_l (xor_qbits (ket 1%Z i) x) 1%Z. Axiom xor_qbit_minus : forall (i:Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ((xor_qbits (ket 1%Z i) (qbit_minus tt)) = (infix_asdtdt (cpower (prefix_mndt c_one) i) (qbit_minus tt))). Axiom ket_sum_xor_qbit_minus : forall {a:Type} {a_WT:WhyType a}, forall (s:set a) (f:a -> Z), (forall (e1:a), (mem e1 s) -> (0%Z <= (f e1))%Z /\ ((f e1) < 2%Z)%Z) -> ((ket_sum_l s (fun (e1:a) => (xor_qbits (ket 1%Z (f e1)) (qbit_minus tt))) 1%Z) = (ket_sum_l s (fun (e1:a) => (infix_asdtdt (cpower (prefix_mndt c_one) (f e1)) (qbit_minus tt))) 1%Z)). Axiom superposition_xor_qbit_minus : forall (f:bitvec -> Z) (n:Z), (forall (e1:bitvec), ((length e1) = n) -> (0%Z <= (f e1))%Z /\ ((f e1) < 2%Z)%Z) -> (0%Z <= n)%Z -> ((kronecker (infix_asdtdt (pow_inv_sqrt_2 n) (ket_sum_l (n_bvs n) (fun (x:bitvec) => (infix_asdtdt (cpower (prefix_mndt c_one) (f x)) (bv_to_ket x))) n)) (qbit_minus tt)) = (infix_asdtdt (pow_inv_sqrt_2 n) (ket_sum_l (n_bvs n) (fun (e1:bitvec) => (kronecker (bv_to_ket e1) (xor_qbits (ket 1%Z (f e1)) (qbit_minus tt)))) (n + 1%Z)%Z))). Parameter bv_inversion: bitvec -> bitvec. Axiom bv_inversion_def : forall (bv:bitvec), ((bv_inversion bv) = (make_bv (fun (k:Z) => ((getbv bv) (((length bv) - k)%Z - 1%Z)%Z)) (length bv))). Axiom bv_inversion_spec : forall (bv:bitvec), ((length (bv_inversion bv)) = (length bv)). Axiom bv_inversion_spec1 : forall (bv:bitvec), forall (k:Z), (in_range (bv_inversion bv) k) -> (((getbv (bv_inversion bv)) k) = ((getbv bv) (((length bv) - k)%Z - 1%Z)%Z)). Axiom bv_inversion_value : forall (bv:bitvec) (i:Z), (((getbv (bv_inversion bv)) i) = ((getbv bv) (((length bv) - i)%Z - 1%Z)%Z)). Axiom bv_inversion_invol : forall (bv:bitvec), ((bv_inversion (bv_inversion bv)) = bv). Parameter int_bit_inversion: Z -> Z -> Z. Axiom int_bit_inversion_def : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((int_bit_inversion i n) = (bv_to_int (bv_inversion (int_to_bv i n)))). Axiom int_bit_inversion_spec : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> (0%Z <= (int_bit_inversion i n))%Z. Axiom int_bit_inversion_spec1 : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((int_bit_inversion i n) < (power 2%Z n))%Z. Parameter int_bit_inversion_ext: Z -> Z -> Z. Axiom int_bit_inversion_ext_def : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i <= (power_ 2%Z n))%Z) -> (i = (power_ 2%Z n)) -> ((int_bit_inversion_ext i n) = i). Axiom int_bit_inversion_ext_def1 : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i <= (power_ 2%Z n))%Z) -> ~ (i = (power_ 2%Z n)) -> ((int_bit_inversion_ext i n) = (bv_to_int (bv_inversion (int_to_bv i n)))). Axiom int_bit_inversion_ext_spec : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i <= (power_ 2%Z n))%Z) -> (0%Z <= (int_bit_inversion_ext i n))%Z. Axiom int_bit_inversion_ext_spec1 : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i <= (power_ 2%Z n))%Z) -> ((int_bit_inversion_ext i n) <= (power_ 2%Z n))%Z. Axiom int_bit_inversion_ext_spec2 : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i <= (power_ 2%Z n))%Z) -> (i = (power_ 2%Z n)) -> ((int_bit_inversion_ext i n) = (power_ 2%Z n)). Axiom int_bit_inversion_invol : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((int_bit_inversion (int_bit_inversion i n) n) = i). Axiom int_bit_inversion_inj : forall (i:Z) (j:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) -> ~ (i = j) -> ~ ((int_bit_inversion i n) = (int_bit_inversion j n)). Axiom int_bit_inversion_ext_invol : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i <= (power 2%Z n))%Z) -> ((int_bit_inversion_ext (int_bit_inversion_ext i n) n) = i). Axiom int_bit_inversion_onebit : forall (i:Z), ((0%Z <= i)%Z /\ (i < 2%Z)%Z) -> ((int_bit_inversion i 1%Z) = i). Axiom int_bit_inversion_zero : forall (i:Z) (n:Z), (0%Z < n)%Z -> (0%Z = i) -> ((int_bit_inversion i n) = 0%Z). Axiom bv_to_int_sum_inversion : forall (bv:bitvec), ((length bv) > 0%Z)%Z -> ((int_bit_inversion (bv_to_int bv) (length bv)) = (ind_isum (fun (k:Z) => (((getbv bv) (((length bv) - k)%Z - 1%Z)%Z) * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z) 0%Z (length bv))). Axiom bv_to_int_sum_inversion_inc : forall (bv:bitvec), ((length bv) > 0%Z)%Z -> ((int_bit_inversion (bv_to_int bv) (length bv)) = (ind_isum (fun (k:Z) => (((getbv bv) k) * (power 2%Z k))%Z) 0%Z (length bv))). Axiom inversion_to_int_comm : forall (bv:bitvec), ((length bv) > 0%Z)%Z -> ((int_to_bv (int_bit_inversion (bv_to_int bv) (length bv)) (length bv)) = (bv_inversion bv)). Axiom bv_inversion_sum : forall (i:Z) (n:Z), (0%Z < n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((int_bit_inversion i n) = (ind_isum (fun (k:Z) => (((getbv (int_to_bv i n)) ((n - k)%Z - 1%Z)%Z) * (power 2%Z ((n - 1%Z)%Z - k)%Z))%Z) 0%Z n)). Axiom bv_to_int_inversion_sum : forall (bv:bitvec), ((bv_to_int (bv_inversion bv)) = (ind_isum (fun (k:Z) => (((getbv bv) (((length bv) - k)%Z - 1%Z)%Z) * (power 2%Z (((length bv) - 1%Z)%Z - k)%Z))%Z) 0%Z (length bv))). Axiom bv_to_int_bit_inversion : forall (bv:bitvec), ((length bv) > 0%Z)%Z -> ((bv_to_int (bv_inversion bv)) = (int_bit_inversion (bv_to_int bv) (length bv))). Axiom bv_to_int_inversion_sum_inc : forall (bv:bitvec), ((length bv) > 0%Z)%Z -> ((bv_to_int (bv_inversion bv)) = (ind_isum (fun (k:Z) => (((getbv bv) k) * (power 2%Z k))%Z) 0%Z (length bv))). Axiom bv_m_to_int_bit_inversion : forall (f:Z -> Z) (n:Z), (0%Z < n)%Z -> ((bv_to_int (bv_inversion (make_bv_m f n))) = (int_bit_inversion (bv_to_int (make_bv_m f n)) n)). Axiom int_bit_inversion_tail_bits : forall (i:Z) (n:Z), (1%Z < n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((int_bit_inversion (tail_bits i n) (n - 1%Z)%Z) = (ind_isum (fun (k:Z) => (((getbv (int_to_bv i n)) (n - k)%Z) * (power 2%Z ((n - k)%Z - 1%Z)%Z))%Z) 1%Z n)). Axiom tail_bits_int_bit_inversion : forall (bv:Z -> Z) (n:Z), (1%Z < n)%Z -> ((tail_bits (int_bit_inversion (bv_to_int (make_bv_m bv n)) n) n) = (ind_isum (fun (k:Z) => ((int.EuclideanDivision.mod1 (bv ((n - 1%Z)%Z - k)%Z) 2%Z) * (power 2%Z ((n - k)%Z - 1%Z)%Z))%Z) 1%Z n)). Axiom int_bit_inversion_ht : forall (i:Z) (n:Z), (1%Z < n)%Z -> ((0%Z <= i)%Z /\ (i < (power 2%Z n))%Z) -> ((int_bit_inversion i n) = ((2%Z * (int_bit_inversion (tail_bits i n) (n - 1%Z)%Z))%Z + (head_bit i n))%Z). Axiom bv_inversion_ht : forall (f:Z -> Z) (n:Z), (1%Z < n)%Z -> ((bv_to_int (bv_inversion (make_bv_m f n))) = ((head (make_bv_m f n)) + (2%Z * (bv_to_int (bv_inversion (tail (make_bv_m f n)))))%Z)%Z). Axiom bv_inversion_ht_bv : forall (bv:bitvec), (1%Z < (length bv))%Z -> ((bv_to_int (bv_inversion bv)) = ((head bv) + (2%Z * (bv_to_int (bv_inversion (tail bv))))%Z)%Z). Axiom bv_to_int_ht : forall (f:Z -> Z) (n:Z), (1%Z < n)%Z -> ((bv_to_int (make_bv_m f n)) = (((power 2%Z (n - 1%Z)%Z) * (head (make_bv_m f n)))%Z + (bv_to_int (tail (make_bv_m f n))))%Z). Axiom bv_inversion_mult_ht : forall (fx:Z -> Z) (fy:Z -> Z) (n:Z), (1%Z < n)%Z -> (((bv_to_int (make_bv_m fx n)) * (bv_to_int (bv_inversion (make_bv_m fy n))))%Z = ((((head (make_bv_m fy n)) * (bv_to_int (make_bv_m fx n)))%Z + ((bv_to_int (tail (make_bv_m fx n))) * (2%Z * (bv_to_int (bv_inversion (tail (make_bv_m fy n)))))%Z)%Z)%Z + ((power 2%Z n) * ((head (make_bv_m fx n)) * (bv_to_int (bv_inversion (tail (make_bv_m fy n)))))%Z)%Z)%Z). Axiom bv_inversion_mult_ht_bv : forall (bvx:bitvec) (bvy:bitvec), (1%Z < (length bvx))%Z -> ((length bvx) = (length bvy)) -> (((bv_to_int bvx) * (bv_to_int (bv_inversion bvy)))%Z = ((((head bvy) * (bv_to_int bvx))%Z + ((bv_to_int (tail bvx)) * (2%Z * (bv_to_int (bv_inversion (tail bvy))))%Z)%Z)%Z + ((power 2%Z (length bvx)) * ((head bvx) * (bv_to_int (bv_inversion (tail bvy))))%Z)%Z)%Z). Parameter ang_sum: (Z -> angle) -> Z -> Z -> angle. Axiom ang_sum_def : forall (f:Z -> angle) (i:Z) (j:Z), (j <= i)%Z -> ((ang_sum f i j) = ang_zero). Axiom ang_sum_def1 : forall (f:Z -> angle) (i:Z) (j:Z), ~ (j <= i)%Z -> ((ang_sum f i j) = (int_iterate (fun (y0:angle) (y1:angle) => (ang_add y0 y1)) f i j)). Axiom ang_sumto_int_iterate : forall (f:Z -> angle) (i:Z) (j:Z), (i < j)%Z -> ((ang_sum f i j) = (int_iterate (fun (y0:angle) (y1:angle) => (ang_add y0 y1)) f i j)). Axiom ang_sum_plus_one : forall (f:Z -> angle) (i:Z) (j:Z), ((i + 1%Z)%Z < j)%Z -> ((ang_sum f i j) = (ang_add (f i) (ang_sum f (i + 1%Z)%Z j))). Axiom ang_sum_cardone : forall (f:Z -> angle) (i:Z) (j:Z), (j = (i + 1%Z)%Z) -> ((ang_sum f i j) = (f i)). Axiom ang_sum_cardone_p : forall (f:Z -> angle) (i:Z) (j:Z) (r:angle), (j = (i + 1%Z)%Z) -> ((f i) = r) -> (r = (ang_sum f i j)). Axiom ang_sum_neutral : forall (f:Z -> angle) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = ang_zero)) -> ((ang_sum f i j) = ang_zero). Axiom ang_sum_def_plus_one_com : forall (f:Z -> angle) (i:Z) (j:Z), ((i + 1%Z)%Z < j)%Z -> ((ang_add (f i) (ang_sum f (i + 1%Z)%Z j)) = (ang_sum f i j)). Axiom ang_sum_right_extension : forall (f:Z -> angle) (i:Z) (j:Z), ((i + 1%Z)%Z < j)%Z -> ((ang_sum f i j) = (ang_add (ang_sum f i (j - 1%Z)%Z) (f (j - 1%Z)%Z))). Axiom ang_sum_transitivity : forall (f:Z -> angle) (i:Z) (k:Z) (j:Z), ((i < k)%Z /\ (k < j)%Z) -> ((ang_sum f i j) = (ang_add (ang_sum f i k) (ang_sum f k j))). Axiom ang_sum_eq : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z), (i <= j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ang_sum f i j) = (ang_sum g i j)). Axiom ang_sum_int_to_ang : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z), (i < j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> (exists n:Z, forall (k:Z), exists j1:Z, exists j':Z, ((f k) = (int_to_ang j1 n)) /\ (((g k) = (int_to_ang j' n)) /\ (j1 = j'))) -> ((ang_sum f i j) = (ang_sum g i j)). Axiom vang_sum_eq : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z), (i < j)%Z -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ang_exp (ang_sum f i j)) = (ang_exp (ang_sum g i j))). Axiom vang_sum_scal_eq : forall (f:Z -> angle) (g:Z -> angle) (m:matrix complex) (n:matrix complex) (i:Z) (j:Z), (i < j)%Z -> (m = n) -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((infix_asdtdt (ang_exp (ang_sum f i j)) m) = (infix_asdtdt (ang_exp (ang_sum g i j)) n)). Axiom ang_sum_inv : forall (f:Z -> angle) (i:Z) (j:Z), ((ang_inv (ang_sum f i j)) = (ang_sum (fun (k:Z) => (ang_inv (f k))) i j)). Axiom ang_sum_plus_one_p : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z) (l:Z) (m:Z) (r:angle), ((i + 1%Z)%Z < j)%Z -> (l = (i + 1%Z)%Z) -> (m = j) -> ((g i) = r) -> (forall (k:Z), (((i + 1%Z)%Z <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ang_add r (ang_sum f l m)) = (ang_sum g i j)). Axiom vang_sum_plus_one_p : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z) (l:Z) (m:Z) (r:angle), ((i + 1%Z)%Z < j)%Z -> (l = (i + 1%Z)%Z) -> (m = j) -> ((g i) = r) -> (forall (k:Z), (((i + 1%Z)%Z <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((infix_asdt (ang_exp r) (ang_exp (ang_sum f l m))) = (ang_exp (ang_sum g i j))). Axiom vang_sum_plus_one_rev : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z) (l:Z) (m:Z) (r:angle), ((i + 1%Z)%Z < j)%Z -> (l = (i + 1%Z)%Z) -> (m = j) -> ((g i) = r) -> (forall (k:Z), (((i + 1%Z)%Z <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ang_exp (ang_sum g i j)) = (infix_asdt (ang_exp r) (ang_exp (ang_sum f l m)))). Axiom ang_sum_right_extension_p : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z) (l:Z) (m:Z) (r:angle), ((i + 1%Z)%Z < j)%Z -> (m = (j - 1%Z)%Z) -> (l = i) -> ((g (j - 1%Z)%Z) = r) -> (forall (k:Z), ((i <= k)%Z /\ (k < (j - 1%Z)%Z)%Z) -> ((f k) = (g k))) -> ((ang_add (ang_sum f l m) r) = (ang_sum g i j)). Axiom vang_sum_right_extension_p : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z) (l:Z) (m:Z) (r:angle), ((i + 1%Z)%Z < j)%Z -> (m = (j - 1%Z)%Z) -> (l = i) -> ((g (j - 1%Z)%Z) = r) -> (forall (k:Z), ((i <= k)%Z /\ (k < (j - 1%Z)%Z)%Z) -> ((f k) = (g k))) -> ((infix_asdt (ang_exp (ang_sum f l m)) (ang_exp r)) = (ang_exp (ang_sum g i j))). Axiom vang_sum_right_extension_rev : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z) (l:Z) (m:Z) (r:angle), ((i + 1%Z)%Z < j)%Z -> (m = (j - 1%Z)%Z) -> (l = i) -> ((g (j - 1%Z)%Z) = r) -> (forall (k:Z), ((i <= k)%Z /\ (k < (j - 1%Z)%Z)%Z) -> ((f k) = (g k))) -> ((ang_exp (ang_sum g i j)) = (infix_asdt (ang_exp (ang_sum f l m)) (ang_exp r))). Axiom ang_sum_cardzero : forall (f:Z -> angle) (i:Z) (j:Z), (j <= i)%Z -> ((ang_sum f i j) = ang_zero). Axiom ang_sum_eq_gen : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z) (i':Z) (j':Z), (i < j)%Z -> (i = i') -> (j = j') -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ang_sum f i j) = (ang_sum g i' j')). Axiom ang_sum_sum_eq_vl : forall (f:Z -> Z -> angle) (g:Z -> Z -> angle) (i:Z) (j:Z) (i':Z) (j':Z) (l:Z) (l':Z), (i < j)%Z -> (j <= l)%Z -> (i = i') -> (j = j') -> (l = l') -> (forall (x:Z) (x':Z), ((i <= x)%Z /\ (x < j)%Z) -> ((x <= x')%Z /\ (x' < l)%Z) -> (((f x) x') = ((g x) x'))) -> ((ang_sum (fun (x:Z) => (ang_sum (f x) x l)) i j) = (ang_sum (fun (x:Z) => (ang_sum (g x) x l')) i' j')). Axiom ang_sum_minus : forall (f:Z -> Z) (i:Z) (j:Z) (n:Z), (n >= 0%Z)%Z -> (i < j)%Z -> ((ang_sum (fun (k:Z) => (int_to_ang (-(f k))%Z n)) i j) = (int_to_ang (-(ind_isum f i j))%Z n)). Axiom multiple_control_as_ang_sum : forall (n:Z), (0%Z < n)%Z -> forall (x:bitvec), ((length x) = n) -> ((forall (j:Z), ((0%Z <= j)%Z /\ (j < n)%Z) -> (((getbv x) j) = 1%Z)) -> (ang_minus_one = (ang_mult_int ang_minus_one (ind_iproduct (getbv x) 0%Z n)))) /\ (~ (forall (j:Z), ((0%Z <= j)%Z /\ (j < n)%Z) -> (((getbv x) j) = 1%Z)) -> (ang_zero = (ang_mult_int ang_minus_one (ind_iproduct (getbv x) 0%Z n)))). Axiom multiple_control_as_ang_sum_rev : forall (n:Z), (0%Z < n)%Z -> forall (x:bitvec), ((length x) = n) -> ((forall (j:Z), ((0%Z <= j)%Z /\ (j < n)%Z) -> (((getbv x) j) = 1%Z)) -> ((ang_mult_int ang_minus_one (ind_iproduct (getbv x) 0%Z n)) = ang_minus_one)) /\ (~ (forall (j:Z), ((0%Z <= j)%Z /\ (j < n)%Z) -> (((getbv x) j) = 1%Z)) -> ((ang_mult_int ang_minus_one (ind_iproduct (getbv x) 0%Z n)) = ang_zero)). Axiom ang_sum_map : forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t:Z -> angle), (i < j)%Z -> (p_bijective f (to_fset i j) (to_fset k l)) -> ((ang_sum t k l) = (ang_sum (fun (b:Z) => (t (f b))) i j)). Axiom ang_sum_break : forall (f:Z -> angle) (i:Z) (j:Z) (y:Z), ((i <= y)%Z /\ (y <= j)%Z) -> ((ang_sum f i j) = (ang_add (ang_sum f i y) (ang_sum f y j))). Axiom ang_sum_break_zero_l : forall (f:Z -> angle) (i:Z) (j:Z) (y:Z), ((i <= y)%Z /\ (y <= j)%Z) -> (forall (k:Z), ((i <= k)%Z /\ (k < y)%Z) -> ((f k) = ang_zero)) -> ((ang_sum f y j) = (ang_sum f i j)). Axiom ang_sum_break_zero_lg : forall (f:Z -> angle) (g:Z -> angle) (i:Z) (j:Z) (y:Z), ((i <= y)%Z /\ (y <= j)%Z) -> (forall (k:Z), ((i <= k)%Z /\ (k < y)%Z) -> ((f k) = ang_zero)) -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> ((ang_sum f y j) = (ang_sum g i j)). Axiom ang_sum_break_zero_lg_params : forall (f:bitvec -> bitvec -> Z -> Z -> angle) (g:bitvec -> bitvec -> Z -> Z -> angle) (i:Z) (j:Z) (s:Z) (r:Z), (s >= 0%Z)%Z -> (r >= 0%Z)%Z -> (forall (x:bitvec) (z:bitvec), forall (a:Z) (k:Z), ((length x) = s) -> ((length z) = r) -> ((i <= a)%Z /\ (a < j)%Z) -> ((i <= k)%Z /\ (k < a)%Z) -> (((((g x) z) a) k) = ang_zero)) -> (forall (x:bitvec) (z:bitvec), forall (a:Z) (k:Z), ((length x) = s) -> ((length z) = r) -> ((i <= a)%Z /\ (a < j)%Z) -> ((a <= k)%Z /\ (k < j)%Z) -> (((((f x) z) a) k) = ((((g x) z) a) k))) -> forall (x:bitvec) (z:bitvec), forall (a:Z), ((length x) = s) -> ((length z) = r) -> ((i <= a)%Z /\ (a < j)%Z) -> ((ang_sum (fun (k:Z) => ((((f x) z) a) k)) a j) = (ang_sum (fun (k:Z) => ((((g x) z) a) k)) i j)). Axiom ang_sum_break_zero_l_params : forall {a:Type} {a_WT:WhyType a}, forall (f:a -> a -> Z -> angle) (g:a -> a -> Z -> angle) (i:Z) (j:Z) (l:Z), ((i <= l)%Z /\ (l <= j)%Z) -> forall (x:a) (y:a), (forall (k:Z), ((i <= k)%Z /\ (k < l)%Z) -> ((((f x) y) k) = ang_zero)) -> (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((((f x) y) k) = (((g x) y) k))) -> ((ang_sum ((g x) y) i j) = (ang_sum ((f x) y) l j)). Axiom ang_sum_break_param : forall (f:Z -> Z -> angle) (i:Z) (j:Z), (i < j)%Z -> forall (y:Z), ((i <= y)%Z /\ (y < j)%Z) -> ((ang_sum (f y) i j) = (ang_add (ang_sum (f y) i y) (ang_sum (f y) y j))). Axiom ang_sum_neutral_param_r : forall (f:Z -> Z -> angle) (i:Z) (j:Z), (i < j)%Z -> forall (y:Z), ((i <= y)%Z /\ (y < j)%Z) -> (forall (k:Z), ((y <= k)%Z /\ (k < j)%Z) -> (((f y) k) = ang_zero)) -> ((ang_sum (f y) y j) = ang_zero). Axiom ang_sum_neutral_param_l : forall (f:Z -> Z -> angle) (i:Z) (j:Z), (i < j)%Z -> forall (y:Z), ((i <= y)%Z /\ (y < j)%Z) -> (forall (k:Z), ((i <= k)%Z /\ (k < y)%Z) -> (((f y) k) = ang_zero)) -> ((ang_sum (f y) i y) = ang_zero). Axiom ang_sum_transl : forall (f:Z -> angle) (i:Z) (j:Z) (k:Z), (i < j)%Z -> ((ang_sum f i j) = (ang_sum (fun (b:Z) => (f (b + k)%Z)) (i - k)%Z (j - k)%Z)). Axiom ang_sum_transl_one : forall (f:Z -> angle) (i:Z) (j:Z), (i < j)%Z -> ((ang_sum f i j) = (ang_sum (fun (b:Z) => (f (b - 1%Z)%Z)) (i + 1%Z)%Z (j + 1%Z)%Z)). Axiom ang_sum_to_ind_isum : forall (f:Z -> Z) (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> (i < j)%Z -> ((ang_sum (fun (k:Z) => (int_to_ang (f k) n)) i j) = (int_to_ang (ind_isum f i j) n)). Axiom ind_isum_to_d_sum : forall (f:Z -> Z) (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> (i < j)%Z -> ((int_to_ang (ind_isum f i j) n) = (ang_sum (fun (k:Z) => (int_to_ang (f k) n)) i j)). Axiom ang_sum_int_decomp : forall (bvx:Z -> Z) (k:Z) (n:Z), (0%Z < n)%Z -> (binary bvx) -> ((ang_sum (fun (x:Z) => (int_to_ang (((bvx x) * (power_ 2%Z ((n - x)%Z - 1%Z)%Z))%Z * k)%Z n)) 0%Z n) = (int_to_ang ((bin_to_int bvx n) * k)%Z n)). Axiom ang_sum_int_decomp_gen : forall (bvx:Z -> Z) (n:Z), (0%Z < n)%Z -> (binary bvx) -> forall (k:Z), ((ang_sum (fun (x:Z) => (int_to_ang (((bvx x) * (power_ 2%Z ((n - x)%Z - 1%Z)%Z))%Z * k)%Z n)) 0%Z n) = (int_to_ang ((bin_to_int bvx n) * k)%Z n)). Axiom ang_sum_bv_to_int : forall (n:Z), (0%Z < n)%Z -> forall (x:bitvec), forall (k:Z), ((length x) = n) -> ((ang_sum (fun (i:Z) => (int_to_ang ((((getbv x) i) * (power_ 2%Z ((n - i)%Z - 1%Z)%Z))%Z * k)%Z n)) 0%Z n) = (int_to_ang ((bv_to_int x) * k)%Z n)). Axiom ang_sum_bv_to_int_ : forall (n:Z), (0%Z < n)%Z -> forall (x:bitvec), forall (k:Z), ((length x) = n) -> ((ang_sum (fun (i:Z) => (int_to_ang ((((getbv x) i) * (power_ 2%Z ((n - i)%Z - 1%Z)%Z))%Z * k)%Z n)) 0%Z n) = (int_to_ang ((bv_to_int x) * k)%Z n)). Axiom ang_sum_int_decomp_gen_rev : forall (bvx:Z -> Z) (n:Z), (0%Z < n)%Z -> (binary bvx) -> forall (k:Z), ((int_to_ang ((bin_to_int bvx n) * k)%Z n) = (ang_sum (fun (x:Z) => (int_to_ang (((bvx x) * (power_ 2%Z ((n - x)%Z - 1%Z)%Z))%Z * k)%Z n)) 0%Z n)). Axiom sum_ang_mult_int_e : forall (o:angle) (f:Z -> Z) (l:Z) (h:Z), (l < h)%Z -> ((ang_sum (fun (i:Z) => (ang_mult_int o (f i))) l h) = (ang_mult_int o (ind_isum f l h))). Axiom real_to_ang_sum : forall (phi:Z -> complex) (l:Z) (h:Z), (l < h)%Z -> (forall (i:Z), ((l <= i)%Z /\ (i < h)%Z) -> real_ (phi i)) -> ((ang_sum (fun (i:Z) => (real_to_ang (phi i))) l h) = (real_to_ang (ind_sum phi l h))). Axiom real_to_ang_sum_int : forall (f:Z -> Z) (l:Z) (h:Z) (x:complex), (l < h)%Z -> (real_ x) -> ((ang_sum (fun (i:Z) => (real_to_ang (infix_asdt x (i_to_c (f i))))) l h) = (real_to_ang (infix_asdt x (i_to_c (ind_isum f l h))))). Axiom real_to_ang_sum_int_gen : forall (f:Z -> Z) (l:Z) (h:Z), (l < h)%Z -> forall (x:complex), (real_ x) -> ((ang_sum (fun (i:Z) => (real_to_ang (infix_asdt x (i_to_c (f i))))) l h) = (real_to_ang (infix_asdt x (i_to_c (ind_isum f l h))))). Axiom real_to_ang_bv_inversion : forall (ft:Z) (x:complex) (y:bitvec), (0%Z < ft)%Z -> (real_ x) -> ((length y) = ft) -> ((ang_sum (fun (i:Z) => (real_to_ang (infix_asdt (infix_asdt x (i_to_c (power_ 2%Z i))) (i_to_c ((getbv y) i))))) 0%Z ft) = (real_to_ang (infix_asdt x (i_to_c (bv_to_int (bv_inversion y)))))). Axiom sum_ang_mult_int : forall (f:Z -> angle) (i:Z) (l:Z) (h:Z), (l < h)%Z -> ((ang_sum (fun (x:Z) => (ang_mult_int (f x) i)) l h) = (ang_mult_int (ang_sum f l h) i)). Axiom ang_sum_bv_to_int_inversion_pre : forall (n:Z) (x:bitvec), (0%Z < n)%Z -> ((length x) = n) -> forall (theta:complex), (real_ theta) -> ((real_to_ang (infix_asdt theta (i_to_c (bv_to_int (bv_inversion x))))) = (ang_sum (fun (i:Z) => (real_to_ang (infix_asdt (infix_asdt theta (i_to_c (power_ 2%Z i))) (i_to_c ((getbv x) i))))) 0%Z n)). Axiom ang_sum_bv_to_int_inversion : forall (n:Z), (0%Z < n)%Z -> forall (x:bitvec), forall (theta:complex), ((length x) = n) -> (real_ theta) -> ((real_to_ang (infix_asdt theta (i_to_c (bv_to_int (bv_inversion x))))) = (ang_sum (fun (i:Z) => (real_to_ang (infix_asdt (infix_asdt theta (i_to_c (power_ 2%Z i))) (i_to_c ((getbv x) i))))) 0%Z n)). Axiom ang_sum_bv_to_int_opp_pre : forall (n:Z) (x:bitvec), (0%Z < n)%Z -> ((length x) = n) -> forall (theta:complex), (real_ theta) -> ((real_to_ang (infix_asdt theta (i_to_c (-(bv_to_int x))%Z))) = (ang_sum (fun (i:Z) => (real_to_ang (infix_asdt (infix_asdt theta (i_to_c (power_ 2%Z ((n - i)%Z - 1%Z)%Z))) (i_to_c (-((getbv x) i))%Z)))) 0%Z n)). Axiom ang_sum_bv_to_int_opp : forall (n:Z), (0%Z < n)%Z -> forall (x:bitvec), forall (theta:complex), ((length x) = n) -> (real_ theta) -> ((real_to_ang (infix_asdt theta (i_to_c (-(bv_to_int x))%Z))) = (ang_sum (fun (i:Z) => (real_to_ang (infix_asdt (infix_asdt theta (i_to_c (power_ 2%Z ((n - i)%Z - 1%Z)%Z))) (i_to_c (-((getbv x) i))%Z)))) 0%Z n)). Axiom ang_sum_bv_to_int_mult_pre : forall (n:Z) (x:bitvec), (0%Z < n)%Z -> ((length x) = n) -> forall (theta:complex), (real_ theta) -> ((real_to_ang (infix_asdt theta (i_to_c (bv_to_int x)))) = (ang_sum (fun (i:Z) => (real_to_ang (infix_asdt (infix_asdt theta (i_to_c (power_ 2%Z ((n - i)%Z - 1%Z)%Z))) (i_to_c ((getbv x) i))))) 0%Z n)). Axiom ang_sum_bv_to_int_mult : forall (n:Z), (0%Z < n)%Z -> forall (x:bitvec), forall (theta:complex), ((length x) = n) -> (real_ theta) -> ((real_to_ang (infix_asdt theta (i_to_c (bv_to_int x)))) = (ang_sum (fun (i:Z) => (real_to_ang (infix_asdt (infix_asdt theta (i_to_c (power_ 2%Z ((n - i)%Z - 1%Z)%Z))) (i_to_c ((getbv x) i))))) 0%Z n)). Axiom rewrite_ang_sum_sum_to_bv_and_inversion : forall (n:Z) (x:bitvec) (y:bitvec), (0%Z < n)%Z -> ((length x) = n) -> ((length y) = n) -> ((ang_sum (fun (j:Z) => (ang_sum (fun (i:Z) => (int_to_ang (((-((getbv x) i))%Z * ((getbv y) j))%Z * (power_ 2%Z (((n - i)%Z - 1%Z)%Z + j)%Z))%Z n)) j n)) 0%Z n) = (real_to_ang (infix_sldt (infix_asdt (i_to_c (-(bv_to_int x))%Z) (i_to_c (bv_to_int (bv_inversion y)))) (i_to_c (power_ 2%Z n))))). Axiom rewrite_ang_sum_sum_to_bv_and_inversion_gen : forall (n:Z), (0%Z < n)%Z -> forall (x:bitvec) (y:bitvec), ((length x) = n) -> ((length y) = n) -> ((ang_sum (fun (j:Z) => (ang_sum (fun (i:Z) => (int_to_ang (((-((getbv x) i))%Z * ((getbv y) j))%Z * (power_ 2%Z (((n - i)%Z - 1%Z)%Z + j)%Z))%Z n)) j n)) 0%Z n) = (real_to_ang (infix_asdt (infix_asdt (i_to_c (-(bv_to_int x))%Z) (i_to_c (bv_to_int (bv_inversion y)))) (pow_inv_2 n)))). Axiom int_to_ang_by_sum_mult_break : forall (n:Z) (x:bitvec) (y:bitvec), (0%Z < n)%Z -> ((length x) = n) -> ((length y) = n) -> ((int_to_ang (ind_isum (fun (j:Z) => (ind_isum (fun (i:Z) => ((((getbv x) i) * ((getbv y) j))%Z * (power_ 2%Z (((n - i)%Z - 1%Z)%Z + j)%Z))%Z) j n)) 0%Z n) n) = (int_to_ang ((bv_to_int x) * (bv_to_int (bv_inversion y)))%Z n)). Axiom int_to_ang_by_sum_mult_break_gen : forall (n:Z), (0%Z < n)%Z -> forall (x:bitvec) (y:bitvec), ((length x) = n) -> ((length y) = n) -> ((int_to_ang (ind_isum (fun (j:Z) => (ind_isum (fun (i:Z) => ((((getbv x) i) * ((getbv y) j))%Z * (power_ 2%Z (((n - i)%Z - 1%Z)%Z + j)%Z))%Z) j n)) 0%Z n) n) = (int_to_ang ((bv_to_int x) * (bv_to_int (bv_inversion y)))%Z n)). Axiom int_to_ang_by_sum_mult_break_neg : forall (n:Z), (0%Z < n)%Z -> forall (x:bitvec) (y:bitvec), ((length x) = n) -> ((length y) = n) -> ((int_to_ang (ind_isum (fun (j:Z) => (-(ind_isum (fun (i:Z) => ((((getbv x) i) * ((getbv y) j))%Z * (power_ 2%Z (((n - i)%Z - 1%Z)%Z + j)%Z))%Z) j n))%Z) 0%Z n) n) = (int_to_ang ((-(bv_to_int x))%Z * (bv_to_int (bv_inversion y)))%Z n)). Parameter bv_check_zero: bitvec -> angle. Axiom bv_check_zero_def : forall (x:bitvec), ((length x) = 0%Z) -> ((bv_check_zero x) = ang_minus_one). Axiom bv_check_zero_def1 : forall (x:bitvec), ~ ((length x) = 0%Z) -> ((length x) = 1%Z) -> (((getbv x) 0%Z) = 1%Z) -> ((bv_check_zero x) = ang_minus_one). Axiom bv_check_zero_def2 : forall (x:bitvec), ~ ((length x) = 0%Z) -> ((length x) = 1%Z) -> ~ (((getbv x) 0%Z) = 1%Z) -> ((bv_check_zero x) = ang_zero). Axiom bv_check_zero_def3 : forall (x:bitvec), ~ ((length x) = 0%Z) -> ~ ((length x) = 1%Z) -> (((getbv x) 0%Z) = 1%Z) -> ((bv_check_zero x) = (bv_check_zero (tpart x 1%Z))). Axiom bv_check_zero_def4 : forall (x:bitvec), ~ ((length x) = 0%Z) -> ~ ((length x) = 1%Z) -> ~ (((getbv x) 0%Z) = 1%Z) -> ((bv_check_zero x) = ang_zero). Axiom bv_check_zero_spec : forall (x:bitvec), ((forall (j:Z), ((0%Z <= j)%Z /\ (j < (length x))%Z) -> (((getbv x) j) = 1%Z)) -> ((bv_check_zero x) = ang_minus_one)) /\ (~ (forall (j:Z), ((0%Z <= j)%Z /\ (j < (length x))%Z) -> (((getbv x) j) = 1%Z)) -> ((bv_check_zero x) = ang_zero)). Axiom bv_check_zero_int : forall (i:Z) (n:Z), (0%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((i = ((power_ 2%Z n) - 1%Z)%Z) -> ((bv_check_zero (int_to_bv i n)) = ang_minus_one)) /\ (~ (i = ((power_ 2%Z n) - 1%Z)%Z) -> ((bv_check_zero (int_to_bv i n)) = ang_zero)). Axiom bv_check_zero_plus_one : forall (x:bitvec), (1%Z < (length x))%Z -> ((((getbv x) 0%Z) = 1%Z) -> ((bv_check_zero x) = (bv_check_zero (tpart x 1%Z)))) /\ (~ (((getbv x) 0%Z) = 1%Z) -> ((bv_check_zero x) = ang_zero)). Axiom bv_check_zero_two : forall (x:bitvec), ((length x) = 2%Z) -> (((((getbv x) 0%Z) = ((getbv x) 1%Z)) /\ (((getbv x) 1%Z) = 1%Z)) -> ((bv_check_zero x) = ang_minus_one)) /\ (~ ((((getbv x) 0%Z) = ((getbv x) 1%Z)) /\ (((getbv x) 1%Z) = 1%Z)) -> ((bv_check_zero x) = ang_zero)). Axiom sum_ket_zero : forall (n:Z), (n >= 0%Z)%Z -> forall (y:bitvec), ((ang_sum (fun (i:Z) => (int_to_ang (((getbv (ket_to_bv (ket n 0%Z))) i) * ((getbv y) i))%Z 1%Z)) 0%Z n) = ang_zero). Parameter repeat_pps_had: Z -> pps. Axiom repeat_pps_had_def : forall (n:Z), (n >= 1%Z)%Z -> (n = 1%Z) -> ((repeat_pps_had n) = pps_hadamard). Axiom repeat_pps_had_def1 : forall (n:Z), (n >= 1%Z)%Z -> ~ (n = 1%Z) -> ((repeat_pps_had n) = (pps_par (repeat_pps_had (n - 1%Z)%Z) pps_hadamard)). Axiom repeat_pps_had_spec : forall (n:Z), (n >= 1%Z)%Z -> ((h_width (repeat_pps_had n)) = n). Axiom repeat_pps_had_spec1 : forall (n:Z), (n >= 1%Z)%Z -> ((h_range (repeat_pps_had n)) = n). Axiom repeat_pps_had_spec2 : forall (n:Z), (n >= 1%Z)%Z -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((((h_basis_ket (repeat_pps_had n)) x) y) i) = (y i)). Parameter fc23: (Z -> Z) -> (Z -> Z) -> Z -> angle. Axiom fc_def23 : forall (x:Z -> Z) (y:Z -> Z) (i:Z), ((((x i) = (y i)) /\ ((y i) = 1%Z)) -> (((fc23 x y) i) = (int_to_ang 1%Z 1%Z))) /\ (~ (((x i) = (y i)) /\ ((y i) = 1%Z)) -> (((fc23 x y) i) = (int_to_ang 0%Z 1%Z))). Axiom repeat_pps_had_spec3 : forall (n:Z), (n >= 1%Z)%Z -> forall (x:Z -> Z) (y:Z -> Z), ((((h_angle (repeat_pps_had n)) x) y) = (ang_sum (fc23 x y) 0%Z n)). Parameter kron_had_coeffs: Z -> Z -> Z -> complex. Axiom kron_had_coeffs_def : forall (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> ((kron_had_coeffs n i j) = (infix_asdt (pow_inv_sqrt_2 n) (cpower (prefix_mndt c_one) (ind_isum (fun (k:Z) => (((getbv (int_to_bv i n)) k) * ((getbv (int_to_bv j n)) k))%Z) 0%Z n)))). Parameter superposition_state: Z -> matrix complex. Axiom superposition_state_def : forall (n:Z), (n >= 1%Z)%Z -> ((superposition_state n) = (pps_apply (repeat_pps_had n) (ket n 0%Z))). Axiom superposition_state_spec : forall (n:Z), (n >= 1%Z)%Z -> ((superposition_state n) = (infix_asdtdt (pow_inv_sqrt_2 n) (ket_sum_l (n_bvs n) (fun (y0:bitvec) => (bv_to_ket y0)) n))). Axiom superposition_state_spec1 : forall (n:Z), (n >= 1%Z)%Z -> ((superposition_state n) = (infix_asdtdt (pow_inv_sqrt_2 n) (ket_sum_l (to_fset 0%Z (power_ 2%Z n)) ((fun (y0:Z) (y1:Z) => (ket y0 y1)) n) n))). Axiom superposition_state_spec2 : forall (n:Z), (n >= 1%Z)%Z -> is_a_ket_l (superposition_state n) n. Axiom get_ket_superposition : forall (n:Z) (i:Z), (1%Z <= n)%Z -> ((0%Z <= i)%Z /\ (i < (power_ 2%Z n))%Z) -> ((get_ket (superposition_state n) i) = (infix_sldt c_one (square_rt (i_to_c (power_ 2%Z n))))). Axiom repeat_had_twice_bv : forall (n:Z) (x:bitvec), (n >= 1%Z)%Z -> ((length x) = n) -> ((pps_apply (repeat_pps_had n) (pps_apply (repeat_pps_had n) (bv_to_ket x))) = (bv_to_ket x)). Axiom repeat_had_twice_bv_gen : forall (n:Z), (n >= 1%Z)%Z -> forall (x:bitvec), ((length x) = n) -> ((pps_apply (repeat_pps_had n) (pps_apply (repeat_pps_had n) (bv_to_ket x))) = (bv_to_ket x)). Axiom repeat_had_twice_ket : forall (n:Z), (n >= 1%Z)%Z -> forall (x:matrix complex), (is_a_ket_l x n) -> ((pps_apply (repeat_pps_had n) (pps_apply (repeat_pps_had n) x)) = x). Axiom repeat_had_superposition : forall (n:Z), (n >= 1%Z)%Z -> ((pps_apply (repeat_pps_had n) (superposition_state n)) = (ket n 0%Z)). Axiom path_sem_repeat_at_zero_bv : forall (n:Z) (x:bitvec), (n >= 1%Z)%Z -> ((length x) = n) -> ((get_ket (pps_apply (repeat_pps_had n) (bv_to_ket x)) 0%Z) = (pow_inv_sqrt_2 n)). Axiom path_sem_repeat_at_zero : forall (n:Z) (x:matrix complex), (n >= 1%Z)%Z -> (is_a_ket_l x n) -> ((get_ket (pps_apply (repeat_pps_had n) x) 0%Z) = (infix_asdt (pow_inv_sqrt_2 n) (ind_sum ((fun (y0:matrix complex) (y1:Z) => (get_ket y0 y1)) x) 0%Z (power_ 2%Z n)))). Axiom ket_sum_power_minus_one : forall (f:bitvec -> Z) (g:bitvec -> bitvec -> Z) (n:Z), (n >= 0%Z)%Z -> ((ket_sum_l (n_bvs n) (fun (x:bitvec) => (infix_asdtdt (cpower (prefix_mndt c_one) (f x)) (ket_sum_l (n_bvs n) (fun (y:bitvec) => (infix_asdtdt (cpower (prefix_mndt c_one) ((g x) y)) (bv_to_ket y))) n))) n) = (ket_sum_l (n_bvs n) (fun (y:bitvec) => (infix_asdtdt (sum (n_bvs n) (fun (x:bitvec) => (cpower (prefix_mndt c_one) (((g x) y) + (f x))%Z))) (bv_to_ket y))) n)). Axiom path_sem_hadamard_zero : forall (x:matrix complex), (x = (qbit_zero tt)) -> ((path_sem hadamard x) = (qbit_plus tt)). Axiom path_sem_hadamard_one : forall (x:matrix complex), (x = (qbit_one tt)) -> ((path_sem hadamard x) = (qbit_minus tt)). Axiom path_sem_hadamard_plus : forall (x:matrix complex), (x = (qbit_plus tt)) -> ((path_sem hadamard x) = (qbit_zero tt)). Axiom path_sem_hadamard_minus : forall (x:matrix complex), (x = (qbit_minus tt)) -> ((path_sem hadamard x) = (qbit_one tt)). Axiom path_sem_cnot_basis : forall (x:matrix complex), (is_a_ket_l x 2%Z) -> (is_a_ket_basis_elt x) -> (((ket_to_int x) = 0%Z) -> ((path_sem cnot x) = (ket 2%Z 0%Z))) /\ (~ ((ket_to_int x) = 0%Z) -> (((ket_to_int x) = 1%Z) -> ((path_sem cnot x) = (ket 2%Z 1%Z))) /\ (~ ((ket_to_int x) = 1%Z) -> (((ket_to_int x) = 2%Z) -> ((path_sem cnot x) = (ket 2%Z 3%Z))) /\ (~ ((ket_to_int x) = 2%Z) -> ((path_sem cnot x) = (ket 2%Z 2%Z))))). Axiom path_sem_swap_basis : forall (x:matrix complex), (is_a_ket_l x 2%Z) -> (is_a_ket_basis_elt x) -> (((ket_to_int x) = 0%Z) -> ((path_sem swap x) = (ket 2%Z 0%Z))) /\ (~ ((ket_to_int x) = 0%Z) -> (((ket_to_int x) = 1%Z) -> ((path_sem swap x) = (ket 2%Z 2%Z))) /\ (~ ((ket_to_int x) = 1%Z) -> (((ket_to_int x) = 2%Z) -> ((path_sem swap x) = (ket 2%Z 1%Z))) /\ (~ ((ket_to_int x) = 2%Z) -> ((path_sem swap x) = (ket 2%Z 3%Z))))). Axiom hadamard_invol : forall (x:matrix complex), (is_a_ket_l x 1%Z) -> ((path_sem hadamard (path_sem hadamard x)) = x). Parameter ancilla_g: circuit -> ((matrix complex) -> matrix complex) -> circuit. Axiom ancilla_g_spec : forall (c:circuit) (path_sem_target:(matrix complex) -> matrix complex), (2%Z <= (width c))%Z -> (forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((ancillas (ancilla_g c path_sem_target)) = ((ancillas c) + 1%Z)%Z). Axiom ancilla_g_spec1 : forall (c:circuit) (path_sem_target:(matrix complex) -> matrix complex), (2%Z <= (width c))%Z -> (forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((size (ancilla_g c path_sem_target)) = (size c)). Axiom ancilla_g_spec2 : forall (c:circuit) (path_sem_target:(matrix complex) -> matrix complex), (2%Z <= (width c))%Z -> (forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((range (ancilla_g c path_sem_target)) = (range c)). Axiom ancilla_g_spec3 : forall (c:circuit) (path_sem_target:(matrix complex) -> matrix complex), (2%Z <= (width c))%Z -> (forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((width (ancilla_g c path_sem_target)) = ((width c) - 1%Z)%Z). Parameter fc24: circuit -> (Z -> Z) -> Z -> Z. Axiom fc_def24 : forall (c:circuit) (x:Z -> Z) (k:Z), ((k = ((width c) - 1%Z)%Z) -> (((fc24 c x) k) = 0%Z)) /\ (~ (k = ((width c) - 1%Z)%Z) -> (((fc24 c x) k) = (x k))). Axiom ancilla_g_spec4 : forall (c:circuit) (path_sem_target:(matrix complex) -> matrix complex), (2%Z <= (width c))%Z -> (forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((basis_ket (ancilla_g c path_sem_target) x y i) = (basis_ket c (fc24 c x) y i)). Parameter fc25: circuit -> (Z -> Z) -> Z -> Z. Axiom fc_def25 : forall (c:circuit) (x:Z -> Z) (k:Z), ((k = ((width c) - 1%Z)%Z) -> (((fc25 c x) k) = 0%Z)) /\ (~ (k = ((width c) - 1%Z)%Z) -> (((fc25 c x) k) = (x k))). Axiom ancilla_g_spec5 : forall (c:circuit) (path_sem_target:(matrix complex) -> matrix complex), (2%Z <= (width c))%Z -> (forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> forall (x:Z -> Z) (y:Z -> Z), ((ang_ind (ancilla_g c path_sem_target) x y) = (ang_ind c (fc25 c x) y)). Axiom ancilla_g_spec6 : forall (c:circuit) (path_sem_target:(matrix complex) -> matrix complex), (2%Z <= (width c))%Z -> (forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> forall (x:matrix complex), (is_a_ket_l x (width (ancilla_g c path_sem_target))) -> ((kronecker (path_sem (ancilla_g c path_sem_target) x) (ket 1%Z 0%Z)) = (path_sem c (kronecker x (ket 1%Z 0%Z)))). Axiom ancilla_g_spec7 : forall (c:circuit) (path_sem_target:(matrix complex) -> matrix complex), (2%Z <= (width c))%Z -> (forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> forall (x:matrix complex), (is_a_ket_l x (width (ancilla_g c path_sem_target))) -> ((path_sem (ancilla_g c path_sem_target) x) = (path_sem_target x)). Parameter ancilla_ket: circuit -> Z -> Z -> circuit. Axiom ancilla_ket_spec : forall (c:circuit) (k:Z) (n:Z), ((width c) = n) -> ((0%Z < k)%Z /\ (k < n)%Z) -> (forall (x:matrix complex), (is_a_ket_l x (n - k)%Z) -> (is_a_ket_basis_elt x) -> exists y:matrix complex, ((path_sem c (kronecker x (ket 0%Z k))) = (kronecker y (ket 0%Z k)))) -> ((ancillas (ancilla_ket c k n)) = (k + (ancillas c))%Z). Axiom ancilla_ket_spec1 : forall (c:circuit) (k:Z) (n:Z), ((width c) = n) -> ((0%Z < k)%Z /\ (k < n)%Z) -> (forall (x:matrix complex), (is_a_ket_l x (n - k)%Z) -> (is_a_ket_basis_elt x) -> exists y:matrix complex, ((path_sem c (kronecker x (ket 0%Z k))) = (kronecker y (ket 0%Z k)))) -> ((size (ancilla_ket c k n)) = (size c)). Axiom ancilla_ket_spec2 : forall (c:circuit) (k:Z) (n:Z), ((width c) = n) -> ((0%Z < k)%Z /\ (k < n)%Z) -> (forall (x:matrix complex), (is_a_ket_l x (n - k)%Z) -> (is_a_ket_basis_elt x) -> exists y:matrix complex, ((path_sem c (kronecker x (ket 0%Z k))) = (kronecker y (ket 0%Z k)))) -> forall (x:matrix complex) (y:matrix complex), (is_a_ket_l x (n - k)%Z) -> ((path_sem c (kronecker x (ket k 0%Z))) = (kronecker y (ket k 0%Z))) -> ((path_sem (ancilla_ket c k n) x) = y). Axiom ancilla_ket_spec3 : forall (c:circuit) (k:Z) (n:Z), ((width c) = n) -> ((0%Z < k)%Z /\ (k < n)%Z) -> (forall (x:matrix complex), (is_a_ket_l x (n - k)%Z) -> (is_a_ket_basis_elt x) -> exists y:matrix complex, ((path_sem c (kronecker x (ket 0%Z k))) = (kronecker y (ket 0%Z k)))) -> ((width (ancilla_ket c k n)) = (n - k)%Z). Axiom correct_seq : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((width c) = (width c')) -> ((h_width h'') = (width c)) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z)) i))) -> correct_path_sum (sequence c c') h''. Axiom correct_par : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((h_width h'') = ((width c) + (width c'))%Z) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h) x) y) i))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> (((h_width h) <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z)) (i - (h_width h))%Z))) -> correct_path_sum (parallel c c') h''. Parameter sequence_ghost_pps: circuit -> circuit -> pps -> pps -> pps -> circuit. Axiom sequence_ghost_pps_def : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((width c) = (width c')) -> ((h_width h'') = (width c)) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z)) i))) -> ((sequence_ghost_pps c c' h h' h'') = (sequence c c')). Axiom sequence_ghost_pps_spec : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((width c) = (width c')) -> ((h_width h'') = (width c)) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z)) i))) -> ((width (sequence_ghost_pps c c' h h' h'')) = (width c)). Axiom sequence_ghost_pps_spec1 : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((width c) = (width c')) -> ((h_width h'') = (width c)) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z)) i))) -> ((size (sequence_ghost_pps c c' h h' h'')) = ((size c) + (size c'))%Z). Axiom sequence_ghost_pps_spec2 : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((width c) = (width c')) -> ((h_width h'') = (width c)) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z)) i))) -> ((ancillas (sequence_ghost_pps c c' h h' h'')) = (ZArith.BinInt.Z.max (ancillas c) (ancillas c'))). Axiom sequence_ghost_pps_spec3 : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((width c) = (width c')) -> ((h_width h'') = (width c)) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') (((h_basis_ket h) x) y)) fun (k:Z) => (y (k + (h_range h))%Z)) i))) -> correct_path_sum (sequence_ghost_pps c c' h h' h'') h''. Parameter parallel_ghost_pps: circuit -> circuit -> pps -> pps -> pps -> circuit. Axiom parallel_ghost_pps_def : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((h_width h'') = ((width c) + (width c'))%Z) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h) x) y) i))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> (((h_width h) <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z)) (i - (h_width h))%Z))) -> ((parallel_ghost_pps c c' h h' h'') = (parallel c c')). Axiom parallel_ghost_pps_spec : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((h_width h'') = ((width c) + (width c'))%Z) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h) x) y) i))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> (((h_width h) <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z)) (i - (h_width h))%Z))) -> correct_path_sum (parallel_ghost_pps c c' h h' h'') h''. Axiom parallel_ghost_pps_spec1 : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((h_width h'') = ((width c) + (width c'))%Z) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h) x) y) i))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> (((h_width h) <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z)) (i - (h_width h))%Z))) -> ((width (parallel_ghost_pps c c' h h' h'')) = ((width c) + (width c'))%Z). Axiom parallel_ghost_pps_spec2 : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((h_width h'') = ((width c) + (width c'))%Z) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h) x) y) i))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> (((h_width h) <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z)) (i - (h_width h))%Z))) -> ((size (parallel_ghost_pps c c' h h' h'')) = ((size c) + (size c'))%Z). Axiom parallel_ghost_pps_spec3 : forall (c:circuit) (c':circuit) (h:pps) (h':pps) (h'':pps), (correct_path_sum c h) -> (correct_path_sum c' h') -> ((h_width h'') = ((width c) + (width c'))%Z) -> ((h_range h'') = ((h_range h) + (h_range h'))%Z) -> (forall (x:Z -> Z) (y:Z -> Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((((h_angle h'') x) y) = (ang_add (((h_angle h) x) y) (((h_angle h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z))))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> ((0%Z <= i)%Z /\ (i < (h_width h))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h) x) y) i))) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h''))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h''))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> (((h_width h) <= i)%Z /\ (i < (h_width h''))%Z) -> (((((h_basis_ket h'') x) y) i) = ((((h_basis_ket h') fun (k:Z) => (x (k + (h_width h))%Z)) fun (k:Z) => (y (k + (h_range h))%Z)) (i - (h_width h))%Z))) -> ((ancillas (parallel_ghost_pps c c' h h' h'')) = ((ancillas c) + (ancillas c'))%Z). Parameter fc26: circuit -> (Z -> Z) -> Z -> Z. Parameter fc27: circuit -> (Z -> Z) -> Z -> Z. Axiom fc_def26 : forall (c:circuit) (x:Z -> Z) (k:Z), ((k = ((width c) - 1%Z)%Z) -> (((fc26 c x) k) = 0%Z)) /\ (~ (k = ((width c) - 1%Z)%Z) -> (((fc26 c x) k) = (x k))). Axiom fc_def27 : forall (c:circuit) (x:Z -> Z) (k:Z), ((k = ((width c) - 1%Z)%Z) -> (((fc27 c x) k) = 0%Z)) /\ (~ (k = ((width c) - 1%Z)%Z) -> (((fc27 c x) k) = (x k))). Axiom correct_ancilla : forall (c:circuit) (h:pps) (h':pps), (2%Z <= (width c))%Z -> (correct_path_sum c h) -> (exists path_sem_target:(matrix complex) -> matrix complex, forall (x:matrix complex), (is_a_ket_l x ((width c) - 1%Z)%Z) -> ((path_sem c (kronecker x (ket 1%Z 0%Z))) = (kronecker (path_sem_target x) (ket 1%Z 0%Z)))) -> ((h_width h') = ((width c) - 1%Z)%Z) -> ((h_range h') = (h_range h)) -> (forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_width h'))%Z) -> (0%Z <= (x j))%Z /\ ((x j) < 2%Z)%Z) -> (forall (j:Z), ((0%Z <= j)%Z /\ (j < (h_range h'))%Z) -> (0%Z <= (y j))%Z /\ ((y j) < 2%Z)%Z) -> (((((h_basis_ket h') x) y) i) = ((((h_basis_ket h) (fc26 c x)) y) i))) -> (forall (x:Z -> Z) (y:Z -> Z), ((((h_angle h') x) y) = (((h_angle h) (fc27 c x)) y))) -> correct_path_sum (ancilla c) h'. Axiom set_correct_main_path_sum : forall (c:circuit) (h:pps), ((h_width h) = (width c)) -> ((h_range h) = (range c)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = (range c)) -> ((((h_angle h) (getbv x)) (getbv y)) = (ang_ind c (getbv x) (getbv y)))) -> (forall (x:bitvec) (y:bitvec), forall (i:Z), ((0%Z <= i)%Z /\ (i < (width c))%Z) -> ((length x) = (width c)) -> ((length y) = (range c)) -> (((((h_basis_ket h) (getbv x)) (getbv y)) i) = (basis_ket c (getbv x) (getbv y) i))) -> correct_path_sum c h. Axiom set_path_sem_by_correct_pps : forall (c:circuit) (h:pps) (x:matrix complex), (correct_path_sum c h) -> (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> ((path_sem c x) = (pps_apply h x)). Axiom set_path_sem_by_main_pps : forall (c:circuit) (x:bitvec), ((length x) = (width c)) -> ((path_sem c (bv_to_ket x)) = (infix_asdtdt (pow_inv_sqrt_2 (range c)) (ket_sum_l (n_bvs (range c)) (fun (y:bitvec) => (infix_asdtdt (ang_exp (ang_ind c (getbv x) (getbv y))) (bv_to_ket (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) c) (getbv x)) (getbv y)) (width c))))) (width c)))). Axiom set_path_sem_by_correct_pps_gen : forall (c:circuit) (h:pps), (correct_path_sum c h) -> forall (x:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> ((path_sem c x) = (pps_apply h x)). Axiom set_correct_pps : forall (c:circuit) (h:pps), ((h_width h) = (width c)) -> (forall (x:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> ((pps_apply h x) = (path_sem_basis c x))) -> correct_path_sum c h. Axiom set_correct_path_sum_sim : forall (c:circuit) (h:pps) (h':pps), ((h_range h) = (h_range h')) -> ((h_width h) = (h_width h')) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = (h_range h)) -> ((((h_angle h) (getbv x)) (getbv y)) = (((h_angle h') (getbv x)) (getbv y)))) -> (forall (x:bitvec) (y:bitvec), forall (i:Z), ((length x) = (width c)) -> ((length y) = (h_range h)) -> ((0%Z <= i)%Z /\ (i < (width c))%Z) -> (((((h_basis_ket h) (getbv x)) (getbv y)) i) = ((((h_basis_ket h') (getbv x)) (getbv y)) i))) -> (correct_path_sum c h) -> correct_path_sum c h'. Axiom path_sum_equiv : forall (c:circuit) (h:pps) (h':pps), ((h_range h) >= 0%Z)%Z -> ((h_range h) = (h_range h')) -> ((h_width h) = (h_width h')) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = (h_range h)) -> ((((h_angle h) (getbv x)) (getbv y)) = (((h_angle h') (getbv x)) (getbv y)))) -> (forall (x:bitvec) (y:bitvec), forall (i:Z), ((0%Z <= i)%Z /\ (i < (width c))%Z) -> ((length x) = (width c)) -> ((length y) = (h_range h)) -> ((((h_basis_ket h) (getbv x)) (getbv y)) = (((h_basis_ket h') (getbv x)) (getbv y)))) -> (correct_path_sum c h) -> correct_path_sum c h'. Axiom path_sum_equiv1 : forall (c:circuit) (h:pps) (h':pps), ((h_range h) >= 0%Z)%Z -> ((h_range h) = (h_range h')) -> ((h_width h) = (h_width h')) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = (h_range h)) -> ((((h_angle h) (getbv x)) (getbv y)) = (((h_angle h') (getbv x)) (getbv y)))) -> (forall (x:bitvec) (y:bitvec), forall (i:Z), ((0%Z <= i)%Z /\ (i < (width c))%Z) -> ((length x) = (width c)) -> ((length y) = (h_range h)) -> ((((h_basis_ket h) (getbv x)) (getbv y)) = (((h_basis_ket h') (getbv x)) (getbv y)))) -> (correct_path_sum c h') -> correct_path_sum c h. Axiom correct_to_path_sem : forall (c:circuit) (h:pps), (correct_path_sum c h) -> forall (x:matrix complex), (is_a_ket_l x (width c)) -> ((pps_apply h x) = (path_sem c x)). Axiom path_sem_to_correct : forall (c:circuit) (h:pps), ((h_width h) = (width c)) -> (forall (x:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_basis_elt x) -> ((pps_apply h x) = (path_sem c x))) -> correct_path_sum c h. Parameter correct_path_sum_bv: circuit -> Z -> (bitvec -> bitvec -> bitvec) -> (bitvec -> bitvec -> angle) -> Prop. Axiom correct_path_sum_bv_spec : forall (c:circuit) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle), (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r) -> ((length ((k x) y)) = (width c))) -> (correct_path_sum_bv c r k a) -> correct_path_sum c (build_pps_bv (width c) r k a). Axiom correct_path_sum_bv_spec1 : forall (c:circuit) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle), (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r) -> ((length ((k x) y)) = (width c))) -> (correct_path_sum c (build_pps_bv (width c) r k a)) -> correct_path_sum_bv c r k a. Axiom correct_path_sum_to_bv : forall (c:circuit) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle), (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r) -> ((length ((k x) y)) = (width c))) -> (correct_path_sum c (build_pps_bv (width c) r k a)) -> correct_path_sum_bv c r k a. Axiom correct_path_sum_by_bv : forall (c:circuit) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle), (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r) -> ((length ((k x) y)) = (width c))) -> (correct_path_sum_bv c r k a) -> correct_path_sum c (build_pps_bv (width c) r k a). Axiom correct_path_sum_bv_main : forall (c:circuit) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle), (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r) -> ((length ((k x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), forall (i:Z), ((length x) = (width c)) -> ((length y) = r) -> ((0%Z <= i)%Z /\ (i < (width c))%Z) -> (((getbv ((k x) y)) i) = (basis_ket c (getbv x) (getbv y) i))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r) -> (((a x) y) = (ang_ind c (getbv x) (getbv y)))) -> (r = (range c)) -> correct_path_sum_bv c r k a. Axiom correct_path_sum_bv_apply : forall (c:circuit) (r:Z) (k:bitvec -> bitvec -> bitvec) (a:bitvec -> bitvec -> angle) (x:bitvec), (forall (x1:bitvec) (y:bitvec), ((length x1) = (width c)) -> ((length y) = r) -> ((length ((k x1) y)) = (width c))) -> ((length x) = (width c)) -> (correct_path_sum_bv c r k a) -> ((path_sem c (bv_to_ket x)) = (infix_asdtdt (pow_inv_sqrt_2 r) (ket_sum_l (n_bvs r) (fun (y:bitvec) => (infix_asdtdt (ang_exp ((a x) y)) (bv_to_ket ((k x) y)))) (width c)))). Parameter seq_pps_bv: circuit -> circuit -> Z -> Z -> Z -> (bitvec -> bitvec -> bitvec) -> (bitvec -> bitvec -> bitvec) -> (bitvec -> bitvec -> bitvec) -> (bitvec -> bitvec -> angle) -> (bitvec -> bitvec -> angle) -> (bitvec -> bitvec -> angle) -> circuit. Axiom seq_pps_bv_spec : forall (c:circuit) (c':circuit) (r1:Z) (r2:Z) (r3:Z) (k1:bitvec -> bitvec -> bitvec) (k2:bitvec -> bitvec -> bitvec) (k3:bitvec -> bitvec -> bitvec) (a1:bitvec -> bitvec -> angle) (a2:bitvec -> bitvec -> angle) (a3:bitvec -> bitvec -> angle), (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r1) -> ((length ((k1 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r2) -> ((length ((k2 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> ((length ((k3 x) y)) = (width c))) -> ((width c) = (width c')) -> (r3 = (r1 + r2)%Z) -> (correct_path_sum_bv c r1 k1 a1) -> (correct_path_sum_bv c' r2 k2 a2) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> (((a3 x) y) = (ang_add ((a1 x) (hpart y r1)) ((a2 ((k1 x) (hpart y r1))) (tpart y r1))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> (((k3 x) y) = ((k2 ((k1 x) (hpart y r1))) (tpart y r1)))) -> ((seq_pps_bv c c' r1 r2 r3 k1 k2 k3 a1 a2 a3) = (sequence c c')). Axiom seq_pps_bv_spec1 : forall (c:circuit) (c':circuit) (r1:Z) (r2:Z) (r3:Z) (k1:bitvec -> bitvec -> bitvec) (k2:bitvec -> bitvec -> bitvec) (k3:bitvec -> bitvec -> bitvec) (a1:bitvec -> bitvec -> angle) (a2:bitvec -> bitvec -> angle) (a3:bitvec -> bitvec -> angle), (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r1) -> ((length ((k1 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r2) -> ((length ((k2 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> ((length ((k3 x) y)) = (width c))) -> ((width c) = (width c')) -> (r3 = (r1 + r2)%Z) -> (correct_path_sum_bv c r1 k1 a1) -> (correct_path_sum_bv c' r2 k2 a2) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> (((a3 x) y) = (ang_add ((a1 x) (hpart y r1)) ((a2 ((k1 x) (hpart y r1))) (tpart y r1))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> (((k3 x) y) = ((k2 ((k1 x) (hpart y r1))) (tpart y r1)))) -> ((width (seq_pps_bv c c' r1 r2 r3 k1 k2 k3 a1 a2 a3)) = (width c)). Axiom seq_pps_bv_spec2 : forall (c:circuit) (c':circuit) (r1:Z) (r2:Z) (r3:Z) (k1:bitvec -> bitvec -> bitvec) (k2:bitvec -> bitvec -> bitvec) (k3:bitvec -> bitvec -> bitvec) (a1:bitvec -> bitvec -> angle) (a2:bitvec -> bitvec -> angle) (a3:bitvec -> bitvec -> angle), (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r1) -> ((length ((k1 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r2) -> ((length ((k2 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> ((length ((k3 x) y)) = (width c))) -> ((width c) = (width c')) -> (r3 = (r1 + r2)%Z) -> (correct_path_sum_bv c r1 k1 a1) -> (correct_path_sum_bv c' r2 k2 a2) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> (((a3 x) y) = (ang_add ((a1 x) (hpart y r1)) ((a2 ((k1 x) (hpart y r1))) (tpart y r1))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> (((k3 x) y) = ((k2 ((k1 x) (hpart y r1))) (tpart y r1)))) -> ((size (seq_pps_bv c c' r1 r2 r3 k1 k2 k3 a1 a2 a3)) = ((size c) + (size c'))%Z). Axiom seq_pps_bv_spec3 : forall (c:circuit) (c':circuit) (r1:Z) (r2:Z) (r3:Z) (k1:bitvec -> bitvec -> bitvec) (k2:bitvec -> bitvec -> bitvec) (k3:bitvec -> bitvec -> bitvec) (a1:bitvec -> bitvec -> angle) (a2:bitvec -> bitvec -> angle) (a3:bitvec -> bitvec -> angle), (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r1) -> ((length ((k1 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r2) -> ((length ((k2 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> ((length ((k3 x) y)) = (width c))) -> ((width c) = (width c')) -> (r3 = (r1 + r2)%Z) -> (correct_path_sum_bv c r1 k1 a1) -> (correct_path_sum_bv c' r2 k2 a2) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> (((a3 x) y) = (ang_add ((a1 x) (hpart y r1)) ((a2 ((k1 x) (hpart y r1))) (tpart y r1))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> (((k3 x) y) = ((k2 ((k1 x) (hpart y r1))) (tpart y r1)))) -> ((ancillas (seq_pps_bv c c' r1 r2 r3 k1 k2 k3 a1 a2 a3)) = (ZArith.BinInt.Z.max (ancillas c) (ancillas c'))). Axiom seq_pps_bv_spec4 : forall (c:circuit) (c':circuit) (r1:Z) (r2:Z) (r3:Z) (k1:bitvec -> bitvec -> bitvec) (k2:bitvec -> bitvec -> bitvec) (k3:bitvec -> bitvec -> bitvec) (a1:bitvec -> bitvec -> angle) (a2:bitvec -> bitvec -> angle) (a3:bitvec -> bitvec -> angle), (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r1) -> ((length ((k1 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r2) -> ((length ((k2 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> ((length ((k3 x) y)) = (width c))) -> ((width c) = (width c')) -> (r3 = (r1 + r2)%Z) -> (correct_path_sum_bv c r1 k1 a1) -> (correct_path_sum_bv c' r2 k2 a2) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> (((a3 x) y) = (ang_add ((a1 x) (hpart y r1)) ((a2 ((k1 x) (hpart y r1))) (tpart y r1))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r3) -> (((k3 x) y) = ((k2 ((k1 x) (hpart y r1))) (tpart y r1)))) -> correct_path_sum_bv (seq_pps_bv c c' r1 r2 r3 k1 k2 k3 a1 a2 a3) r3 k3 a3. Axiom correct_path_sum_bv_sim : forall (c:circuit) (r1:Z) (k1:bitvec -> bitvec -> bitvec) (a1:bitvec -> bitvec -> angle) (r2:Z) (k2:bitvec -> bitvec -> bitvec) (a2:bitvec -> bitvec -> angle), (r1 = r2) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r1) -> ((length ((k1 x) y)) = (width c))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r1) -> (((k1 x) y) = ((k2 x) y))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = r1) -> (((a1 x) y) = ((a2 x) y))) -> (correct_path_sum_bv c r1 k1 a1) -> correct_path_sum_bv c r2 k2 a2. Parameter reverse: circuit -> circuit. Axiom reverse_spec : forall (c:circuit), ((ancillas c) = 0%Z) -> ((width (reverse c)) = (width c)). Axiom reverse_spec1 : forall (c:circuit), ((ancillas c) = 0%Z) -> ((size (reverse c)) = (size c)). Axiom reverse_spec2 : forall (c:circuit), ((ancillas c) = 0%Z) -> ((ancillas (reverse c)) = 0%Z). Axiom reverse_spec3 : forall (c:circuit), ((ancillas c) = 0%Z) -> forall (x:matrix complex) (y:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_l y (width c)) -> ((path_sem c x) = y) -> ((path_sem (reverse c) y) = x). Axiom reverse_spec4 : forall (c:circuit), ((ancillas c) = 0%Z) -> forall (x:matrix complex) (y:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_l y (width c)) -> ((path_sem (reverse c) y) = x) -> ((path_sem c x) = y). Axiom reverse_spec5 : forall (c:circuit), ((ancillas c) = 0%Z) -> forall (x:matrix complex) (y:matrix complex), (sem c x y) -> sem (reverse c) y x. Axiom reverse_spec6 : forall (c:circuit), ((ancillas c) = 0%Z) -> forall (x:matrix complex) (y:matrix complex), (sem (reverse c) y x) -> sem c x y. Axiom path_sem_reverse : forall (c:circuit) (x:matrix complex) (y:matrix complex), (is_a_ket_l x (width c)) -> ((path_sem c x) = y) -> ((path_sem (reverse c) y) = x). Parameter ids: Z -> circuit. Axiom ids_spec : forall (n:Z), (1%Z <= n)%Z -> ((width (ids n)) = n). Axiom ids_spec1 : forall (n:Z), (1%Z <= n)%Z -> ((size (ids n)) = 0%Z). Axiom ids_spec2 : forall (n:Z), (1%Z <= n)%Z -> ((ancillas (ids n)) = 0%Z). Axiom ids_spec3 : forall (n:Z), (1%Z <= n)%Z -> ((range (ids n)) = 0%Z). Axiom ids_spec4 : forall (n:Z), (1%Z <= n)%Z -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((basis_ket (ids n) x y i) = (x i)). Axiom ids_spec5 : forall (n:Z), (1%Z <= n)%Z -> forall (x:Z -> Z) (y:Z -> Z), ((ang_ind (ids n) x y) = ang_zero). Axiom ids_spec6 : forall (n:Z), (1%Z <= n)%Z -> forall (x:matrix complex), (is_a_ket_l x n) -> (is_a_ket_basis_elt x) -> ((path_sem (ids n) x) = x). Axiom ids_spec7 : forall (n:Z), (1%Z <= n)%Z -> forall (x:matrix complex), (is_a_ket_l x n) -> ((path_sem (ids n) x) = x). Parameter place: circuit -> Z -> Z -> circuit. Axiom place_spec : forall (c:circuit) (k:Z) (n:Z), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> ((ancillas (place c k n)) = (ancillas c)). Axiom place_spec1 : forall (c:circuit) (k:Z) (n:Z), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> ((size (place c k n)) = (size c)). Axiom place_spec2 : forall (c:circuit) (k:Z) (n:Z), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> ((range (place c k n)) = (range c)). Axiom place_spec3 : forall (c:circuit) (k:Z) (n:Z), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> ((width (place c k n)) = n). Axiom place_spec4 : forall (c:circuit) (k:Z) (n:Z), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((k <= i)%Z /\ (i < (k + (width c))%Z)%Z) -> ((basis_ket (place c k n) x y i) = (basis_ket c (fun (j:Z) => (x (j + k)%Z)) y (i - k)%Z))) /\ (~ ((k <= i)%Z /\ (i < (k + (width c))%Z)%Z) -> ((basis_ket (place c k n) x y i) = (x i))). Axiom place_spec5 : forall (c:circuit) (k:Z) (n:Z), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> forall (x:Z -> Z) (y:Z -> Z), ((ang_ind (place c k n) x y) = (ang_ind c (fun (j:Z) => (x (j + k)%Z)) y)). Axiom place_spec6 : forall (c:circuit) (k:Z) (n:Z), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> (((k = 0%Z) /\ (n = (k + (width c))%Z)) -> ((place c k n) = c)) /\ (~ ((k = 0%Z) /\ (n = (k + (width c))%Z)) -> ((k = 0%Z) -> ((place c k n) = (parallel c (ids ((n - k)%Z - (width c))%Z)))) /\ (~ (k = 0%Z) -> ((n = (k + (width c))%Z) -> ((place c k n) = (parallel (ids k) c))) /\ (~ (n = (k + (width c))%Z) -> ((place c k n) = (parallel (ids k) (parallel c (ids ((n - k)%Z - (width c))%Z))))))). Axiom place_kron : forall (c:circuit) (k:Z) (n:Z) (x:matrix complex) (y:matrix complex) (y':matrix complex) (z:matrix complex), (0%Z < k)%Z -> (((width c) + k)%Z < n)%Z -> (is_a_ket_l x k) -> (is_a_ket_l y (width c)) -> (is_a_ket_l z ((n - (width c))%Z - k)%Z) -> ((path_sem c y) = y') -> ((path_sem (place c k n) (kronecker x (kronecker y z))) = (kronecker x (kronecker y' z))). Axiom place_kron_left : forall (c:circuit) (n:Z) (y:matrix complex) (y':matrix complex) (z:matrix complex), ((width c) < n)%Z -> (is_a_ket_l y (width c)) -> (is_a_ket_l z (n - (width c))%Z) -> ((path_sem c y) = y') -> ((path_sem (place c 0%Z n) (kronecker y z)) = (kronecker y' z)). Axiom place_kron_right : forall (c:circuit) (k:Z) (n:Z), (0%Z < k)%Z -> (n = ((width c) + k)%Z) -> forall (y:matrix complex) (x:matrix complex), (is_a_ket_l x k) -> (is_a_ket_l y (n - k)%Z) -> ((path_sem (place c k n) (kronecker x y)) = (kronecker x (path_sem c y))). Axiom place_kron_gen : forall (c:circuit) (k:Z) (n:Z) (x:bitvec), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> ((length x) = n) -> ((k = 0%Z) -> ((n = (width c)) -> ((path_sem (place c k n) (bv_to_ket x)) = (path_sem c (bv_to_ket x)))) /\ (~ (n = (width c)) -> ((path_sem (place c k n) (bv_to_ket x)) = (kronecker (path_sem c (bv_to_ket (hpart x (width c)))) (bv_to_ket (tpart x (width c))))))) /\ (~ (k = 0%Z) -> ((n = (k + (width c))%Z) -> ((path_sem (place c k n) (bv_to_ket x)) = (kronecker (bv_to_ket (hpart x k)) (path_sem c (bv_to_ket (tpart x k)))))) /\ (~ (n = (k + (width c))%Z) -> ((path_sem (place c k n) (bv_to_ket x)) = (kronecker (bv_to_ket (hpart x k)) (kronecker (path_sem c (bv_to_ket (htpart x k (width c)))) (bv_to_ket (tpart x ((width c) + k)%Z))))))). Axiom place_get_ket : forall (c:circuit) (k:Z) (n:Z) (x:bitvec) (y:bitvec), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> ((length x) = n) -> ((length y) = n) -> ((hpart x k) = (hpart y k)) -> ((tpart x (k + (width c))%Z) = (tpart y (k + (width c))%Z)) -> ((get_ket (path_sem (place c k n) (bv_to_ket x)) (bv_to_int y)) = (get_ket (path_sem c (bv_to_ket (make_bv (fun (i:Z) => ((getbv x) (i + k)%Z)) (width c)))) (bv_to_int (make_bv (fun (i:Z) => ((getbv y) (i + k)%Z)) (width c))))). Axiom place_get_ket_hpart_null : forall (c:circuit) (k:Z) (n:Z) (x:bitvec) (y:bitvec), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> ((length x) = n) -> ((length y) = n) -> ~ ((hpart x k) = (hpart y k)) -> ((get_ket (path_sem (place c k n) (bv_to_ket x)) (bv_to_int y)) = c_zero). Axiom place_get_ket_tpart_null : forall (c:circuit) (k:Z) (n:Z) (x:bitvec) (y:bitvec), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> ((length x) = n) -> ((length y) = n) -> ~ ((tpart x (k + (width c))%Z) = (tpart y (k + (width c))%Z)) -> ((get_ket (path_sem (place c k n) (bv_to_ket x)) (bv_to_int y)) = c_zero). Parameter place_hadamard: Z -> Z -> circuit. Axiom place_hadamard_spec : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((range (place_hadamard k n)) = 1%Z). Axiom place_hadamard_spec1 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((width (place_hadamard k n)) = n). Axiom place_hadamard_spec2 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((size (place_hadamard k n)) = 1%Z). Axiom place_hadamard_spec3 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((ancillas (place_hadamard k n)) = 0%Z). Axiom place_hadamard_spec4 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> ((i = k) -> ((basis_ket (place_hadamard k n) x y i) = (y 0%Z))) /\ (~ (i = k) -> ((basis_ket (place_hadamard k n) x y i) = (x i))). Axiom place_hadamard_spec5 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> forall (x:Z -> Z) (y:Z -> Z), ((((x k) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((ang_ind (place_hadamard k n) x y) = ang_minus_one)) /\ (~ (((x k) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((ang_ind (place_hadamard k n) x y) = ang_zero)). Axiom place_hadamard_spec6 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> forall (x:Z -> Z) (y:Z -> Z), forall (m:Z), (m >= 1%Z)%Z -> ((((x k) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((ang_ind (place_hadamard k n) x y) = (int_to_ang (((x k) * (y 0%Z))%Z * (power_ 2%Z (m - 1%Z)%Z))%Z m))) /\ (~ (((x k) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((ang_ind (place_hadamard k n) x y) = ang_zero)). Parameter place_hadamard_bv: Z -> Z -> circuit. Axiom place_hadamard_bv_def : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((place_hadamard_bv k n) = (place_hadamard k n)). Axiom place_hadamard_bv_spec : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((range (place_hadamard_bv k n)) = 1%Z). Axiom place_hadamard_bv_spec1 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((width (place_hadamard_bv k n)) = n). Axiom place_hadamard_bv_spec2 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((size (place_hadamard_bv k n)) = 1%Z). Axiom place_hadamard_bv_spec3 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((ancillas (place_hadamard_bv k n)) = 0%Z). Axiom place_hadamard_bv_spec4 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> ((i = k) -> ((basis_ket (place_hadamard_bv k n) x y i) = (y 0%Z))) /\ (~ (i = k) -> ((basis_ket (place_hadamard_bv k n) x y i) = (x i))). Axiom place_hadamard_bv_spec5 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> forall (x:Z -> Z) (y:Z -> Z), ((((x k) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((ang_ind (place_hadamard_bv k n) x y) = ang_minus_one)) /\ (~ (((x k) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((ang_ind (place_hadamard_bv k n) x y) = ang_zero)). Axiom place_hadamard_bv_spec6 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> forall (x:Z -> Z) (y:Z -> Z), forall (m:Z), (m >= 1%Z)%Z -> ((((x k) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((ang_ind (place_hadamard_bv k n) x y) = (int_to_ang (((x k) * (y 0%Z))%Z * (power_ 2%Z (m - 1%Z)%Z))%Z m))) /\ (~ (((x k) = (y 0%Z)) /\ ((y 0%Z) = 1%Z)) -> ((ang_ind (place_hadamard_bv k n) x y) = ang_zero)). Parameter fc28: Z -> bitvec -> bitvec -> Z -> Z. Axiom fc_def28 : forall (k:Z) (x:bitvec) (y:bitvec) (i:Z), ((i = k) -> (((fc28 k x y) i) = ((getbv y) 0%Z))) /\ (~ (i = k) -> (((fc28 k x y) i) = ((getbv x) i))). Axiom place_hadamard_bv_spec7 : forall (k:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> correct_path_sum_bv (place_hadamard_bv k n) 1%Z (fun (x:bitvec) (y:bitvec) => (make_bv (fc28 k x y) n)) (fun (x:bitvec) (y:bitvec) => (int_to_ang ((((getbv x) k) * ((getbv y) 0%Z))%Z * (power_ 2%Z (n - 1%Z)%Z))%Z n)). Axiom place_place : forall (c:circuit) (k:Z) (k':Z) (n:Z) (n':Z) (x:bitvec), (0%Z <= k)%Z -> (((width c) + k)%Z <= n)%Z -> (0%Z <= k')%Z -> ((n + k')%Z <= n')%Z -> ((length x) = n') -> ((path_sem (place (place c k n) k' n') (bv_to_ket x)) = (path_sem (place c (k + k')%Z n') (bv_to_ket x))). Parameter qbit_permutes: circuit -> Prop. Axiom qbit_permutes_spec : forall (c:circuit), (qbit_permutes c) -> ((size c) = 0%Z). Axiom qbit_permutes_spec1 : forall (c:circuit), (qbit_permutes c) -> ((ancillas c) = 0%Z). Axiom qbit_permutes_spec2 : forall (c:circuit), (qbit_permutes c) -> ((range c) = 0%Z). Axiom qbit_permutes_spec3 : forall (c:circuit), (qbit_permutes c) -> forall (x:Z -> Z) (y:Z -> Z), ((ang_ind c x y) = ang_zero). Parameter qbit_permutation: circuit -> Z -> Z. Axiom qbit_permutation_spec : forall (c:circuit), (qbit_permutes c) -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((0%Z <= i)%Z /\ (i < (width c))%Z) -> ((basis_ket c x y i) = (x ((qbit_permutation c) i))). Axiom qbit_permutation_spec1 : forall (c:circuit), (qbit_permutes c) -> p_bijective (qbit_permutation c) (to_fset 0%Z (width c)) (to_fset 0%Z (width c)). Parameter permute_atom: Z -> Z -> Z -> circuit. Axiom permute_atom_spec : forall (k:Z) (fk:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((0%Z <= fk)%Z /\ (fk < n)%Z) -> ((size (permute_atom k fk n)) = 0%Z). Axiom permute_atom_spec1 : forall (k:Z) (fk:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((0%Z <= fk)%Z /\ (fk < n)%Z) -> ((width (permute_atom k fk n)) = n). Axiom permute_atom_spec2 : forall (k:Z) (fk:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((0%Z <= fk)%Z /\ (fk < n)%Z) -> qbit_permutes (permute_atom k fk n). Axiom permute_atom_spec3 : forall (k:Z) (fk:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((0%Z <= fk)%Z /\ (fk < n)%Z) -> (((qbit_permutation (permute_atom k fk n)) k) = fk). Axiom permute_atom_spec4 : forall (k:Z) (fk:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((0%Z <= fk)%Z /\ (fk < n)%Z) -> (((qbit_permutation (permute_atom k fk n)) fk) = k). Axiom permute_atom_spec5 : forall (k:Z) (fk:Z) (n:Z), ((0%Z <= k)%Z /\ (k < n)%Z) -> ((0%Z <= fk)%Z /\ (fk < n)%Z) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> ~ (i = k) -> ~ (i = fk) -> (((qbit_permutation (permute_atom k fk n)) i) = i). Parameter permutation_circuit: Z -> (Z -> Z) -> circuit. Axiom permutation_circuit_spec : forall (n:Z) (f:Z -> Z), (0%Z < n)%Z -> (p_bijective f (to_fset 0%Z n) (to_fset 0%Z n)) -> ((size (permutation_circuit n f)) = 0%Z). Axiom permutation_circuit_spec1 : forall (n:Z) (f:Z -> Z), (0%Z < n)%Z -> (p_bijective f (to_fset 0%Z n) (to_fset 0%Z n)) -> ((width (permutation_circuit n f)) = n). Axiom permutation_circuit_spec2 : forall (n:Z) (f:Z -> Z), (0%Z < n)%Z -> (p_bijective f (to_fset 0%Z n) (to_fset 0%Z n)) -> qbit_permutes (permutation_circuit n f). Axiom permutation_circuit_spec3 : forall (n:Z) (f:Z -> Z), (0%Z < n)%Z -> (p_bijective f (to_fset 0%Z n) (to_fset 0%Z n)) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((qbit_permutation (permutation_circuit n f)) i) = (f i)). Axiom permutation_circuit_spec4 : forall (n:Z) (f:Z -> Z), (0%Z < n)%Z -> (p_bijective f (to_fset 0%Z n) (to_fset 0%Z n)) -> forall (i:Z), ((0%Z <= i)%Z /\ (i < n)%Z) -> (((qbit_permutation (permutation_circuit n f)) (inv_func f (to_fset 0%Z n) (to_fset 0%Z n) i)) = i). Parameter with_permutation: circuit -> (Z -> Z) -> circuit. Axiom with_permutation_spec : forall (c:circuit) (f:Z -> Z), (p_bijective f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) -> ((size (with_permutation c f)) = (size c)). Axiom with_permutation_spec1 : forall (c:circuit) (f:Z -> Z), (p_bijective f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) -> ((ancillas (with_permutation c f)) = (ancillas c)). Axiom with_permutation_spec2 : forall (c:circuit) (f:Z -> Z), (p_bijective f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) -> ((width (with_permutation c f)) = (width c)). Axiom with_permutation_spec3 : forall (c:circuit) (f:Z -> Z), (p_bijective f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) -> ((range (with_permutation c f)) = (range c)). Axiom with_permutation_spec4 : forall (c:circuit) (f:Z -> Z), (p_bijective f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) -> forall (x:Z -> Z) (y:Z -> Z), ((ang_ind (with_permutation c f) x y) = (ang_ind c (fun (i:Z) => (x (f i))) y)). Axiom with_permutation_spec5 : forall (c:circuit) (f:Z -> Z), (p_bijective f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((0%Z <= i)%Z /\ (i < (width c))%Z) -> ((basis_ket (with_permutation c f) x y i) = (basis_ket c (fun (i1:Z) => (x (f i1))) y ((inv_f f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) i))). Axiom with_permutation_spec6 : forall (c:circuit) (f:Z -> Z), (p_bijective f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) -> forall (x:Z -> Z) (y:Z -> Z), forall (i:Z), ((0%Z <= i)%Z /\ (i < (width c))%Z) -> ((basis_ket (with_permutation c f) (fun (i1:Z) => (x ((inv_f f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) i1))) y i) = (basis_ket c x y ((inv_f f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) i))). Axiom with_permutation_get_ket : forall (c:circuit) (f:Z -> Z) (x:bitvec) (y:bitvec), ((length x) = (width c)) -> ((length y) = (width c)) -> (p_bijective f (to_fset 0%Z (width c)) (to_fset 0%Z (width c))) -> ((get_ket (path_sem (with_permutation c f) (bv_to_ket x)) (bv_to_int y)) = (get_ket (path_sem c (bv_to_ket (make_bv (fun (i:Z) => ((getbv x) (f i))) (width c)))) (bv_to_int (make_bv (fun (i:Z) => ((getbv y) (f i))) (width c))))). Parameter fc29: Z -> Z -> Z -> Z. Axiom fc_def29 : forall (k:Z) (n:Z) (i:Z), ((i < k)%Z -> (((fc29 k n) i) = ((i + n)%Z - k)%Z)) /\ (~ (i < k)%Z -> (((fc29 k n) i) = (i - k)%Z)). Axiom with_permutation_kronecker : forall (c:circuit) (im_c:matrix complex) (im_d:matrix complex) (ant_c:matrix complex) (ant_d:matrix complex) (k:Z) (n:Z), ((width c) = n) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> (is_a_ket_l im_c k) -> (is_a_ket_l im_d (n - k)%Z) -> (is_a_ket_l ant_c k) -> (is_a_ket_l ant_d (n - k)%Z) -> (is_a_ket_basis_elt ant_c) -> (is_a_ket_basis_elt ant_d) -> ((path_sem c (kronecker ant_c ant_d)) = (kronecker im_c im_d)) -> ((path_sem (with_permutation c (fc29 k n)) (kronecker ant_d ant_c)) = (kronecker im_d im_c)). Parameter cont_size: Z. Axiom cont_size_def : (0%Z < cont_size)%Z. Parameter cont_zero: circuit -> circuit. Axiom cont_zero_spec : forall (c:circuit), ((size (cont_zero c)) <= ((size c) * cont_size)%Z)%Z. Axiom cont_zero_spec1 : forall (c:circuit), ((ancillas (cont_zero c)) = (ancillas c)). Axiom cont_zero_spec2 : forall (c:circuit), ((range (cont_zero c)) = (range c)). Axiom cont_zero_spec3 : forall (c:circuit), ((width (cont_zero c)) = ((width c) + 1%Z)%Z). Axiom cont_zero_spec4 : forall (c:circuit), forall (bv:bitvec), ((length bv) = ((width c) + 1%Z)%Z) -> (((getbv bv) 0%Z) = 0%Z) -> ((path_sem (cont_zero c) (bv_to_ket bv)) = (bv_to_ket bv)). Axiom cont_zero_spec5 : forall (c:circuit), forall (bv:bitvec), ((length bv) = ((width c) + 1%Z)%Z) -> (((getbv bv) 0%Z) = 1%Z) -> ((path_sem (cont_zero c) (bv_to_ket bv)) = (path_sem (place c 1%Z ((width c) + 1%Z)%Z) (bv_to_ket bv))). Axiom cont_zero_path_sem_kron : forall (c:circuit) (x:bitvec), ((length x) = (width c)) -> ((path_sem (cont_zero c) (kronecker (ket 1%Z 0%Z) (bv_to_ket x))) = (kronecker (ket 1%Z 0%Z) (bv_to_ket x))). Axiom cont_zero_path_sem_kron1 : forall (c:circuit) (x:bitvec), ((length x) = (width c)) -> ((path_sem (cont_zero c) (kronecker (ket 1%Z 1%Z) (bv_to_ket x))) = (kronecker (ket 1%Z 1%Z) (path_sem c (bv_to_ket x)))). Parameter cont_last_qbit: circuit -> circuit. Axiom cont_last_qbit_spec : forall (c:circuit), ((size (cont_last_qbit c)) <= ((size c) * cont_size)%Z)%Z. Axiom cont_last_qbit_spec1 : forall (c:circuit), ((ancillas (cont_last_qbit c)) = (ancillas c)). Axiom cont_last_qbit_spec2 : forall (c:circuit), ((range (cont_last_qbit c)) = (range c)). Axiom cont_last_qbit_spec3 : forall (c:circuit), ((width (cont_last_qbit c)) = ((width c) + 1%Z)%Z). Axiom cont_last_qbit_spec4 : forall (c:circuit), forall (bv:bitvec), ((length bv) = ((width c) + 1%Z)%Z) -> (((getbv bv) (width c)) = 0%Z) -> ((path_sem (cont_last_qbit c) (bv_to_ket bv)) = (bv_to_ket bv)). Axiom cont_last_qbit_spec5 : forall (c:circuit), forall (bv:bitvec), ((length bv) = ((width c) + 1%Z)%Z) -> (((getbv bv) (width c)) = 1%Z) -> ((path_sem (cont_last_qbit c) (bv_to_ket bv)) = (path_sem (place c 0%Z ((width c) + 1%Z)%Z) (bv_to_ket bv))). Parameter cont_last_qbit_kron: circuit -> circuit. Axiom cont_last_qbit_kron_spec : forall (c:circuit), ((size (cont_last_qbit_kron c)) <= ((size c) * cont_size)%Z)%Z. Axiom cont_last_qbit_kron_spec1 : forall (c:circuit), ((ancillas (cont_last_qbit_kron c)) = (ancillas c)). Axiom cont_last_qbit_kron_spec2 : forall (c:circuit), ((range (cont_last_qbit_kron c)) = (range c)). Axiom cont_last_qbit_kron_spec3 : forall (c:circuit), ((width (cont_last_qbit_kron c)) = ((width c) + 1%Z)%Z). Axiom cont_last_qbit_kron_spec4 : forall (c:circuit), forall (x:matrix complex) (y:matrix complex), (sem c x y) -> sem (cont_last_qbit_kron c) (kronecker x (ket 1%Z 0%Z)) (kronecker x (ket 1%Z 0%Z)). Axiom cont_last_qbit_kron_spec5 : forall (c:circuit), forall (x:matrix complex) (y:matrix complex), (sem c x y) -> sem (cont_last_qbit_kron c) (kronecker x (ket 1%Z 1%Z)) (kronecker y (ket 1%Z 1%Z)). Parameter cont: circuit -> Z -> Z -> Z -> circuit. Axiom cont_spec : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> ((size (cont c co k n)) <= ((size c) * cont_size)%Z)%Z. Axiom cont_spec1 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> ((ancillas (cont c co k n)) = (ancillas c)). Axiom cont_spec2 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> ((range (cont c co k n)) = (range c)). Axiom cont_spec3 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> ((width (cont c co k n)) = n). Axiom cont_spec4 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> forall (bv:bitvec), ((length bv) = n) -> (((getbv bv) co) = 0%Z) -> ((path_sem (cont c co k n) (bv_to_ket bv)) = (bv_to_ket bv)). Axiom cont_spec5 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> forall (bv:bitvec), ((length bv) = n) -> (((getbv bv) co) = 1%Z) -> ((path_sem (cont c co k n) (bv_to_ket bv)) = (path_sem (place c k n) (bv_to_ket bv))). Axiom cont_spec6 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> ((size (cont c co k n)) <= ((size c) * cont_size)%Z)%Z. Axiom cont_spec7 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> ((ancillas (cont c co k n)) = (ancillas c)). Axiom cont_spec8 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> ((range (cont c co k n)) = (range c)). Axiom cont_spec9 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> ((width (cont c co k n)) = n). Axiom cont_spec10 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> forall (bv:bitvec), ((length bv) = n) -> (((getbv bv) co) = 0%Z) -> ((path_sem (cont c co k n) (bv_to_ket bv)) = (bv_to_ket bv)). Axiom cont_spec11 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> forall (bv:bitvec), ((length bv) = n) -> (((getbv bv) co) = 1%Z) -> ((path_sem (cont c co k n) (bv_to_ket bv)) = (path_sem (place c k n) (bv_to_ket bv))). Axiom size_cont : forall (c:circuit) (co:Z) (k:Z) (n:Z) (s:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> ((size c) <= s)%Z -> ((size (cont c co k n)) <= (cont_size * s)%Z)%Z. Axiom size_cont1 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (s:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> ((size c) <= s)%Z -> ((size (cont c co k n)) <= (cont_size * s)%Z)%Z. Axiom path_cont : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> forall (bv:bitvec), ((length bv) = n) -> (((getbv bv) co) = 0%Z) -> ((path_sem (cont c co k n) (bv_to_ket bv)) = (bv_to_ket bv)). Axiom path_cont1 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> forall (bv:bitvec), ((length bv) = n) -> (((getbv bv) co) = 1%Z) -> ((path_sem (cont c co k n) (bv_to_ket bv)) = (path_sem (place c k n) (bv_to_ket bv))). Axiom path_cont2 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> forall (bv:bitvec), ((length bv) = n) -> (((getbv bv) co) = 0%Z) -> ((path_sem (cont c co k n) (bv_to_ket bv)) = (bv_to_ket bv)). Axiom path_cont3 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> forall (bv:bitvec), ((length bv) = n) -> (((getbv bv) co) = 1%Z) -> ((path_sem (cont c co k n) (bv_to_ket bv)) = (path_sem (place c k n) (bv_to_ket bv))). Axiom path_cont_ketz : forall (c:circuit) (co:Z) (k:Z) (n:Z) (x:matrix complex), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> (is_a_ket_l x n) -> (is_a_ket_basis_elt x) -> (((getbv (ket_to_bv x)) co) = 0%Z) -> ((path_sem (cont c co k n) x) = x). Axiom path_cont_ketz1 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (x:matrix complex), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> (is_a_ket_l x n) -> (is_a_ket_basis_elt x) -> (((getbv (ket_to_bv x)) co) = 0%Z) -> ((path_sem (cont c co k n) x) = x). Axiom path_cont_keto : forall (c:circuit) (co:Z) (k:Z) (n:Z) (x:matrix complex), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> (is_a_ket_l x n) -> (is_a_ket_basis_elt x) -> (((getbv (ket_to_bv x)) co) = 1%Z) -> ((path_sem (cont c co k n) x) = (path_sem (place c k n) x)). Axiom path_cont_keto1 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (x:matrix complex), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> (is_a_ket_l x n) -> (is_a_ket_basis_elt x) -> (((getbv (ket_to_bv x)) co) = 1%Z) -> ((path_sem (cont c co k n) x) = (path_sem (place c k n) x)). Axiom path_cont_ketz_gen : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> forall (x:matrix complex), (is_a_ket_l x n) -> (is_a_ket_basis_elt x) -> (((getbv (ket_to_bv x)) co) = 0%Z) -> ((path_sem (cont c co k n) x) = x). Axiom path_cont_ketz_gen1 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> forall (x:matrix complex), (is_a_ket_l x n) -> (is_a_ket_basis_elt x) -> (((getbv (ket_to_bv x)) co) = 0%Z) -> ((path_sem (cont c co k n) x) = x). Axiom path_cont_keto_gen : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> forall (x:matrix complex), (is_a_ket_l x n) -> (is_a_ket_basis_elt x) -> (((getbv (ket_to_bv x)) co) = 1%Z) -> ((path_sem (cont c co k n) x) = (path_sem (place c k n) x)). Axiom path_cont_keto_gen1 : forall (c:circuit) (co:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> forall (x:matrix complex), (is_a_ket_l x n) -> (is_a_ket_basis_elt x) -> (((getbv (ket_to_bv x)) co) = 1%Z) -> ((path_sem (cont c co k n) x) = (path_sem (place c k n) x)). Axiom cont_kron_left_bv_to_ket : forall (c:circuit) (n:Z) (x:matrix complex), ((0%Z <= (width c))%Z /\ ((width c) = (n - 1%Z)%Z)) -> (is_a_ket_l x (width c)) -> forall (y:bitvec), ((length y) = 1%Z) -> (((getbv y) 0%Z) = 0%Z) -> ((path_sem (cont c (n - 1%Z)%Z 0%Z n) (kronecker x (bv_to_ket y))) = (kronecker x (bv_to_ket y))). Axiom cont_kron_left_bv_to_ket1 : forall (c:circuit) (n:Z) (x:matrix complex), ((0%Z <= (width c))%Z /\ ((width c) = (n - 1%Z)%Z)) -> (is_a_ket_l x (width c)) -> forall (y:bitvec), ((length y) = 1%Z) -> (((getbv y) 0%Z) = 1%Z) -> ((path_sem (cont c (n - 1%Z)%Z 0%Z n) (kronecker x (bv_to_ket y))) = (kronecker (path_sem c x) (bv_to_ket y))). Axiom place_kron_left_path : forall (c:circuit) (n:Z), ((width c) < n)%Z -> forall (x:matrix complex) (y:matrix complex), (is_a_ket_l x (width c)) -> (is_a_ket_l y (n - (width c))%Z) -> ((path_sem (place c 0%Z n) (kronecker x y)) = (kronecker (path_sem c x) y)). Axiom cont_kron_pat_right : forall (circ:circuit) (c:Z) (k:Z) (n:Z) (y:matrix complex), ((0%Z <= c)%Z /\ (c < k)%Z) -> (n = (k + (width circ))%Z) -> (is_a_ket_l y (width circ)) -> forall (x:matrix complex), (is_a_ket_basis_elt x) -> (is_a_ket_l x k) -> (((getbv (ket_to_bv x)) c) = 0%Z) -> ((path_sem (cont circ c k n) (kronecker x y)) = (kronecker x y)). Axiom cont_kron_pat_right1 : forall (circ:circuit) (c:Z) (k:Z) (n:Z) (y:matrix complex), ((0%Z <= c)%Z /\ (c < k)%Z) -> (n = (k + (width circ))%Z) -> (is_a_ket_l y (width circ)) -> forall (x:matrix complex), (is_a_ket_basis_elt x) -> (is_a_ket_l x k) -> (((getbv (ket_to_bv x)) c) = 1%Z) -> ((path_sem (cont circ c k n) (kronecker x y)) = (kronecker x (path_sem circ y))). Axiom cont_kron_pat_right_gen : forall (circ:circuit) (c:Z) (k:Z) (n:Z), ((0%Z <= c)%Z /\ (c < k)%Z) -> (n = (k + (width circ))%Z) -> forall (y:matrix complex), forall (x:bitvec), (is_a_ket_l y (width circ)) -> ((length x) = k) -> (((getbv x) c) = 0%Z) -> ((path_sem (cont circ c k n) (kronecker (bv_to_ket x) y)) = (kronecker (bv_to_ket x) y)). Axiom cont_kron_pat_right_gen1 : forall (circ:circuit) (c:Z) (k:Z) (n:Z), ((0%Z <= c)%Z /\ (c < k)%Z) -> (n = (k + (width circ))%Z) -> forall (y:matrix complex), forall (x:bitvec), (is_a_ket_l y (width circ)) -> ((length x) = k) -> (((getbv x) c) = 1%Z) -> ((path_sem (cont circ c k n) (kronecker (bv_to_ket x) y)) = (kronecker (bv_to_ket x) (path_sem circ y))). Parameter diagonal1: circuit -> (bitvec -> angle) -> Prop. Axiom diagonal_def1 : forall (c:circuit) (g:bitvec -> angle), (diagonal1 c g) -> correct_path_sum_bv c 0%Z (fun (x:bitvec) (us:bitvec) => x) (fun (x:bitvec) (us:bitvec) => (g x)). Axiom diagonal_def2 : forall (c:circuit) (g:bitvec -> angle), (correct_path_sum_bv c 0%Z (fun (x:bitvec) (us:bitvec) => x) (fun (x:bitvec) (us:bitvec) => (g x))) -> diagonal1 c g. Axiom set_diagonal : forall (c:circuit) (f:bitvec -> angle), (forall (x:bitvec), ((length x) = (width c)) -> ((path_sem_basis c (bv_to_ket x)) = (infix_asdtdt (ang_exp (f x)) (bv_to_ket x)))) -> diagonal1 c f. Axiom get_diagonal : forall (c:circuit) (f:bitvec -> angle), (diagonal1 c f) -> forall (x:bitvec), ((length x) = (width c)) -> ((path_sem_basis c (bv_to_ket x)) = (infix_asdtdt (ang_exp (f x)) (bv_to_ket x))). Axiom set_diagonal_ : forall (c:circuit) (f:bitvec -> angle), (forall (x:bitvec), ((length x) = (width c)) -> ((path_sem c (bv_to_ket x)) = (infix_asdtdt (ang_exp (f x)) (bv_to_ket x)))) -> diagonal1 c f. Axiom get_diagonal_ : forall (c:circuit) (f:bitvec -> angle), (diagonal1 c f) -> forall (x:bitvec), ((length x) = (width c)) -> ((path_sem c (bv_to_ket x)) = (infix_asdtdt (ang_exp (f x)) (bv_to_ket x))). Axiom get_diagonal_basis : forall (c:circuit) (f:bitvec -> angle) (x:bitvec), (diagonal1 c f) -> ((length x) = (width c)) -> ((path_sem_basis c (bv_to_ket x)) = (infix_asdtdt (ang_exp (f x)) (bv_to_ket x))). Axiom get_diagonal_basis_ : forall (c:circuit) (f:bitvec -> angle) (x:bitvec), (diagonal1 c f) -> ((length x) = (width c)) -> ((path_sem c (bv_to_ket x)) = (infix_asdtdt (ang_exp (f x)) (bv_to_ket x))). Parameter diag_id: Z -> circuit. Axiom diag_id_def : forall (i:Z), (1%Z <= i)%Z -> ((diag_id i) = (ids i)). Axiom diag_id_spec : forall (i:Z), (1%Z <= i)%Z -> ((size (diag_id i)) = 0%Z). Axiom diag_id_spec1 : forall (i:Z), (1%Z <= i)%Z -> ((ancillas (diag_id i)) = 0%Z). Axiom diag_id_spec2 : forall (i:Z), (1%Z <= i)%Z -> ((width (diag_id i)) = i). Axiom diag_id_spec3 : forall (i:Z), (1%Z <= i)%Z -> diagonal1 (diag_id i) (fun (us:bitvec) => ang_zero). Parameter diag_rz: Z -> circuit. Axiom diag_rz_def : forall (k:Z), (0%Z <= k)%Z -> ((diag_rz k) = (rz k)). Axiom diag_rz_spec : forall (k:Z), (0%Z <= k)%Z -> ((size (diag_rz k)) = 1%Z). Axiom diag_rz_spec1 : forall (k:Z), (0%Z <= k)%Z -> ((ancillas (diag_rz k)) = 0%Z). Axiom diag_rz_spec2 : forall (k:Z), (0%Z <= k)%Z -> ((width (diag_rz k)) = 1%Z). Axiom diag_rz_spec3 : forall (k:Z), (0%Z <= k)%Z -> diagonal1 (diag_rz k) (fun (x:bitvec) => (int_to_ang ((getbv x) 0%Z) k)). Parameter diag_rz_neg: Z -> circuit. Axiom diag_rz_neg_def : forall (k:Z), (k <= 0%Z)%Z -> ((diag_rz_neg k) = (rz k)). Axiom diag_rz_neg_spec : forall (k:Z), (k <= 0%Z)%Z -> ((size (diag_rz_neg k)) = 1%Z). Axiom diag_rz_neg_spec1 : forall (k:Z), (k <= 0%Z)%Z -> ((ancillas (diag_rz_neg k)) = 0%Z). Axiom diag_rz_neg_spec2 : forall (k:Z), (k <= 0%Z)%Z -> ((width (diag_rz_neg k)) = 1%Z). Axiom diag_rz_neg_spec3 : forall (k:Z), (k <= 0%Z)%Z -> diagonal1 (diag_rz_neg k) (fun (x:bitvec) => (int_to_ang (-((getbv x) 0%Z))%Z (-k)%Z)). Parameter diag_phase: Z -> circuit. Axiom diag_phase_def : forall (k:Z), (0%Z <= k)%Z -> ((diag_phase k) = (phase k)). Axiom diag_phase_spec : forall (k:Z), (0%Z <= k)%Z -> ((size (diag_phase k)) = 1%Z). Axiom diag_phase_spec1 : forall (k:Z), (0%Z <= k)%Z -> ((ancillas (diag_phase k)) = 0%Z). Axiom diag_phase_spec2 : forall (k:Z), (0%Z <= k)%Z -> ((width (diag_phase k)) = 1%Z). Axiom diag_phase_spec3 : forall (k:Z), (0%Z <= k)%Z -> diagonal1 (diag_phase k) (fun (us:bitvec) => (int_to_ang 1%Z k)). Parameter diag_phase_neg: Z -> circuit. Axiom diag_phase_neg_def : forall (k:Z), (k <= 0%Z)%Z -> ((diag_phase_neg k) = (phase k)). Axiom diag_phase_neg_spec : forall (k:Z), (k <= 0%Z)%Z -> ((size (diag_phase_neg k)) = 1%Z). Axiom diag_phase_neg_spec1 : forall (k:Z), (k <= 0%Z)%Z -> ((ancillas (diag_phase_neg k)) = 0%Z). Axiom diag_phase_neg_spec2 : forall (k:Z), (k <= 0%Z)%Z -> ((width (diag_phase_neg k)) = 1%Z). Axiom diag_phase_neg_spec3 : forall (k:Z), (k <= 0%Z)%Z -> diagonal1 (diag_phase_neg k) (fun (us:bitvec) => (int_to_ang (-1%Z)%Z (-k)%Z)). Parameter diag_sequence: circuit -> circuit -> (bitvec -> angle) -> (bitvec -> angle) -> (bitvec -> angle) -> circuit. Axiom diag_sequence_def : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (h:bitvec -> angle), (diagonal1 d f) -> (diagonal1 e1 g) -> ((width d) = (width e1)) -> (forall (x:bitvec), ((length x) = (width d)) -> ((h x) = (ang_add (f x) (g x)))) -> ((diag_sequence d e1 f g h) = (sequence d e1)). Axiom diag_sequence_spec : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (h:bitvec -> angle), (diagonal1 d f) -> (diagonal1 e1 g) -> ((width d) = (width e1)) -> (forall (x:bitvec), ((length x) = (width d)) -> ((h x) = (ang_add (f x) (g x)))) -> diagonal1 (diag_sequence d e1 f g h) h. Axiom diag_sequence_spec1 : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (h:bitvec -> angle), (diagonal1 d f) -> (diagonal1 e1 g) -> ((width d) = (width e1)) -> (forall (x:bitvec), ((length x) = (width d)) -> ((h x) = (ang_add (f x) (g x)))) -> ((width (diag_sequence d e1 f g h)) = (width d)). Axiom diag_sequence_spec2 : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (h:bitvec -> angle), (diagonal1 d f) -> (diagonal1 e1 g) -> ((width d) = (width e1)) -> (forall (x:bitvec), ((length x) = (width d)) -> ((h x) = (ang_add (f x) (g x)))) -> ((size (diag_sequence d e1 f g h)) = ((size d) + (size e1))%Z). Axiom diag_sequence_spec3 : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (h:bitvec -> angle), (diagonal1 d f) -> (diagonal1 e1 g) -> ((width d) = (width e1)) -> (forall (x:bitvec), ((length x) = (width d)) -> ((h x) = (ang_add (f x) (g x)))) -> ((ancillas (diag_sequence d e1 f g h)) = (ZArith.BinInt.Z.max (ancillas d) (ancillas e1))). Parameter sequence_diag_gen: circuit -> circuit -> (bitvec -> angle) -> (bitvec -> bitvec -> angle) -> (bitvec -> bitvec -> bitvec) -> Z -> circuit. Axiom sequence_diag_gen_def : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> bitvec -> angle) (h:bitvec -> bitvec -> bitvec) (r:Z), (diagonal1 d f) -> (r = (range e1)) -> ((width d) = (width e1)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> ((length ((h x) y)) = (width d))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((g x) y) = (ang_add (f x) (ang_ind e1 (getbv x) (getbv y))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((h x) y) = (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) e1) (getbv x)) (getbv y)) (width d)))) -> ((sequence_diag_gen d e1 f g h r) = (seq_pps_bv d e1 0%Z r r (fun (x:bitvec) (us:bitvec) => x) h h (fun (x:bitvec) (us:bitvec) => (f x)) (fun (x:bitvec) (y:bitvec) => (ang_ind e1 (getbv x) (getbv y))) g)). Axiom sequence_diag_gen_spec : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> bitvec -> angle) (h:bitvec -> bitvec -> bitvec) (r:Z), (diagonal1 d f) -> (r = (range e1)) -> ((width d) = (width e1)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> ((length ((h x) y)) = (width d))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((g x) y) = (ang_add (f x) (ang_ind e1 (getbv x) (getbv y))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((h x) y) = (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) e1) (getbv x)) (getbv y)) (width d)))) -> ((width (sequence_diag_gen d e1 f g h r)) = (width d)). Axiom sequence_diag_gen_spec1 : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> bitvec -> angle) (h:bitvec -> bitvec -> bitvec) (r:Z), (diagonal1 d f) -> (r = (range e1)) -> ((width d) = (width e1)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> ((length ((h x) y)) = (width d))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((g x) y) = (ang_add (f x) (ang_ind e1 (getbv x) (getbv y))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((h x) y) = (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) e1) (getbv x)) (getbv y)) (width d)))) -> ((size (sequence_diag_gen d e1 f g h r)) = ((size d) + (size e1))%Z). Axiom sequence_diag_gen_spec2 : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> bitvec -> angle) (h:bitvec -> bitvec -> bitvec) (r:Z), (diagonal1 d f) -> (r = (range e1)) -> ((width d) = (width e1)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> ((length ((h x) y)) = (width d))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((g x) y) = (ang_add (f x) (ang_ind e1 (getbv x) (getbv y))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((h x) y) = (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) e1) (getbv x)) (getbv y)) (width d)))) -> ((ancillas (sequence_diag_gen d e1 f g h r)) = (ZArith.BinInt.Z.max (ancillas d) (ancillas e1))). Axiom sequence_diag_gen_spec3 : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> bitvec -> angle) (h:bitvec -> bitvec -> bitvec) (r:Z), (diagonal1 d f) -> (r = (range e1)) -> ((width d) = (width e1)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> ((length ((h x) y)) = (width d))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((g x) y) = (ang_add (f x) (ang_ind e1 (getbv x) (getbv y))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((h x) y) = (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) e1) (getbv x)) (getbv y)) (width d)))) -> correct_path_sum_bv (sequence_diag_gen d e1 f g h r) r h g. Parameter sequence_gen_diag: circuit -> circuit -> (bitvec -> angle) -> (bitvec -> bitvec -> angle) -> (bitvec -> bitvec -> bitvec) -> Z -> circuit. Axiom sequence_gen_diag_def : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> bitvec -> angle) (h:bitvec -> bitvec -> bitvec) (r:Z), (diagonal1 d f) -> (r = (range e1)) -> ((width d) = (width e1)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> ((length ((h x) y)) = (width d))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((g x) y) = (ang_add (ang_ind e1 (getbv x) (getbv y)) (f ((h x) y))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((h x) y) = (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) e1) (getbv x)) (getbv y)) (width d)))) -> ((sequence_gen_diag d e1 f g h r) = (seq_pps_bv e1 d r 0%Z r h (fun (x:bitvec) (us:bitvec) => x) h (fun (x:bitvec) (y:bitvec) => (ang_ind e1 (getbv x) (getbv y))) (fun (x:bitvec) (us:bitvec) => (f x)) g)). Axiom sequence_gen_diag_spec : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> bitvec -> angle) (h:bitvec -> bitvec -> bitvec) (r:Z), (diagonal1 d f) -> (r = (range e1)) -> ((width d) = (width e1)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> ((length ((h x) y)) = (width d))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((g x) y) = (ang_add (ang_ind e1 (getbv x) (getbv y)) (f ((h x) y))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((h x) y) = (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) e1) (getbv x)) (getbv y)) (width d)))) -> ((width (sequence_gen_diag d e1 f g h r)) = (width d)). Axiom sequence_gen_diag_spec1 : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> bitvec -> angle) (h:bitvec -> bitvec -> bitvec) (r:Z), (diagonal1 d f) -> (r = (range e1)) -> ((width d) = (width e1)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> ((length ((h x) y)) = (width d))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((g x) y) = (ang_add (ang_ind e1 (getbv x) (getbv y)) (f ((h x) y))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((h x) y) = (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) e1) (getbv x)) (getbv y)) (width d)))) -> ((size (sequence_gen_diag d e1 f g h r)) = ((size d) + (size e1))%Z). Axiom sequence_gen_diag_spec2 : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> bitvec -> angle) (h:bitvec -> bitvec -> bitvec) (r:Z), (diagonal1 d f) -> (r = (range e1)) -> ((width d) = (width e1)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> ((length ((h x) y)) = (width d))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((g x) y) = (ang_add (ang_ind e1 (getbv x) (getbv y)) (f ((h x) y))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((h x) y) = (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) e1) (getbv x)) (getbv y)) (width d)))) -> ((ancillas (sequence_gen_diag d e1 f g h r)) = (ZArith.BinInt.Z.max (ancillas d) (ancillas e1))). Axiom sequence_gen_diag_spec3 : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> bitvec -> angle) (h:bitvec -> bitvec -> bitvec) (r:Z), (diagonal1 d f) -> (r = (range e1)) -> ((width d) = (width e1)) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> ((length ((h x) y)) = (width d))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((g x) y) = (ang_add (ang_ind e1 (getbv x) (getbv y)) (f ((h x) y))))) -> (forall (x:bitvec) (y:bitvec), ((length x) = (width d)) -> ((length y) = r) -> (((h x) y) = (make_bv ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) => (basis_ket y0 y1 y2 y3)) e1) (getbv x)) (getbv y)) (width d)))) -> correct_path_sum_bv (sequence_gen_diag d e1 f g h r) r h g. Parameter diag_expo: circuit -> (bitvec -> angle) -> (bitvec -> angle) -> Z -> circuit. Axiom diag_expo_def : forall (c:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (k:Z), (0%Z < k)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = (width c)) -> ((g x) = (ang_mult_int (f x) k))) -> (k = 1%Z) -> ((diag_expo c f g k) = c). Axiom diag_expo_def1 : forall (c:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (k:Z), (0%Z < k)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = (width c)) -> ((g x) = (ang_mult_int (f x) k))) -> ~ (k = 1%Z) -> ((diag_expo c f g k) = (diag_sequence (diag_expo c f (fun (x:bitvec) => (ang_mult_int (f x) (k - 1%Z)%Z)) (k - 1%Z)%Z) c (fun (x:bitvec) => (ang_mult_int (f x) (k - 1%Z)%Z)) f g)). Axiom diag_expo_spec : forall (c:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (k:Z), (0%Z < k)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = (width c)) -> ((g x) = (ang_mult_int (f x) k))) -> diagonal1 (diag_expo c f g k) g. Axiom diag_expo_spec1 : forall (c:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (k:Z), (0%Z < k)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = (width c)) -> ((g x) = (ang_mult_int (f x) k))) -> ((width (diag_expo c f g k)) = (width c)). Axiom diag_expo_spec2 : forall (c:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (k:Z), (0%Z < k)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = (width c)) -> ((g x) = (ang_mult_int (f x) k))) -> ((size (diag_expo c f g k)) = (k * (size c))%Z). Axiom diag_expo_spec3 : forall (c:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (k:Z), (0%Z < k)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = (width c)) -> ((g x) = (ang_mult_int (f x) k))) -> ((ancillas (diag_expo c f g k)) = (ancillas c)). Parameter diag_parallel: circuit -> circuit -> (bitvec -> angle) -> (bitvec -> angle) -> (bitvec -> angle) -> circuit. Axiom diag_parallel_def : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (h:bitvec -> angle), (diagonal1 d f) -> (diagonal1 e1 g) -> (forall (x:bitvec), ((h x) = (ang_add (f (hpart x (width d))) (g (tpart x (width d)))))) -> ((diag_parallel d e1 f g h) = (parallel d e1)). Axiom diag_parallel_spec : forall (d:circuit) (e1:circuit) (f:bitvec -> angle) (g:bitvec -> angle) (h:bitvec -> angle), (diagonal1 d f) -> (diagonal1 e1 g) -> (forall (x:bitvec), ((h x) = (ang_add (f (hpart x (width d))) (g (tpart x (width d)))))) -> diagonal1 (diag_parallel d e1 f g h) h. Parameter diag_place: circuit -> Z -> Z -> (bitvec -> angle) -> (bitvec -> angle) -> circuit. Axiom diag_place_def : forall (c:circuit) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((g x) = (f (htpart x k (width c))))) -> ((diag_place c k n f g) = (place c k n)). Axiom diag_place_spec : forall (c:circuit) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((g x) = (f (htpart x k (width c))))) -> ((size (diag_place c k n f g)) = (size c)). Axiom diag_place_spec1 : forall (c:circuit) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((g x) = (f (htpart x k (width c))))) -> ((ancillas (diag_place c k n f g)) = (ancillas c)). Axiom diag_place_spec2 : forall (c:circuit) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((g x) = (f (htpart x k (width c))))) -> ((width (diag_place c k n f g)) = n). Axiom diag_place_spec3 : forall (c:circuit) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((g x) = (f (htpart x k (width c))))) -> diagonal1 (diag_place c k n f g) g. Parameter diag_cont: circuit -> Z -> Z -> Z -> (bitvec -> angle) -> (bitvec -> angle) -> circuit. Axiom diag_cont_def : forall (c:circuit) (co:Z) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((((getbv x) co) = 0%Z) /\ ((g x) = ang_zero)) \/ (~ (((getbv x) co) = 0%Z) /\ ((g x) = (f (htpart x k (width c)))))) -> ((diag_cont c co k n f g) = (cont c co k n)). Axiom diag_cont_def1 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((((getbv x) co) = 0%Z) /\ ((g x) = ang_zero)) \/ (~ (((getbv x) co) = 0%Z) /\ ((g x) = (f (htpart x k (width c)))))) -> ((diag_cont c co k n f g) = (cont c co k n)). Axiom diag_cont_spec : forall (c:circuit) (co:Z) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((((getbv x) co) = 0%Z) /\ ((g x) = ang_zero)) \/ (~ (((getbv x) co) = 0%Z) /\ ((g x) = (f (htpart x k (width c)))))) -> ((size (diag_cont c co k n f g)) <= ((size c) * cont_size)%Z)%Z. Axiom diag_cont_spec1 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((((getbv x) co) = 0%Z) /\ ((g x) = ang_zero)) \/ (~ (((getbv x) co) = 0%Z) /\ ((g x) = (f (htpart x k (width c)))))) -> ((ancillas (diag_cont c co k n f g)) = (ancillas c)). Axiom diag_cont_spec2 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((((getbv x) co) = 0%Z) /\ ((g x) = ang_zero)) \/ (~ (((getbv x) co) = 0%Z) /\ ((g x) = (f (htpart x k (width c)))))) -> ((width (diag_cont c co k n f g)) = n). Axiom diag_cont_spec3 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ~ (k <= co)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((((getbv x) co) = 0%Z) /\ ((g x) = ang_zero)) \/ (~ (((getbv x) co) = 0%Z) /\ ((g x) = (f (htpart x k (width c)))))) -> diagonal1 (diag_cont c co k n f g) g. Axiom diag_cont_spec4 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((((getbv x) co) = 0%Z) /\ ((g x) = ang_zero)) \/ (~ (((getbv x) co) = 0%Z) /\ ((g x) = (f (htpart x k (width c)))))) -> ((size (diag_cont c co k n f g)) <= ((size c) * cont_size)%Z)%Z. Axiom diag_cont_spec5 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((((getbv x) co) = 0%Z) /\ ((g x) = ang_zero)) \/ (~ (((getbv x) co) = 0%Z) /\ ((g x) = (f (htpart x k (width c)))))) -> ((ancillas (diag_cont c co k n f g)) = (ancillas c)). Axiom diag_cont_spec6 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((((getbv x) co) = 0%Z) /\ ((g x) = ang_zero)) \/ (~ (((getbv x) co) = 0%Z) /\ ((g x) = (f (htpart x k (width c)))))) -> ((width (diag_cont c co k n f g)) = n). Axiom diag_cont_spec7 : forall (c:circuit) (co:Z) (k:Z) (n:Z) (f:bitvec -> angle) (g:bitvec -> angle), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= k)%Z /\ (k <= (n - (width c))%Z)%Z) -> ((k + (width c))%Z <= co)%Z -> (diagonal1 c f) -> (forall (x:bitvec), ((length x) = n) -> ((((getbv x) co) = 0%Z) /\ ((g x) = ang_zero)) \/ (~ (((getbv x) co) = 0%Z) /\ ((g x) = (f (htpart x k (width c)))))) -> diagonal1 (diag_cont c co k n f g) g. Parameter gen_phase: Z -> Z -> circuit. Axiom gen_phase_def : forall (k:Z) (n:Z), (0%Z < n)%Z -> (0%Z <= k)%Z -> ((gen_phase k n) = (diag_place (diag_phase k) 0%Z n (fun (us:bitvec) => (int_to_ang 1%Z k)) (fun (us:bitvec) => (int_to_ang 1%Z k)))). Axiom gen_phase_spec : forall (k:Z) (n:Z), (0%Z < n)%Z -> (0%Z <= k)%Z -> diagonal1 (gen_phase k n) (fun (us:bitvec) => (int_to_ang 1%Z k)). Axiom gen_phase_spec1 : forall (k:Z) (n:Z), (0%Z < n)%Z -> (0%Z <= k)%Z -> ((width (gen_phase k n)) = n). Parameter crzp: Z -> Z -> Z -> Z -> circuit. Axiom crzp_def : forall (co:Z) (t:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (0%Z <= k)%Z -> ((crzp co t k n) = (diag_cont (diag_rz k) co t n (fun (x:bitvec) => (int_to_ang ((getbv x) 0%Z) k)) (fun (x:bitvec) => (int_to_ang (((getbv x) co) * ((getbv x) t))%Z k)))). Axiom crzp_spec : forall (co:Z) (t:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (0%Z <= k)%Z -> ((size (crzp co t k n)) <= cont_size)%Z. Axiom crzp_spec1 : forall (co:Z) (t:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (0%Z <= k)%Z -> ((ancillas (crzp co t k n)) = 0%Z). Axiom crzp_spec2 : forall (co:Z) (t:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (0%Z <= k)%Z -> ((width (crzp co t k n)) = n). Axiom crzp_spec3 : forall (co:Z) (t:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (0%Z <= k)%Z -> diagonal1 (crzp co t k n) (fun (x:bitvec) => (int_to_ang (((getbv x) co) * ((getbv x) t))%Z k)). Parameter przp: Z -> Z -> Z -> circuit. Axiom przp_def : forall (i:Z) (k:Z) (n:Z), ((0%Z <= i)%Z /\ (i <= n)%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((przp i k n) = (diag_place (diag_rz i) k n (fun (x:bitvec) => (int_to_ang ((getbv x) 0%Z) i)) (fun (x:bitvec) => (int_to_ang (((getbv x) k) * (power_ 2%Z (n - i)%Z))%Z n)))). Axiom przp_spec : forall (i:Z) (k:Z) (n:Z), ((0%Z <= i)%Z /\ (i <= n)%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((size (przp i k n)) = 1%Z). Axiom przp_spec1 : forall (i:Z) (k:Z) (n:Z), ((0%Z <= i)%Z /\ (i <= n)%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((ancillas (przp i k n)) = 0%Z). Axiom przp_spec2 : forall (i:Z) (k:Z) (n:Z), ((0%Z <= i)%Z /\ (i <= n)%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> ((width (przp i k n)) = n). Axiom przp_spec3 : forall (i:Z) (k:Z) (n:Z), ((0%Z <= i)%Z /\ (i <= n)%Z) -> ((0%Z <= k)%Z /\ (k < n)%Z) -> diagonal1 (przp i k n) (fun (x:bitvec) => (int_to_ang (((getbv x) k) * (power_ 2%Z (n - i)%Z))%Z n)). Parameter crzn: Z -> Z -> Z -> Z -> circuit. Axiom crzn_def : forall (co:Z) (t:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (k <= 0%Z)%Z -> ((crzn co t k n) = (diag_cont (diag_rz_neg k) co t n (fun (x:bitvec) => (int_to_ang (-((getbv x) 0%Z))%Z (-k)%Z)) (fun (x:bitvec) => (int_to_ang ((-((getbv x) co))%Z * ((getbv x) t))%Z (-k)%Z)))). Axiom crzn_spec : forall (co:Z) (t:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (k <= 0%Z)%Z -> ((size (crzn co t k n)) <= cont_size)%Z. Axiom crzn_spec1 : forall (co:Z) (t:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (k <= 0%Z)%Z -> ((ancillas (crzn co t k n)) = 0%Z). Axiom crzn_spec2 : forall (co:Z) (t:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (k <= 0%Z)%Z -> ((width (crzn co t k n)) = n). Axiom crzn_spec3 : forall (co:Z) (t:Z) (k:Z) (n:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (k <= 0%Z)%Z -> diagonal1 (crzn co t k n) (fun (x:bitvec) => (int_to_ang ((-((getbv x) co))%Z * ((getbv x) t))%Z (-k)%Z)). Parameter crzp_up: Z -> Z -> Z -> Z -> Z -> circuit. Axiom crzp_up_def : forall (co:Z) (t:Z) (k:Z) (n:Z) (den:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (0%Z <= k)%Z -> (k <= den)%Z -> ((crzp_up co t k n den) = (crzp co t k n)). Axiom crzp_up_spec : forall (co:Z) (t:Z) (k:Z) (n:Z) (den:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (0%Z <= k)%Z -> (k <= den)%Z -> ((size (crzp_up co t k n den)) <= cont_size)%Z. Axiom crzp_up_spec1 : forall (co:Z) (t:Z) (k:Z) (n:Z) (den:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (0%Z <= k)%Z -> (k <= den)%Z -> ((ancillas (crzp_up co t k n den)) = 0%Z). Axiom crzp_up_spec2 : forall (co:Z) (t:Z) (k:Z) (n:Z) (den:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (0%Z <= k)%Z -> (k <= den)%Z -> ((width (crzp_up co t k n den)) = n). Axiom crzp_up_spec3 : forall (co:Z) (t:Z) (k:Z) (n:Z) (den:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (0%Z <= k)%Z -> (k <= den)%Z -> diagonal1 (crzp_up co t k n den) (fun (x:bitvec) => (int_to_ang ((((getbv x) co) * ((getbv x) t))%Z * (power_ 2%Z (den - k)%Z))%Z den)). Parameter crzn_up: Z -> Z -> Z -> Z -> Z -> circuit. Axiom crzn_up_def : forall (co:Z) (t:Z) (k:Z) (n:Z) (den:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (k <= 0%Z)%Z -> ((-k)%Z <= den)%Z -> ((crzn_up co t k n den) = (crzn co t k n)). Axiom crzn_up_spec : forall (co:Z) (t:Z) (k:Z) (n:Z) (den:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (k <= 0%Z)%Z -> ((-k)%Z <= den)%Z -> ((size (crzn_up co t k n den)) <= cont_size)%Z. Axiom crzn_up_spec1 : forall (co:Z) (t:Z) (k:Z) (n:Z) (den:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (k <= 0%Z)%Z -> ((-k)%Z <= den)%Z -> ((ancillas (crzn_up co t k n den)) = 0%Z). Axiom crzn_up_spec2 : forall (co:Z) (t:Z) (k:Z) (n:Z) (den:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (k <= 0%Z)%Z -> ((-k)%Z <= den)%Z -> ((width (crzn_up co t k n den)) = n). Axiom crzn_up_spec3 : forall (co:Z) (t:Z) (k:Z) (n:Z) (den:Z), ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = co) -> (k <= 0%Z)%Z -> ((-k)%Z <= den)%Z -> diagonal1 (crzn_up co t k n den) (fun (x:bitvec) => (int_to_ang (((-((getbv x) co))%Z * ((getbv x) t))%Z * (power_ 2%Z (den + k)%Z))%Z den)). Parameter c_rzp_one: Z -> Z -> Z -> circuit. Axiom c_rzp_one_def : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t <= co)%Z -> ((c_rzp_one co t n) = (crzp co t 1%Z n)). Axiom c_rzp_one_def1 : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> (t < co)%Z -> ((c_rzp_one co t n) = (crzp co t 1%Z n)). Axiom c_rzp_one_spec : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t <= co)%Z -> ((width (c_rzp_one co t n)) = n). Axiom c_rzp_one_spec1 : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t <= co)%Z -> ((ancillas (c_rzp_one co t n)) = 0%Z). Axiom c_rzp_one_spec2 : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t <= co)%Z -> ((size (c_rzp_one co t n)) <= cont_size)%Z. Axiom c_rzp_one_spec3 : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t <= co)%Z -> diagonal1 (c_rzp_one co t n) (fun (x:bitvec) => (int_to_ang (((getbv x) co) * ((getbv x) t))%Z 1%Z)). Parameter fc30: Z -> Z -> bitvec -> angle. Axiom fc_def30 : forall (co:Z) (t:Z) (x:bitvec), (((((getbv x) co) = ((getbv x) t)) /\ (((getbv x) t) = 1%Z)) -> (((fc30 co t) x) = ang_minus_one)) /\ (~ ((((getbv x) co) = ((getbv x) t)) /\ (((getbv x) t) = 1%Z)) -> (((fc30 co t) x) = ang_zero)). Axiom c_rzp_one_spec4 : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t <= co)%Z -> diagonal1 (c_rzp_one co t n) (fc30 co t). Axiom c_rzp_one_spec5 : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> (t < co)%Z -> ((width (c_rzp_one co t n)) = n). Axiom c_rzp_one_spec6 : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> (t < co)%Z -> ((ancillas (c_rzp_one co t n)) = 0%Z). Axiom c_rzp_one_spec7 : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> (t < co)%Z -> ((size (c_rzp_one co t n)) <= cont_size)%Z. Axiom c_rzp_one_spec8 : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> (t < co)%Z -> diagonal1 (c_rzp_one co t n) (fun (x:bitvec) => (int_to_ang (((getbv x) co) * ((getbv x) t))%Z 1%Z)). Parameter fc31: Z -> Z -> bitvec -> angle. Axiom fc_def31 : forall (co:Z) (t:Z) (x:bitvec), (((((getbv x) co) = ((getbv x) t)) /\ (((getbv x) t) = 1%Z)) -> (((fc31 co t) x) = ang_minus_one)) /\ (~ ((((getbv x) co) = ((getbv x) t)) /\ (((getbv x) t) = 1%Z)) -> (((fc31 co t) x) = ang_zero)). Axiom c_rzp_one_spec9 : forall (co:Z) (t:Z) (n:Z), (n >= 0%Z)%Z -> ((0%Z <= co)%Z /\ (co < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> (t < co)%Z -> diagonal1 (c_rzp_one co t n) (fc31 co t). Parameter cascade_cont_rz_neg: Z -> Z -> Z -> Z -> Z -> circuit. Axiom cascade_cont_rz_neg_def : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> ~ (t <= (first_c + l)%Z)%Z -> (l = 0%Z) -> ((cascade_cont_rz_neg first_k first_c t l n) = (crzn_up first_c t (-first_k)%Z n n)). Axiom cascade_cont_rz_neg_def1 : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> ~ (t <= (first_c + l)%Z)%Z -> ~ (l = 0%Z) -> ((cascade_cont_rz_neg first_k first_c t l n) = (diag_sequence (cascade_cont_rz_neg first_k first_c t (l - 1%Z)%Z n) (crzn_up (first_c + l)%Z t (-(first_k + l)%Z)%Z n n) (fun (x:bitvec) => (int_to_ang (-(ind_isum (fun (k:Z) => ((((getbv x) (first_c + k)%Z) * ((getbv x) t))%Z * (power_ 2%Z (n - (k + first_k)%Z)%Z))%Z) 0%Z l))%Z n)) (fun (x:bitvec) => (int_to_ang (((-((getbv x) (first_c + l)%Z))%Z * ((getbv x) t))%Z * (power_ 2%Z (n - (l + first_k)%Z)%Z))%Z n)) (fun (x:bitvec) => (int_to_ang (-(ind_isum (fun (k:Z) => ((((getbv x) (first_c + k)%Z) * ((getbv x) t))%Z * (power_ 2%Z (n - (k + first_k)%Z)%Z))%Z) 0%Z (l + 1%Z)%Z))%Z n)))). Axiom cascade_cont_rz_neg_def2 : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> (t < first_c)%Z -> (l = 0%Z) -> ((cascade_cont_rz_neg first_k first_c t l n) = (crzn_up first_c t (-first_k)%Z n n)). Axiom cascade_cont_rz_neg_def3 : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> (t < first_c)%Z -> ~ (l = 0%Z) -> ((cascade_cont_rz_neg first_k first_c t l n) = (diag_sequence (cascade_cont_rz_neg first_k first_c t (l - 1%Z)%Z n) (crzn_up (first_c + l)%Z t (-(first_k + l)%Z)%Z n n) (fun (x:bitvec) => (int_to_ang (-(ind_isum (fun (k:Z) => ((((getbv x) (first_c + k)%Z) * ((getbv x) t))%Z * (power_ 2%Z (n - (k + first_k)%Z)%Z))%Z) 0%Z l))%Z n)) (fun (x:bitvec) => (int_to_ang (((-((getbv x) (first_c + l)%Z))%Z * ((getbv x) t))%Z * (power_ 2%Z (n - (l + first_k)%Z)%Z))%Z n)) (fun (x:bitvec) => (int_to_ang (-(ind_isum (fun (k:Z) => ((((getbv x) (first_c + k)%Z) * ((getbv x) t))%Z * (power_ 2%Z (n - (k + first_k)%Z)%Z))%Z) 0%Z (l + 1%Z)%Z))%Z n)))). Axiom cascade_cont_rz_neg_spec : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> ~ (t <= (first_c + l)%Z)%Z -> ((width (cascade_cont_rz_neg first_k first_c t l n)) = n). Axiom cascade_cont_rz_neg_spec1 : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> ~ (t <= (first_c + l)%Z)%Z -> ((ancillas (cascade_cont_rz_neg first_k first_c t l n)) = 0%Z). Axiom cascade_cont_rz_neg_spec2 : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> ~ (t <= (first_c + l)%Z)%Z -> ((size (cascade_cont_rz_neg first_k first_c t l n)) <= (cont_size * (l + 1%Z)%Z)%Z)%Z. Axiom cascade_cont_rz_neg_spec3 : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> ~ (t <= (first_c + l)%Z)%Z -> diagonal1 (cascade_cont_rz_neg first_k first_c t l n) (fun (x:bitvec) => (int_to_ang (-(ind_isum (fun (k:Z) => ((((getbv x) (first_c + k)%Z) * ((getbv x) t))%Z * (power_ 2%Z (n - (k + first_k)%Z)%Z))%Z) 0%Z (l + 1%Z)%Z))%Z n)). Axiom cascade_cont_rz_neg_spec4 : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> (t < first_c)%Z -> ((width (cascade_cont_rz_neg first_k first_c t l n)) = n). Axiom cascade_cont_rz_neg_spec5 : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> (t < first_c)%Z -> ((ancillas (cascade_cont_rz_neg first_k first_c t l n)) = 0%Z). Axiom cascade_cont_rz_neg_spec6 : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> (t < first_c)%Z -> ((size (cascade_cont_rz_neg first_k first_c t l n)) <= (cont_size * (l + 1%Z)%Z)%Z)%Z. Axiom cascade_cont_rz_neg_spec7 : forall (first_k:Z) (first_c:Z) (t:Z) (l:Z) (n:Z), ((0%Z <= l)%Z /\ (l < n)%Z) -> ((0%Z <= first_c)%Z /\ (first_c < n)%Z) -> ((0%Z <= t)%Z /\ (t < n)%Z) -> ((first_c + l)%Z < n)%Z -> (0%Z <= first_k)%Z -> ((first_k + l)%Z <= n)%Z -> (t < first_c)%Z -> diagonal1 (cascade_cont_rz_neg first_k first_c t l n) (fun (x:bitvec) => (int_to_ang (-(ind_isum (fun (k:Z) => ((((getbv x) (first_c + k)%Z) * ((getbv x) t))%Z * (power_ 2%Z (n - (k + first_k)%Z)%Z))%Z) 0%Z (l + 1%Z)%Z))%Z n)). Parameter cascade_cont_qft: Z -> Z -> circuit. Axiom cascade_cont_qft_def : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < (n - 1%Z)%Z)%Z) -> ((cascade_cont_qft t n) = (cascade_cont_rz_neg 2%Z (t + 1%Z)%Z t (n - (t + 2%Z)%Z)%Z n)). Axiom cascade_cont_qft_spec : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < (n - 1%Z)%Z)%Z) -> ((width (cascade_cont_qft t n)) = n). Axiom cascade_cont_qft_spec1 : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < (n - 1%Z)%Z)%Z) -> ((size (cascade_cont_qft t n)) <= (cont_size * ((n - t)%Z - 1%Z)%Z)%Z)%Z. Axiom cascade_cont_qft_spec2 : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < (n - 1%Z)%Z)%Z) -> ((ancillas (cascade_cont_qft t n)) = 0%Z). Axiom cascade_cont_qft_spec3 : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < (n - 1%Z)%Z)%Z) -> diagonal1 (cascade_cont_qft t n) (fun (x:bitvec) => (int_to_ang (-(ind_isum (fun (k:Z) => ((((getbv x) ((t + 1%Z)%Z + k)%Z) * ((getbv x) t))%Z * (power_ 2%Z (n - (k + 2%Z)%Z)%Z))%Z) 0%Z ((n - (t + 2%Z)%Z)%Z + 1%Z)%Z))%Z n)). Axiom cascade_cont_qft_spec4 : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < (n - 1%Z)%Z)%Z) -> diagonal1 (cascade_cont_qft t n) (fun (x:bitvec) => (int_to_ang (-(ind_isum (fun (k:Z) => ((((getbv x) t) * ((getbv x) k))%Z * (power_ 2%Z (((n - k)%Z - 1%Z)%Z + t)%Z))%Z) (t + 1%Z)%Z n))%Z n)). Parameter qft_rev_line: Z -> Z -> circuit. Axiom qft_rev_line_def : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < n)%Z) -> (t = (n - 1%Z)%Z) -> ((qft_rev_line t n) = (place_hadamard_bv t n)). Parameter result23: Z -> bitvec -> bitvec -> Z -> Z. Axiom result_def23 : forall (t:Z) (x:bitvec) (y:bitvec) (i:Z), ((i = t) -> (((result23 t x y) i) = ((getbv y) 0%Z))) /\ (~ (i = t) -> (((result23 t x y) i) = ((getbv x) i))). Axiom qft_rev_line_def1 : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < n)%Z) -> ~ (t = (n - 1%Z)%Z) -> ((qft_rev_line t n) = (sequence_gen_diag (cascade_cont_qft t n) (place_hadamard_bv t n) (fun (x:bitvec) => (int_to_ang (-(ind_isum (fun (k:Z) => ((((getbv x) t) * ((getbv x) k))%Z * (power_ 2%Z (((n - k)%Z - 1%Z)%Z + t)%Z))%Z) (t + 1%Z)%Z n))%Z n)) (fun (x:bitvec) (y:bitvec) => (int_to_ang (-(ind_isum (fun (k:Z) => ((((getbv x) k) * ((getbv y) 0%Z))%Z * (power_ 2%Z (((n - k)%Z - 1%Z)%Z + t)%Z))%Z) t n))%Z n)) (fun (x:bitvec) (y:bitvec) => (make_bv (result23 t x y) n)) 1%Z)). Axiom qft_rev_line_spec : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < n)%Z) -> ((size (qft_rev_line t n)) <= (cont_size * n)%Z)%Z. Axiom qft_rev_line_spec1 : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < n)%Z) -> ((ancillas (qft_rev_line t n)) = 0%Z). Axiom qft_rev_line_spec2 : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < n)%Z) -> ((width (qft_rev_line t n)) = n). Parameter fc32: Z -> bitvec -> bitvec -> Z -> Z. Axiom fc_def32 : forall (t:Z) (x:bitvec) (y:bitvec) (i:Z), ((i = t) -> (((fc32 t x y) i) = ((getbv y) 0%Z))) /\ (~ (i = t) -> (((fc32 t x y) i) = ((getbv x) i))). Axiom qft_rev_line_spec3 : forall (t:Z) (n:Z), ((0%Z <= t)%Z /\ (t < n)%Z) -> correct_path_sum_bv (qft_rev_line t n) 1%Z (fun (x:bitvec) (y:bitvec) => (make_bv (fc32 t x y) n)) (fun (x:bitvec) (y:bitvec) => (int_to_ang (-(ind_isum (fun (j:Z) => ((((getbv x) j) * ((getbv y) 0%Z))%Z * (power_ 2%Z (((n - j)%Z - 1%Z)%Z + t)%Z))%Z) t n))%Z n)). Parameter qft_rev: Z -> circuit. Axiom qft_rev_spec : forall (n:Z), (0%Z < n)%Z -> ((size (qft_rev n)) <= (polysquare n cont_size 0%Z 0%Z))%Z. Axiom qft_rev_spec1 : forall (n:Z), (0%Z < n)%Z -> ((ancillas (qft_rev n)) = 0%Z). Axiom qft_rev_spec2 : forall (n:Z), (0%Z < n)%Z -> ((width (qft_rev n)) = n). Axiom qft_rev_spec3 : forall (n:Z), (0%Z < n)%Z -> correct_path_sum_bv (qft_rev n) n (fun (us:bitvec) (y:bitvec) => y) (fun (x:bitvec) (y:bitvec) => (int_to_ang (ind_isum (fun (l:Z) => (-(ind_isum (fun (k:Z) => ((((getbv x) k) * ((getbv y) l))%Z * (power_ 2%Z (((n - k)%Z - 1%Z)%Z + l)%Z))%Z) l n))%Z) 0%Z n) n)). Parameter qft_rev_coeff: bitvec -> bitvec -> Z -> complex. Axiom qft_rev_coeff_def : forall (x:bitvec) (y:bitvec) (n:Z), (0%Z < n)%Z -> ((qft_rev_coeff x y n) = (ang_exp (real_to_ang (infix_asdt (infix_asdt (i_to_c (-(bv_to_int x))%Z) (i_to_c (bv_to_int (bv_inversion y)))) (pow_inv_2 n))))). Axiom qft_rev_coeff_spec : forall (x:bitvec) (y:bitvec) (n:Z), (0%Z < n)%Z -> ((length x) = n) -> ((length y) = n) -> ((qft_rev_coeff x y n) = (ang_exp (int_to_ang (ind_isum (fun (l:Z) => (-(ind_isum (fun (k:Z) => ((((getbv x) k) * ((getbv y) l))%Z * (power_ 2%Z (((n - k)%Z - 1%Z)%Z + l)%Z))%Z) l n))%Z) 0%Z n) n))). Axiom path_sem_rev_qft_unit : forall (n:Z), (0%Z < n)%Z -> forall (x:matrix complex), (is_a_ket_l x n) -> (is_a_ket_basis_elt x) -> ((path_sem (qft_rev n) x) = (infix_asdtdt (pow_inv_sqrt_2 n) (ket_sum_l (n_bvs n) (fun (y:bitvec) => (infix_asdtdt (qft_rev_coeff (ket_to_bv x) y n) (bv_to_ket y))) n))). Parameter i: Z. Parameter j: Z. Parameter n: Z. Axiom H : (0%Z < n)%Z. Axiom H1 : (i < 0%Z)%Z. Axiom H2 : ((-((int.EuclideanDivision.div i (power_ 2%Z n)) + 1%Z)%Z)%Z = (int.EuclideanDivision.div (-i)%Z (power_ 2%Z n))). Axiom H3 : (((power_ 2%Z n) - (int.EuclideanDivision.mod1 i (power_ 2%Z n)))%Z = (int.EuclideanDivision.mod1 (-i)%Z (power_ 2%Z n))). Axiom H4 : real_ (pow_inv_2 n). Axiom H5 : infix_gtdt (pow_inv_2 n) c_zero. Axiom H6 : ((pow_inv_2 n) = (pow_inv_sqrt_2 (2%Z * n)%Z)). Axiom H7 : ((pow_inv_2 n) = (infix_asdt (pow_inv_sqrt_2 n) (pow_inv_sqrt_2 n))). Axiom H8 : (0%Z <= (int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n))%Z. Axiom H9 : ((int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n) < (power 2%Z n))%Z. Axiom H10 : real_ (i_to_c (int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n)). Axiom H11 : real_ (i_to_c (int.EuclideanDivision.mod1 (-i)%Z (power_ 2%Z n))). Axiom H12 : ((real_to_ang (infix_asdt (infix_asdt (i_to_c (int.EuclideanDivision.mod1 (-i)%Z (power_ 2%Z n))) (i_to_c (int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n))) (pow_inv_2 n))) = (real_to_ang (infix_pldt (i_to_c ((-(int.EuclideanDivision.div i (power_ 2%Z n)))%Z + 1%Z)%Z) (infix_asdt (infix_asdt (i_to_c (int.EuclideanDivision.mod1 (-i)%Z (power_ 2%Z n))) (i_to_c (int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n))) (pow_inv_2 n))))). Axiom H13 : real_ (pow_inv_2 n). Axiom H14 : infix_gtdt (pow_inv_2 n) c_zero. Axiom H15 : ((pow_inv_2 n) = (pow_inv_sqrt_2 (2%Z * n)%Z)). Axiom H16 : ((pow_inv_2 n) = (infix_asdt (pow_inv_sqrt_2 n) (pow_inv_sqrt_2 n))). Axiom H17 : (0%Z <= (int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n))%Z. Axiom H18 : ((int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n) < (power 2%Z n))%Z. Axiom H19 : real_ (i_to_c (int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n)). Axiom H20 : real_ (i_to_c (int.EuclideanDivision.mod1 (-i)%Z (power_ 2%Z n))). Parameter result24: complex. Axiom result_def24 : (result24 = (ang_exp (real_to_ang (infix_asdt (infix_asdt (i_to_c (int.EuclideanDivision.mod1 (-i)%Z (power_ 2%Z n))) (i_to_c (int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n))) (pow_inv_2 n))))). Axiom H21 : ~ (result24 = c_zero). (* Why3 goal *) Theorem VC_int_qft_rev_coeff : ((ang_exp (real_to_ang (infix_pldt (i_to_c ((-(int.EuclideanDivision.div i (power_ 2%Z n)))%Z + 1%Z)%Z) (infix_asdt (infix_asdt (i_to_c (int.EuclideanDivision.mod1 (-i)%Z (power_ 2%Z n))) (i_to_c (int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n))) (pow_inv_2 n))))) = (ang_exp (real_to_ang (infix_asdt (infix_asdt (i_to_c (-(int.EuclideanDivision.mod1 i (power_ 2%Z n)))%Z) (i_to_c (int_bit_inversion (int.EuclideanDivision.mod1 j (power_ 2%Z n)) n))) (pow_inv_2 n))))). Proof. Qed.
SUBROUTINE IC0 (NROW,A,IA,JA,L,IL,JL,JT,jt2,JI,DR,NZLMAX, $ INFO) C IMPLICIT REAL*8(A-H,O-Z) INTEGER*4 INFO, JA(*), NROW, NZLMAX, IA(NROW+1), # IL(NROW+1) INTEGER JL(NZLMAX),JI(*) LOGICAL JT(NROW),JT2(NROW) REAL*8 A(*), DR(NROW), L(NZLMAX) C C Miscellaneous parameters. C REAL*8 ZONE, ZZERO PARAMETER (ZONE = 1.0D0, ZZERO = 0.0D0) REAL*8 DZERO PARAMETER (DZERO = 0.0D0) C C Local variables. C INTEGER I, J, K, KK REAL*8 RSUM, ZSUM C C --- C Computation of the ILUT starts here. C ------------------------------------------------ C Initialize the counters and the data. C INFO = 0 IL(1) = NROW+1 DO 20 J = 1, NROW DR(J) = ZZERO JT(J) = .FALSE. 20 CONTINUE C C Iterate over all rows. All further references to A actually apply C to the matrix as it is modified by the elimination, with possible C fill-in, and not to the original matrix. C DO 90 I = 1, NROW C C Zero out DR. C DO 30 J = 1, NROW IF (JT(J)) THEN DR(J) = ZZERO JT(J) = .FALSE. JT2(J) = .FALSE. END IF 30 CONTINUE C C Spread the Ith row of A into DR. C ITEST = 0 AA=0.0D0 DO 40 K = IA(I), IA(I+1)-1 J = JA(K) IF(I.GT.J) THEN DR(J) = A(K) JT(J) = .TRUE. JT2(J) = .TRUE. ENDIF IF(I.EQ.J) THEN AA=AA+A(K) ITEST = 1 ENDIF 40 CONTINUE IF(Itest.eq.0) write(*,*)'Ca foire!' C C Compute the full row I of L. C Iterate over the columns of row I, up to the diagonal. C RSUM = ZZERO DO 60 J = 1, I-1 ZSUM = ZZERO C C Iterate over the columns of row J, up to the diagonal. C DO 50 KK = IL(J), IL(J+1)-1 K = JL(KK) C C If a common nonzero element, ZSUM += L(I,K) * L(J,K). C IF (JT(K)) ZSUM = ZSUM + L(KK) * DR(K) 50 CONTINUE C C L(I,J) = ( A(I,J) - ZSUM ) / L(J,J). C If nonzero, add it to the running row sum. C ZSUM = ( DR(J) - ZSUM ) * L(J) IF (DABS(ZSUM).EQ.DZERO) GO TO 60 DR(J) = ZSUM JT(J) = .TRUE. RSUM = RSUM + ZSUM * ZSUM 60 CONTINUE IF (AA.GT.RSUM) THEN L(I) = DSQRT( AA - RSUM ) ELSE L(I)=1.0D0 WRITE(*,*)'L -> 1',AA,RSUM,I ENDIF C C Elimination of the Ith row of A is complete. C K=0 DO 70 J=1,I-1 IF(JT(J)) THEN K=K+1 JI(K)=J ENDIF 70 CONTINUE JPTR = K KK = IL(I) IF (KK+K-1.GT.NZLMAX) INFO = 1 IF (INFO.EQ.0) THEN DO 80 JJ = JPTR, JPTR-K+1, -1 J = JI(JJ) if(jt2(j))then JL(KK) = J L(KK) = DR(J) KK = KK + 1 endif 80 CONTINUE END IF C IL(I+1) = KK C C Extract the diagonal element. C L(I) = ZONE / L(I) C 90 CONTINUE OPEN(UNIT=1,FILE='llt.m',STATUS='UNKNOWN') Do i=1,NROW write(1,*)'L(',i,',',i,')=',1.0D0/l(i),';' DO j=IL(i),IL(i+1)-1 write(1,*)'L(',i,',',jl(j),')=',l(j),';' ENDDO ENDDO CLOSE(1) C C ------------------------------------ C WRITE (6,'(A15,I10)') 'Elements in L: ', IL(NROW+1)-1 C 120 RETURN C END
// This file is part of Eigen, a lightweight C++ template library // for linear algebra. // // Copyright (C) 2011 Gael Guennebaud <[email protected]> // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, you can redistribute it and/or // modify it under the terms of the GNU General Public License as // published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen 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 Lesser General Public License or the // GNU General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. #include "sparse_solver.h" #include <Eigen/CholmodSupport> template<typename T> void test_cholmod_T() { CholmodDecomposition<SparseMatrix<T>, Lower> g_chol_colmajor_lower; g_chol_colmajor_lower.setMode(CholmodSupernodalLLt); CholmodDecomposition<SparseMatrix<T>, Upper> g_chol_colmajor_upper; g_chol_colmajor_upper.setMode(CholmodSupernodalLLt); CholmodDecomposition<SparseMatrix<T>, Lower> g_llt_colmajor_lower; g_llt_colmajor_lower.setMode(CholmodSimplicialLLt); CholmodDecomposition<SparseMatrix<T>, Upper> g_llt_colmajor_upper; g_llt_colmajor_upper.setMode(CholmodSimplicialLLt); CholmodDecomposition<SparseMatrix<T>, Lower> g_ldlt_colmajor_lower; g_ldlt_colmajor_lower.setMode(CholmodLDLt); CholmodDecomposition<SparseMatrix<T>, Upper> g_ldlt_colmajor_upper; g_ldlt_colmajor_upper.setMode(CholmodLDLt); CholmodSupernodalLLT<SparseMatrix<T>, Lower> chol_colmajor_lower; CholmodSupernodalLLT<SparseMatrix<T>, Upper> chol_colmajor_upper; CholmodSimplicialLLT<SparseMatrix<T>, Lower> llt_colmajor_lower; CholmodSimplicialLLT<SparseMatrix<T>, Upper> llt_colmajor_upper; CholmodSimplicialLDLT<SparseMatrix<T>, Lower> ldlt_colmajor_lower; CholmodSimplicialLDLT<SparseMatrix<T>, Upper> ldlt_colmajor_upper; check_sparse_spd_solving(g_chol_colmajor_lower); check_sparse_spd_solving(g_chol_colmajor_upper); check_sparse_spd_solving(g_llt_colmajor_lower); check_sparse_spd_solving(g_llt_colmajor_upper); check_sparse_spd_solving(g_ldlt_colmajor_lower); check_sparse_spd_solving(g_ldlt_colmajor_upper); check_sparse_spd_solving(chol_colmajor_lower); check_sparse_spd_solving(chol_colmajor_upper); check_sparse_spd_solving(llt_colmajor_lower); check_sparse_spd_solving(llt_colmajor_upper); check_sparse_spd_solving(ldlt_colmajor_lower); check_sparse_spd_solving(ldlt_colmajor_upper); // check_sparse_spd_determinant(chol_colmajor_lower); // check_sparse_spd_determinant(chol_colmajor_upper); // check_sparse_spd_determinant(llt_colmajor_lower); // check_sparse_spd_determinant(llt_colmajor_upper); // check_sparse_spd_determinant(ldlt_colmajor_lower); // check_sparse_spd_determinant(ldlt_colmajor_upper); } void test_cholmod_support() { CALL_SUBTEST_1(test_cholmod_T<double>()); CALL_SUBTEST_2(test_cholmod_T<std::complex<double> >()); }
#' A quantile-quantile plot #' #' `geom_qq()` and `stat_qq()` produce quantile-quantile plots. `geom_qq_line()` and #' `stat_qq_line()` compute the slope and intercept of the line connecting the #' points at specified quartiles of the theoretical and sample distributions. #' #' @eval rd_aesthetics("stat", "qq") #' @eval rd_aesthetics("stat", "qq_line") #' @param distribution Distribution function to use, if x not specified #' @param dparams Additional parameters passed on to `distribution` #' function. #' @inheritParams layer #' @inheritParams geom_point #' @section Computed variables: #' Variables computed by `stat_qq()`: #' \describe{ #' \item{sample}{sample quantiles} #' \item{theoretical}{theoretical quantiles} #' } #' Variables computed by `stat_qq_line()`: #' \describe{ #' \item{x}{x-coordinates of the endpoints of the line segment connecting the #' points at the chosen quantiles of the theoretical and the sample #' distributions} #' \item{y}{y-coordinates of the endpoints} #' } #' @export #' @examples #' \donttest{ #' df <- data.frame(y = rt(200, df = 5)) #' p <- ggplot(df, aes(sample = y)) #' p + stat_qq() + stat_qq_line() #' #' # Use fitdistr from MASS to estimate distribution params #' params <- as.list(MASS::fitdistr(df$y, "t")$estimate) #' ggplot(df, aes(sample = y)) + #' stat_qq(distribution = qt, dparams = params["df"]) + #' stat_qq_line(distribution = qt, dparams = params["df"]) #' #' # Using to explore the distribution of a variable #' ggplot(mtcars, aes(sample = mpg)) + #' stat_qq() + #' stat_qq_line() #' ggplot(mtcars, aes(sample = mpg, colour = factor(cyl))) + #' stat_qq() + #' stat_qq_line() #' } geom_qq <- function(mapping = NULL, data = NULL, geom = "point", position = "identity", ..., distribution = stats::qnorm, dparams = list(), na.rm = FALSE, show.legend = NA, inherit.aes = TRUE) { layer( data = data, mapping = mapping, stat = StatQq, geom = geom, position = position, show.legend = show.legend, inherit.aes = inherit.aes, params = list( distribution = distribution, dparams = dparams, na.rm = na.rm, ... ) ) } #' @export #' @rdname geom_qq stat_qq <- geom_qq #' @rdname ggplot2-ggproto #' @format NULL #' @usage NULL #' @export StatQq <- ggproto("StatQq", Stat, default_aes = aes(y = after_stat(sample), x = after_stat(theoretical)), required_aes = c("sample"), compute_group = function(data, scales, quantiles = NULL, distribution = stats::qnorm, dparams = list(), na.rm = FALSE) { sample <- sort(data$sample) n <- length(sample) # Compute theoretical quantiles if (is.null(quantiles)) { quantiles <- stats::ppoints(n) } else if (length(quantiles) != n) { abort("length of quantiles must match length of data") } theoretical <- do.call(distribution, c(list(p = quote(quantiles)), dparams)) new_data_frame(list(sample = sample, theoretical = theoretical)) } )
header {* Concrete example *} theory Refinement_Example imports Refinement begin text {* In this section, we present a concrete example ofthe use of our environment. We define two Circus processes FIG and DFIG, using our syntax. we give the proof of refinement (simulation) of the first processby the second one using the simulation function $Sim$.*} subsection {* Process definitions *} circus_process FIG = alphabet = [v::nat, x::nat] state = [idS::"nat set"] channel = [out nat , req , ret nat] schema Init = "idS' = {}" schema Out = "\<exists> a. v' = a \<and> a \<notin> idS \<and> idS' = idS \<union> {v'}" schema Remove = "x \<in> idS \<and> idS' = idS - {x}" where "var v \<bullet> (Schema FIG.Init`;` \<mu> X \<bullet> (((((req \<rightarrow> (Schema FIG.Out))`;` out`!`(hd o v) \<rightarrow> Skip)) \<box> (ret`?`x \<rightarrow> (Schema FIG.Remove)))`;` X))" circus_process DFIG = alphabet = [v::nat, x::nat] state = [retidS::"nat set", max::nat] channel = FIG_channels schema Init = "retidS' = {} \<and> max' = 0" schema Out = "v' = max \<and> max' = (max + 1) \<and> retidS' = retidS - {v'}" schema Remove = "x < max \<and> retidS' = retidS \<union> {x} \<and> max' = max" where "var v \<bullet> (Schema DFIG.Init`;` \<mu> X \<bullet> ((((req \<rightarrow> (Schema DFIG.Out))`;` (out`!`(hd o v) \<rightarrow> Skip)) \<box> (ret`?`x \<rightarrow> (Schema DFIG.Remove)))`;` X))" definition Sim where "Sim A = FIG_alphabet.make (DFIG_alphabet.v A) (DFIG_alphabet.x A) ({a. a < (DFIG_alphabet.max A) \<and> a \<notin> (DFIG_alphabet.retidS A)})" subsection {* Simulation proofs *} text {* For the simulation proof, we give first proofs for simulation over the schema expressions. The proof is then given over the main actions of the processes.*} lemma SimInit: "(Schema FIG.Init) \<preceq>Sim (Schema DFIG.Init)" apply (auto simp: Sim_def Pre_def design_defs DFIG.Init_def FIG.Init_def rp_defs alpha_rp.defs DFIG_alphabet.defs FIG_alphabet.defs intro!: Schema_Sim) apply (rule_tac x="A\<lparr>max := 0, retidS := {}\<rparr>" in exI, simp) done lemma SimOut: "(Schema FIG.Out) \<preceq>Sim (Schema DFIG.Out)" apply (rule Schema_Sim) apply (auto simp: Pre_def DFIG_alphabet.defs FIG_alphabet.defs alpha_rp.defs Sim_def FIG.Out_def DFIG.Out_def) apply (rule_tac x="a\<lparr>v := [DFIG_alphabet.max a], max := (Suc (DFIG_alphabet.max a)), retidS := retidS a - {DFIG_alphabet.max a}\<rparr>" in exI, simp) apply (rule_tac x="a\<lparr>v := [DFIG_alphabet.max a], max := (Suc (DFIG_alphabet.max a)), retidS := retidS a - {DFIG_alphabet.max a}\<rparr>" in exI, simp) done lemma SimRemove: "(Schema FIG.Remove) \<preceq>Sim (Schema DFIG.Remove)" apply (rule Schema_Sim) apply (auto simp: Pre_def DFIG_alphabet.defs FIG_alphabet.defs alpha_rp.defs Sim_def) apply (clarsimp simp add: DFIG.Remove_def FIG.Remove_def) apply (rule_tac x="a\<lparr>retidS := insert (hd (DFIG_alphabet.x a)) (retidS a)\<rparr>" in exI, simp) apply (auto simp add: DFIG.Remove_def FIG.Remove_def) done lemma "FIG.FIG \<preceq>Sim DFIG.DFIG" by (auto simp: DFIG.DFIG_def FIG.FIG_def mono_Seq SimRemove SimOut SimInit Sim_def FIG_alphabet.defs intro!:Var_Sim Seq_Sim Mu_Sim Det_Sim Write0_Sim Write_Sim Read_Sim Skip_Sim) end
lemma measurable_sets_Collect: assumes f: "f \<in> measurable M N" and P: "{x\<in>space N. P x} \<in> sets N" shows "{x\<in>space M. P (f x)} \<in> sets M"
Require Import Reals. Require Import Lra. Require Import Rtopology. Require Import Rminmax. Require Import Ensembles. Local Open Scope R_scope. Ltac rabs_delta F Heqdelt := unfold Rabs; destruct Rcase_abs; unfold Rabs in F; destruct Rcase_abs in F; unfold Rmin in Heqdelt; destruct Rle_dec in Heqdelt; try lra. Theorem intersection_open_sets_is_open (A B : Ensemble R) : open_set A -> open_set B -> open_set (Intersection R A B). Proof. intros H1 H2. unfold open_set in *. intros x G. destruct G as [x G1 G2]; unfold In in *. unfold included. specialize (H1 x G1); destruct H1 as [[delt1 delt1pos] H1]. specialize (H2 x G2); destruct H2 as [[delt2 delt2pos] H2]. unfold included, disc, included in H1; simpl in H1. unfold included, disc, included in H2; simpl in H2. remember (Rmin delt1 delt2) as delt; assert (deltpos : delt > 0). { rewrite Heqdelt. compute; destruct Rle_dec. - apply delt1pos. - apply delt2pos. } exists (mkposreal delt deltpos). unfold included, disc; intros x' F; simpl in F. apply Intersection_intro; unfold In. - apply H1; rabs_delta F Heqdelt. - apply H2; rabs_delta F Heqdelt. Qed.
function [vnz,rnz,parent,c,leftmost,p,q] = cs_sqr (A) %#ok %CS_SQR symbolic sparse QR factorization. % [vnz,rnz,parent,c,leftmost,p] = cs_sqr(A): symbolic QR of A(p,:). % [vnz,rnz,parent,c,leftmost,p,q] = cs_sqr(A) computes the symbolic QR % factorization of A(p,q). The fill-reducing ordering q is found via % q = cs_amd(A,3). % % vnz is the number of entries in the matrix of Householder vectors, V. % rnz is the number of entries in R. parent is elimination tree. % c(i) is the number of entries in R(i,:). leftmost(i) = min(find(A(i,q))). % p is the row permutation used to ensure R has a symbolically zero-free % diagonal (it can be larger than m if A is structurally rank deficient). % q is the fill-reducing ordering, if requested. % % Example: % Prob = UFget ('HB/ibm32') ; A = Prob.A ; % [vnz, rnz, parent, c, leftmost, p, q] = cs_sqr (A) ; % cspy (A (p,q)) ; % % See also CS_AMD, CS_QR. % % Copyright 2006-2007, Timothy A. Davis. % http://www.cise.ufl.edu/research/sparse error ('cs_sqr mexFunction not found') ;
(* Author: Jose Divasón Email: [email protected] *) section \<open>The Cauchy--Binet formula in HOL Analysis\<close> theory Cauchy_Binet_HOL_Analysis imports Cauchy_Binet Perron_Frobenius.HMA_Connect begin subsection \<open>Definition of submatrices in HOL Analysis\<close> definition submatrix_hma :: "'a^'nc^'nr\<Rightarrow>nat set\<Rightarrow>nat set\<Rightarrow>('a^'nc2^'nr2)" where "submatrix_hma A I J = (\<chi> a b. A $h (from_nat (pick I (to_nat a))) $h (from_nat (pick J (to_nat b))))" context includes lifting_syntax begin context fixes I::"nat set" and J::"nat set" assumes I: "card {i. i < CARD('nr::finite) \<and> i \<in> I} = CARD('nr2::finite)" assumes J: "card {i. i < CARD('nc::finite) \<and> i \<in> J} = CARD('nc2::finite)" begin lemma HMA_submatrix[transfer_rule]: "(HMA_M ===> HMA_M) (\<lambda>A. submatrix A I J) ((\<lambda>A. submatrix_hma A I J):: 'a^ 'nc ^ 'nr \<Rightarrow> 'a ^ 'nc2 ^ 'nr2)" proof (intro rel_funI, goal_cases) case (1 A B) note relAB[transfer_rule] = this show ?case unfolding HMA_M_def proof (rule eq_matI, auto) show "dim_row (submatrix A I J) = CARD('nr2)" unfolding submatrix_def using I dim_row_transfer_rule relAB by force show "dim_col (submatrix A I J) = CARD('nc2)" unfolding submatrix_def using J dim_col_transfer_rule relAB by force let ?B="(submatrix_hma B I J)::'a ^ 'nc2 ^ 'nr2" fix i j assume i: "i < CARD('nr2)" and j: "j < CARD('nc2)" have i2: "i < card {i. i < dim_row A \<and> i \<in> I}" using I dim_row_transfer_rule i relAB by fastforce have j2: "j < card {j. j < dim_col A \<and> j \<in> J}" using J dim_col_transfer_rule j relAB by fastforce let ?i = "(from_nat (pick I i))::'nr" let ?j = "(from_nat (pick J j))::'nc" let ?i' = "Bij_Nat.to_nat ((Bij_Nat.from_nat i)::'nr2)" let ?j' = "Bij_Nat.to_nat ((Bij_Nat.from_nat j)::'nc2)" have i': "?i' = i" by (rule to_nat_from_nat_id[OF i]) have j': "?j' = j" by (rule to_nat_from_nat_id[OF j]) let ?f = "(\<lambda>(i, j). B $h Bij_Nat.from_nat (pick I (Bij_Nat.to_nat ((Bij_Nat.from_nat i)::'nr2))) $h Bij_Nat.from_nat (pick J (Bij_Nat.to_nat ((Bij_Nat.from_nat j)::'nc2))))" have [transfer_rule]: "HMA_I (pick I i) ?i" by (simp add: Bij_Nat.to_nat_from_nat_id I i pick_le HMA_I_def) have [transfer_rule]: "HMA_I (pick J j) ?j" by (simp add: Bij_Nat.to_nat_from_nat_id J j pick_le HMA_I_def) have "submatrix A I J $$ (i, j) = A $$ (pick I i, pick J j)" by (rule submatrix_index[OF i2 j2]) also have "... = index_hma B ?i ?j" by (transfer, simp) also have "... = B $h Bij_Nat.from_nat (pick I (Bij_Nat.to_nat ((Bij_Nat.from_nat i)::'nr2))) $h Bij_Nat.from_nat (pick J (Bij_Nat.to_nat ((Bij_Nat.from_nat j)::'nc2)))" unfolding i' j' index_hma_def by auto also have "... = ?f (i,j)" by auto also have "... = Matrix.mat CARD('nr2) CARD('nc2) ?f $$ (i, j)" by (rule index_mat[symmetric, OF i j]) also have "... = from_hma\<^sub>m ?B $$ (i, j)" unfolding from_hma\<^sub>m_def submatrix_hma_def by auto finally show "submatrix A I J $$ (i, j) = from_hma\<^sub>m ?B $$ (i, j)" . qed qed end end subsection \<open>Transferring the proof from JNF to HOL Analysis\<close> lemma Cauchy_Binet_HOL_Analysis: fixes A::"'a::comm_ring_1^'m^'n" and B::"'a^'n^'m" shows "Determinants.det (A**B) = (\<Sum>I\<in>{I. I\<subseteq>{0..<ncols A} \<and> card I=nrows A}. Determinants.det ((submatrix_hma A UNIV I)::'a^'n^'n) * Determinants.det ((submatrix_hma B I UNIV)::'a^'n^'n))" proof - let ?A = "(from_hma\<^sub>m A)" let ?B = "(from_hma\<^sub>m B)" have relA[transfer_rule]: "HMA_M ?A A" unfolding HMA_M_def by simp have relB[transfer_rule]: "HMA_M ?B B" unfolding HMA_M_def by simp have "(\<Sum>I\<in>{I. I\<subseteq>{0..<ncols A} \<and> card I = nrows A}. Determinants.det ((submatrix_hma A UNIV I)::'a^'n^'n) * Determinants.det ((submatrix_hma B I UNIV)::'a^'n^'n)) = (\<Sum>I\<in>{I. I\<subseteq>{0..<ncols A} \<and> card I=nrows A}. det (submatrix ?A UNIV I) * det (submatrix ?B I UNIV))" proof (rule sum.cong) fix I assume I: "I \<in>{I. I\<subseteq>{0..<ncols A} \<and> card I=nrows A}" let ?sub_A= "((submatrix_hma A UNIV I)::'a^'n^'n)" let ?sub_B= "((submatrix_hma B I UNIV)::'a^'n^'n)" have c1: "card {i. i < CARD('n) \<and> i \<in> UNIV} = CARD('n)" using I by auto have c2: "card {i. i < CARD('m) \<and> i \<in> I} = CARD('n)" proof - have "I = {i. i < CARD('m) \<and> i \<in> I}" using I unfolding nrows_def ncols_def by auto thus ?thesis using I nrows_def by auto qed have [transfer_rule]: "HMA_M (submatrix ?A UNIV I) ?sub_A" using HMA_submatrix[OF c1 c2] relA unfolding rel_fun_def by auto have [transfer_rule]: "HMA_M (submatrix ?B I UNIV) ?sub_B" using HMA_submatrix[OF c2 c1] relB unfolding rel_fun_def by auto show "Determinants.det ?sub_A * Determinants.det ?sub_B = det (submatrix ?A UNIV I) * det (submatrix ?B I UNIV)" by (transfer', auto) qed (auto) also have "... = det (?A*?B)" by (rule Cauchy_Binet[symmetric], unfold nrows_def ncols_def, auto) also have "... = Determinants.det (A**B)" by (transfer', auto) finally show ?thesis .. qed end
## Exercise 2.5 In this exercise, we prove that the beta distribution, given by $$ \mathrm{Beta}(\mu|a, b) = \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)}\mu^{a-1}(1-\mu)^{b-1}, $$ is correctly normalized, so that $\int_0^1\mathrm{Beta}(\mu|a, b)d\mu = 1$. ### Solution This is equivalent to showing that $$ \int_0^1\mu^{a-1}(1-\mu)^{b-1}d\mu = \frac{\Gamma(a+b)}{\Gamma(a)\Gamma(b)} $$ From the definition of the gamma function, we have $$ \Gamma(a)\Gamma(b) = \int_0^\infty\exp(-x)x^{a-1}dx\int_0^\infty\exp(-y)y^{b-1}dy $$ Let $t = y + x$, we obtain \begin{align} \Gamma(a)\Gamma(b) & = \int_0^\infty x^{a-1}\left\{\int_x^\infty \exp(-t)(t-x)^{b-1}\mathrm{d}t\right\}\mathrm{d}x \\ & = \int_0^\infty\int_0^t x^{a-1}\exp(-t)(t-x)^{b-1}\mathrm{d}x\mathrm{d}t \end{align} Change the variables in the $x$ integral using $x=t\mu$ to give \begin{aligned} \Gamma(a)\Gamma(b) & = \int_0^\infty\exp(-t)t^{a-1}t^{b-1}t\mathrm{d}t\int_0^1\mu^{a-1}(1-\mu)^{b-1}\mathrm{d}\mu \\ & = \Gamma(a+b)\int_0^1\mu^{a-1}(1-\mu)^{b-1}\mathrm{d}\mu \end{aligned}
------------------------------------------------------------------------ -- The Agda standard library -- -- Some derivable properties ------------------------------------------------------------------------ open import Algebra module Algebra.Properties.AbelianGroup {g₁ g₂} (G : AbelianGroup g₁ g₂) where import Algebra.Properties.Group as GP open import Data.Product open import Function import Relation.Binary.EqReasoning as EqR open AbelianGroup G open EqR setoid open GP group public private lemma : ∀ x y → x ∙ y ∙ x ⁻¹ ≈ y lemma x y = begin x ∙ y ∙ x ⁻¹ ≈⟨ comm _ _ ⟨ ∙-cong ⟩ refl ⟩ y ∙ x ∙ x ⁻¹ ≈⟨ assoc _ _ _ ⟩ y ∙ (x ∙ x ⁻¹) ≈⟨ refl ⟨ ∙-cong ⟩ proj₂ inverse _ ⟩ y ∙ ε ≈⟨ proj₂ identity _ ⟩ y ∎ ⁻¹-∙-comm : ∀ x y → x ⁻¹ ∙ y ⁻¹ ≈ (x ∙ y) ⁻¹ ⁻¹-∙-comm x y = begin x ⁻¹ ∙ y ⁻¹ ≈⟨ comm _ _ ⟩ y ⁻¹ ∙ x ⁻¹ ≈⟨ sym $ lem ⟨ ∙-cong ⟩ refl ⟩ x ∙ (y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹) ∙ x ⁻¹ ≈⟨ lemma _ _ ⟩ y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹ ≈⟨ lemma _ _ ⟩ (x ∙ y) ⁻¹ ∎ where lem = begin x ∙ (y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹) ≈⟨ sym $ assoc _ _ _ ⟩ x ∙ (y ∙ (x ∙ y) ⁻¹) ∙ y ⁻¹ ≈⟨ sym $ assoc _ _ _ ⟨ ∙-cong ⟩ refl ⟩ x ∙ y ∙ (x ∙ y) ⁻¹ ∙ y ⁻¹ ≈⟨ proj₂ inverse _ ⟨ ∙-cong ⟩ refl ⟩ ε ∙ y ⁻¹ ≈⟨ proj₁ identity _ ⟩ y ⁻¹ ∎
{-# OPTIONS --rewriting --prop #-} open import common open import syntx open import derivability {- Here are the structural rules, as derivation rules -} module _ (Σ : Signature) where {- Γ ⊢ A (x : A) ∈ Γ -------------------- Γ ⊢ x : A -} -- The version of the variable rule we use is that Γ ⊢ x : A if Γ ⊢ A holds, and if A is the type -- corresponding to x in Γ. VarRule : (k : ℕ) → DerivationRule Σ (([] , (0 , Ty)) , Tm) rule (VarRule k) ↑ Γ ([] , ◇ ⊢ A) = do (k' , A') ← get k Γ assume (A' ≡ A) return (◇ ⊢ var k' :> A) ConvRule : DerivationRule Σ (([] , (0 , Tm) , (0 , Ty=)) , Tm) rule ConvRule ↑ Γ ([] , ◇ ⊢ u :> A , ◇ ⊢ A' == B) = do assume (A ≡ A') return (◇ ⊢ u :> B) ConvEqRule : DerivationRule Σ (([] , (0 , Tm=) , (0 , Ty=)) , Tm=) rule ConvEqRule ↑ Γ ([] , ◇ ⊢ u == v :> A , ◇ ⊢ A' == B) = do assume (A ≡ A') return (◇ ⊢ u == v :> B) TyReflRule : DerivationRule Σ (([] , (0 , Ty)) , Ty=) rule TyReflRule ↑ Γ ([] , ◇ ⊢ A) = return (◇ ⊢ A == A) TySymmRule : DerivationRule Σ (([] , (0 , Ty=)) , Ty=) rule TySymmRule ↑ Γ ([] , ◇ ⊢ A == B) = return (◇ ⊢ B == A) TyTranRule : DerivationRule Σ (([] , (0 , Ty=) , (0 , Ty=)) , Ty=) rule TyTranRule ↑ Γ ([] , ◇ ⊢ A == B , ◇ ⊢ B' == D) = -- Can’t use C as a bound variable as it’s a tag. do assume (B ≡ B') return (◇ ⊢ A == D) TmReflRule : DerivationRule Σ (([] , (0 , Tm)) , Tm=) rule TmReflRule ↑ Γ ([] , ◇ ⊢ u :> A) = return (◇ ⊢ u == u :> A) TmSymmRule : DerivationRule Σ (([] , (0 , Tm=)) , Tm=) rule TmSymmRule ↑ Γ ([] , ◇ ⊢ u == v :> A) = return (◇ ⊢ v == u :> A) TmTranRule : DerivationRule Σ (([] , (0 , Tm=) , (0 , Tm=)) , Tm=) rule TmTranRule ↑ Γ ([] , ◇ ⊢ u == v :> A , ◇ ⊢ v' == w :> A') = do assume (v ≡ v') assume (A ≡ A') return (◇ ⊢ u == w :> A) {- Small hack to make our life easier, the implicit argument [ar] of [StructuralRulesType] is automatically inferred from the definition of [StructuralRules], but for that they need to be mutually recursive -} StructuralRules : DerivabilityStructure Σ -- See #4366 private ar1 = _ ar2 = _ ar3 = _ ar4 = _ ar5 = _ ar6 = _ ar7 = _ ar8 = _ ar9 = _ data StructuralRulesType : {ar : JudgmentArity} → Set where var : ℕ → StructuralRulesType {ar1} conv : StructuralRulesType {ar2} convEq : StructuralRulesType {ar3} tyRefl : StructuralRulesType {ar4} tySymm : StructuralRulesType {ar5} tyTran : StructuralRulesType {ar6} tmRefl : StructuralRulesType {ar7} tmSymm : StructuralRulesType {ar8} tmTran : StructuralRulesType {ar9} Rules StructuralRules S ar = StructuralRulesType {ar} Rules StructuralRules T ar = Empty Rules StructuralRules C ar = Empty Rules StructuralRules Eq ar = Empty derivationRule StructuralRules {t = S} (var k) = VarRule k derivationRule StructuralRules {t = S} conv = ConvRule derivationRule StructuralRules {t = S} convEq = ConvEqRule derivationRule StructuralRules {t = S} tyRefl = TyReflRule derivationRule StructuralRules {t = S} tySymm = TySymmRule derivationRule StructuralRules {t = S} tyTran = TyTranRule derivationRule StructuralRules {t = S} tmRefl = TmReflRule derivationRule StructuralRules {t = S} tmSymm = TmSymmRule derivationRule StructuralRules {t = S} tmTran = TmTranRule
{- This file contains: - Definition of set truncations -} {-# OPTIONS --safe #-} module Cubical.HITs.SetTruncation.Base where open import Cubical.Core.Primitives open import Cubical.Foundations.Pointed -- set truncation as a higher inductive type: data ∥_∥₂ {ℓ} (A : Type ℓ) : Type ℓ where ∣_∣₂ : A → ∥ A ∥₂ squash₂ : ∀ (x y : ∥ A ∥₂) (p q : x ≡ y) → p ≡ q -- Pointed version ∥_∥₂∙ : ∀ {ℓ} (A : Pointed ℓ) → Pointed ℓ fst ∥ A ∥₂∙ = ∥ fst A ∥₂ snd ∥ A ∥₂∙ = ∣ pt A ∣₂
{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE Strict #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} {-| Module : Grenade.Layers.LeakyTanh Description : Hyperbolic tangent nonlinear layer Copyright : (c) Huw Campbell, 2016-2017 License : BSD2 Stability : experimental -} module Grenade.Layers.LeakyTanh ( LeakyTanh(..) , SpecLeakyTanh (..) , specLeakyTanh1D , specLeakyTanh2D , specLeakyTanh3D , specLeakyTanh , leakyTanhLayer ) where import Control.DeepSeq (NFData (..)) import Data.Constraint (Dict (..)) import Data.Proxy import Data.Reflection (reifyNat) import Data.Serialize import Data.Singletons import GHC.Generics (Generic) import GHC.TypeLits import qualified Numeric.LinearAlgebra.Static as LAS import Unsafe.Coerce (unsafeCoerce) import Grenade.Core import Grenade.Dynamic import Grenade.Dynamic.Internal.Build import Grenade.Types import Grenade.Utils.Conversion import Grenade.Utils.Vector -- | A LeakyTanh layer. A layer which can act between any shape of the same dimension, performing a tanh function. The maximum value is given in Promille, i.e. 995 is 0.995, and is positive and negative. I.e. LeakyTanh(x) = min 0.995 (max (-0.995) x). data LeakyTanh (v :: Nat) = LeakyTanh deriving (Generic,NFData,Show) instance UpdateLayer (LeakyTanh maxVal) where type Gradient (LeakyTanh maxVal) = () runUpdate _ l@LeakyTanh{} _ = l instance RandomLayer (LeakyTanh maxVal) where createRandomWith _ _ = return LeakyTanh instance Serialize (LeakyTanh maxVal) where put _ = return () get = return LeakyTanh instance (a ~ b, SingI a, KnownNat maxVal) => Layer (LeakyTanh maxVal) a b where type Tape (LeakyTanh maxVal) a b = S a runForwards _ (S1DV v) = (S1DV v, S1DV $ mapVector (tanhMax maxVal) v) where maxVal = (/ 1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) runForwards _ (S2DV v) = (S2DV v, S2DV $ mapVector (tanhMax maxVal) v) where maxVal = (/ 1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) runForwards _ (S1D a) = (S1D a, S1D $ LAS.dvmap (tanhMax maxVal) a) where maxVal = (/ 1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) runForwards _ (S2D a) = (S2D a, S2D $ LAS.dmmap (tanhMax maxVal) a) where maxVal = (/ 1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) runForwards _ (S3D a) = (S3D a, S3D $ LAS.dmmap (tanhMax maxVal) a) where maxVal = (/ 1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) runBackwards _ (S1DV v) (S1DV gs) = ((), S1DV $ zipWithVector (\t g -> tanhMax' maxVal t * g) v gs) where maxVal = (/ 1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) runBackwards _ (S2DV v) (S2DV gs) = ((), S2DV $ zipWithVector (\t g -> tanhMax' maxVal t * g) v gs) where maxVal = (/ 1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) runBackwards _ (S1D a) (S1D g) = ((), S1D $ LAS.dvmap (tanhMax' maxVal) a * g) where maxVal = (/ 1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) runBackwards _ (S2D a) (S2D g) = ((), S2D $ LAS.dmmap (tanhMax' maxVal) (tanh' a) * g) where maxVal = (/ 1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) runBackwards _ (S3D a) (S3D g) = ((), S3D $ LAS.dmmap (tanhMax' maxVal) (tanh' a) * g) where maxVal = (/ 1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) runBackwards l x y = runBackwards l x (toLayerShape x y) tanhMax :: (Ord a, Fractional a) => a -> a -> a tanhMax m v | v > m = leaky * (v - m) + m | v < -m = leaky * (v - m) - m | otherwise = v where leaky = 0.05 tanhMax' :: (Ord a, Fractional a, Floating a) => a -> a -> a tanhMax' m v | v > m = leaky | v < -m = -leaky | otherwise = max 0.005 (tanh' v) where leaky = 0.05 tanh' :: (Floating a) => a -> a tanh' t = 1 - s ^ (2 :: Int) where s = tanh t -------------------- DynamicNetwork instance -------------------- instance (KnownNat maxVal) => FromDynamicLayer (LeakyTanh maxVal) where fromDynamicLayer inp _ LeakyTanh = SpecNetLayer $ SpecLeakyTanh maxVal (tripleFromSomeShape inp) where maxVal = (/1000) $ fromIntegral $ max 0 $ min 1000 $ natVal (Proxy :: Proxy maxVal) instance ToDynamicLayer SpecLeakyTanh where toDynamicLayer _ _ (SpecLeakyTanh maxVal (rows, cols, depth)) = reifyNat rows $ \(_ :: (KnownNat rows) => Proxy rows) -> reifyNat cols $ \(_ :: (KnownNat cols) => Proxy cols) -> reifyNat depth $ \(_ :: (KnownNat depth) => Proxy depth) -> reifyNat (round $ 1000 * maxVal) $ \(_ :: (KnownNat maxVal) => Proxy maxVal) -> case (rows, cols, depth) of (_, 1, 1) -> case (unsafeCoerce (Dict :: Dict()) :: Dict ()) of Dict -> return $ SpecLayer (LeakyTanh :: LeakyTanh maxVal) (sing :: Sing ('D1 rows)) (sing :: Sing ('D1 rows)) (_, _, 1) -> case (unsafeCoerce (Dict :: Dict()) :: Dict ()) of Dict -> return $ SpecLayer (LeakyTanh :: LeakyTanh maxVal) (sing :: Sing ('D2 rows cols)) (sing :: Sing ('D2 rows cols)) _ -> case (unsafeCoerce (Dict :: Dict()) :: Dict (KnownNat (rows GHC.TypeLits.* depth))) of Dict -> return $ SpecLayer (LeakyTanh :: LeakyTanh maxVal) (sing :: Sing ('D3 rows cols depth)) (sing :: Sing ('D3 rows cols depth)) -- | Create a specification for a LeakyTanh layer. specLeakyTanh1D :: RealNum -> Integer -> SpecNet specLeakyTanh1D maxVal i = specLeakyTanh3D maxVal (i, 1, 1) -- | Create a specification for a LeakyTanh layer. specLeakyTanh2D :: RealNum -> (Integer, Integer) -> SpecNet specLeakyTanh2D maxVal (i, j) = specLeakyTanh3D maxVal (i, j, 1) -- | Create a specification for a LeakyTanh layer. specLeakyTanh3D :: RealNum -> (Integer, Integer, Integer) -> SpecNet specLeakyTanh3D maxVal = SpecNetLayer . SpecLeakyTanh maxVal -- | Create a specification for a LeakyTanh layer. specLeakyTanh :: RealNum -> (Integer, Integer, Integer) -> SpecNet specLeakyTanh maxVal = SpecNetLayer . SpecLeakyTanh maxVal -- | Add a LeakyTanh layer to your build. leakyTanhLayer :: RealNum -> BuildM () leakyTanhLayer maxVal | maxVal <= 0 || maxVal > 1 = error "The maxVal parameter of tanhMaxLayer has to be in (0,1]" | otherwise = buildGetLastLayerOut >>= buildAddSpec . SpecNetLayer . SpecLeakyTanh maxVal -------------------- GNum instances -------------------- instance GNum (LeakyTanh maxVal) where _ |* _ = LeakyTanh _ |+ _ = LeakyTanh sumG _ = LeakyTanh
module Basic.Compiler.Code where open import Basic.AST open import Basic.BigStep open import Utils.Decidable open import Utils.Monoid open import Data.Fin using (Fin; #_) open import Data.Vec hiding (_∷ʳ_; _++_; [_]) open import Data.Nat open import Data.Bool renaming (not to notBool; if_then_else_ to ifBool_then_else) open import Data.List hiding ([_]) open import Data.List.Properties open import Relation.Binary.PropositionalEquality open import Function open import Data.Product open import Relation.Nullary open import Relation.Nullary.Decidable open import Data.Empty open import Algebra import Level as L private module LM {a A} = Algebra.Monoid (Data.List.monoid {a} A) {- Chapter 3.1 and 3.2. Semantics of an abstract machine and specification of the translation from While syntax to the abstract machine syntax. -} {- Definition of the stack and the AM We follow the book closely here. "nat-inj" and "bool-inj" just establish injectivity of context entry constructors. That we have to prove them is something of a limitation of the current Agda. In contrast, Coq derives injectivity of constructors automatically. -} data StackEntry : Set where nat : ℕ → StackEntry bool : Bool → StackEntry nat-inj : ∀ {n m} → (StackEntry ∋ nat n) ≡ nat m → n ≡ m nat-inj refl = refl bool-inj : ∀ {b b'} → (StackEntry ∋ bool b) ≡ bool b' → b ≡ b' bool-inj refl = refl Stack : Set Stack = List StackEntry mutual data Inst (n : ℕ) : Set where PUSH : ℕ → Inst n FETCH STORE : Fin n → Inst n ADD MUL SUB TRUE FALSE EQ LTE LT AND NOT NOOP : Inst n BRANCH LOOP : Code n → Code n → Inst n Code : ℕ → Set Code = List ∘ Inst -- Semantics ------------------------------------------------------------ data ⟨_,_,_⟩▷⟨_,_,_⟩ {n} : Code n → Stack → State n → Code n → Stack → State n → Set where PUSH : ∀ n {c e s} → -------------------------------------------- ⟨ PUSH n ∷ c , e , s ⟩▷⟨ c , nat n ∷ e , s ⟩ ADD : ∀ a b {c e s} → --------------------------------------------------------------- ⟨ ADD ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , nat (a + b) ∷ e , s ⟩ MUL : ∀ a b {c e s} → ---------------------------------------------------------------- ⟨ MUL ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , nat (a * b) ∷ e , s ⟩ SUB : ∀ a b {c e s} → ---------------------------------------------------------------- ⟨ SUB ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , nat (a ∸ b) ∷ e , s ⟩ TRUE : ∀ {c e s} → ----------------------------------------------- ⟨ TRUE ∷ c , e , s ⟩▷⟨ c , bool true ∷ e , s ⟩ FALSE : ∀ {c e s} → ------------------------------------------------ ⟨ FALSE ∷ c , e , s ⟩▷⟨ c , bool false ∷ e , s ⟩ EQ : ∀ a b {c e s} → ------------------------------------------------------------------- ⟨ EQ ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , bool ⌊ a ≡⁇ b ⌋ ∷ e , s ⟩ LT : ∀ a b {c e s} → ------------------------------------------------------------------- ⟨ LT ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , bool ⌊ a <⁇ b ⌋ ∷ e , s ⟩ LTE : ∀ a b {c e s} → -------------------------------------------------------------------- ⟨ LTE ∷ c , nat a ∷ nat b ∷ e , s ⟩▷⟨ c , bool ⌊ a ≤⁇ b ⌋ ∷ e , s ⟩ AND : ∀ a b {c e s} → ------------------------------------------------------------------- ⟨ AND ∷ c , bool a ∷ bool b ∷ e , s ⟩▷⟨ c , bool (a ∧ b) ∷ e , s ⟩ NOT : ∀ b {c e s} → ----------------------------------------------------------- ⟨ NOT ∷ c , bool b ∷ e , s ⟩▷⟨ c , bool (notBool b) ∷ e , s ⟩ FETCH : ∀ x {c e s} → --------------------------------------------------------- ⟨ FETCH x ∷ c , e , s ⟩▷⟨ c , nat (lookup x s) ∷ e , s ⟩ STORE : ∀ x {n c e s} → ------------------------------------------------------ ⟨ STORE x ∷ c , nat n ∷ e , s ⟩▷⟨ c , e , s [ x ]≔ n ⟩ BRANCH : ∀ {c₁ c₂ c t e s} → let c' = (ifBool t then c₁ else c₂) <> c in -------------------------------------------------------------- ⟨ BRANCH c₁ c₂ ∷ c , bool t ∷ e , s ⟩▷⟨ c' , e , s ⟩ NOOP : ∀ {c e s} → ------------------------------------ ⟨ NOOP ∷ c , e , s ⟩▷⟨ c , e , s ⟩ LOOP : ∀ {c₁ c₂ c e s} → let c' = c₁ <> BRANCH (c₂ ∷ʳ LOOP c₁ c₂ ) (NOOP ∷ []) ∷ c in ----------------------------------------------------------------------------------- ⟨ LOOP c₁ c₂ ∷ c , e , s ⟩▷⟨ c' , e , s ⟩ -- Computation sequences ------------------------------------------------------------ infixr 5 _∷_ data ⟨_,_,_⟩▷*⟨_,_,_⟩ {n} : Code n → Stack → State n → Code n → Stack → State n → Set where done : ∀ {e s} → --------------------------------- ⟨ [] , e , s ⟩▷*⟨ [] , e , s ⟩ {- We define "being stuck" explicitly as a configuration from which no transitions exist -} stuck : ∀ {c cs e s} → (∀ c' e' s' → ¬ ⟨ c ∷ cs , e , s ⟩▷⟨ c' , e' , s' ⟩) → ------------------------------------------------------------ ⟨ c ∷ cs , e , s ⟩▷*⟨ c ∷ cs , e , s ⟩ _∷_ : ∀ {c e s c' e' s' c'' e'' s''} → ⟨ c , e , s ⟩▷⟨ c' , e' , s' ⟩ → ⟨ c' , e' , s' ⟩▷*⟨ c'' , e'' , s'' ⟩ → ------------------------------------------------------------------------ ⟨ c , e , s ⟩▷*⟨ c'' , e'' , s'' ⟩ {- We will need the length of computation sequences for the compiler correctness proof -} ▷*-length : ∀ {n}{c c' e e'}{s s' : State n} → ⟨ c , e , s ⟩▷*⟨ c' , e' , s' ⟩ → ℕ ▷*-length done = 0 ▷*-length (stuck x) = 0 ▷*-length (x ∷ p) = suc (▷*-length p) -- Determinism (exercise 3.6) ------------------------------------------------------------ ▷-deterministic : ∀ {n}{c c' c'' e e' e''}{s s' s'' : State n} → ⟨ c , e , s ⟩▷⟨ c' , e' , s' ⟩ → ⟨ c , e , s ⟩▷⟨ c'' , e'' , s'' ⟩ → (c' ≡ c'') × (e' ≡ e'') × (s' ≡ s'') ▷-deterministic (PUSH n₁) (PUSH .n₁) = refl , refl , refl ▷-deterministic (ADD a b) (ADD .a .b) = refl , refl , refl ▷-deterministic (MUL a b) (MUL .a .b) = refl , refl , refl ▷-deterministic (SUB a b) (SUB .a .b) = refl , refl , refl ▷-deterministic TRUE TRUE = refl , refl , refl ▷-deterministic FALSE FALSE = refl , refl , refl ▷-deterministic (EQ a b) (EQ .a .b) = refl , refl , refl ▷-deterministic (LT a b) (LT .a .b) = refl , refl , refl ▷-deterministic (LTE a b) (LTE .a .b) = refl , refl , refl ▷-deterministic (AND a b) (AND .a .b) = refl , refl , refl ▷-deterministic (NOT b) (NOT .b) = refl , refl , refl ▷-deterministic (FETCH x) (FETCH .x) = refl , refl , refl ▷-deterministic (STORE x) (STORE .x) = refl , refl , refl ▷-deterministic BRANCH BRANCH = refl , refl , refl ▷-deterministic NOOP NOOP = refl , refl , refl ▷-deterministic LOOP LOOP = refl , refl , refl ▷*-deterministic : ∀ {n}{c c' c'' e e' e''}{s s' s'' : State n} → ⟨ c , e , s ⟩▷*⟨ c' , e' , s' ⟩ → ⟨ c , e , s ⟩▷*⟨ c'' , e'' , s'' ⟩ → (c' ≡ c'') × (e' ≡ e'') × (s' ≡ s'') ▷*-deterministic done done = refl , refl , refl ▷*-deterministic done (() ∷ p2) ▷*-deterministic (stuck x) (stuck x₁) = refl , refl , refl ▷*-deterministic (stuck x) (x₁ ∷ p2) = ⊥-elim (x _ _ _ x₁) ▷*-deterministic (() ∷ p1) done ▷*-deterministic (x ∷ p1) (stuck x₁) = ⊥-elim (x₁ _ _ _ x) ▷*-deterministic (x ∷ p1) (x₁ ∷ p2) with ▷-deterministic x x₁ ... | eq1 , eq2 , eq3 rewrite eq1 | eq2 | eq3 = ▷*-deterministic p1 p2 -- Compilation (chapter 3.2) ------------------------------------------------------------ 𝓒⟦_⟧ᵉ : ∀ {n t} → Exp n t → Code n 𝓒⟦ lit x ⟧ᵉ = PUSH x ∷ [] 𝓒⟦ add a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ ADD 𝓒⟦ mul a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ MUL 𝓒⟦ sub a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ SUB 𝓒⟦ var x ⟧ᵉ = FETCH x ∷ [] 𝓒⟦ tt ⟧ᵉ = TRUE ∷ [] 𝓒⟦ ff ⟧ᵉ = FALSE ∷ [] 𝓒⟦ eq a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ EQ 𝓒⟦ lte a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ LTE 𝓒⟦ lt a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ LT 𝓒⟦ Exp.and a b ⟧ᵉ = 𝓒⟦ b ⟧ᵉ <> 𝓒⟦ a ⟧ᵉ ∷ʳ AND 𝓒⟦ not e ⟧ᵉ = 𝓒⟦ e ⟧ᵉ ∷ʳ NOT 𝓒⟦_⟧ˢ : ∀ {n} → St n → Code n 𝓒⟦ x := e ⟧ˢ = 𝓒⟦ e ⟧ᵉ ∷ʳ STORE x 𝓒⟦ skip ⟧ˢ = NOOP ∷ [] 𝓒⟦ s₁ , s₂ ⟧ˢ = 𝓒⟦ s₁ ⟧ˢ <> 𝓒⟦ s₂ ⟧ˢ 𝓒⟦ if b then st₁ else st₂ ⟧ˢ = 𝓒⟦ b ⟧ᵉ ∷ʳ BRANCH 𝓒⟦ st₁ ⟧ˢ 𝓒⟦ st₂ ⟧ˢ 𝓒⟦ while b do st ⟧ˢ = LOOP 𝓒⟦ b ⟧ᵉ 𝓒⟦ st ⟧ˢ ∷ [] ------------------------------------------------------------ {- Some additional lemmas needed to the compiler correctness proofs. -} {- A weaker variant of exercise 3.4 -} weaken-step-code : ∀ {n}{c c' c'' e e'}{s s' : State n} → ⟨ c , e , s ⟩▷⟨ c' , e' , s' ⟩ → ⟨ c <> c'' , e , s ⟩▷⟨ c' <> c'' , e' , s' ⟩ weaken-step-code (PUSH n₁) = PUSH n₁ weaken-step-code (ADD a b) = ADD a b weaken-step-code (MUL a b) = MUL a b weaken-step-code (SUB a b) = SUB a b weaken-step-code TRUE = TRUE weaken-step-code FALSE = FALSE weaken-step-code (EQ a b) = EQ a b weaken-step-code (LT a b) = LT a b weaken-step-code (LTE a b) = LTE a b weaken-step-code (AND a b) = AND a b weaken-step-code (NOT b) = NOT b weaken-step-code (FETCH x) = FETCH x weaken-step-code (STORE x) = STORE x weaken-step-code {c'' = c''}(BRANCH {c₁}{c₂}{c}{t}) rewrite LM.assoc (ifBool t then c₁ else c₂) c c'' = BRANCH weaken-step-code {c'' = c''}(LOOP {c₁}{c₂}{c}) rewrite LM.assoc c₁ (BRANCH (c₂ ∷ʳ LOOP c₁ c₂) (NOOP ∷ []) ∷ c) c'' = LOOP weaken-step-code NOOP = NOOP {- This lemma is not in the book, but it's very convenient to use in the following proofs. It's just the analogue of Basic.SmallStep.append for the computation sequences here. -} infixr 5 _▷*<>_ _▷*<>_ : ∀ {n c c' e e' e''}{s s' s'' : State n} → ⟨ c , e , s ⟩▷*⟨ [] , e' , s' ⟩ → ⟨ c' , e' , s' ⟩▷*⟨ [] , e'' , s'' ⟩ → ⟨ c <> c' , e , s ⟩▷*⟨ [] , e'' , s'' ⟩ _▷*<>_ done p2 = p2 _▷*<>_ (step ∷ p1) p2 = weaken-step-code step ∷ p1 ▷*<> p2 {- Lemma 3.18 -} 𝓒-Exp-nat : ∀ {n e}{s : State n} exp -> ⟨ 𝓒⟦ exp ⟧ᵉ , e , s ⟩▷*⟨ [] , nat (⟦ exp ⟧ᵉ s) ∷ e , s ⟩ 𝓒-Exp-nat (lit x) = PUSH x ∷ done 𝓒-Exp-nat (add a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> (ADD _ _ ∷ done) 𝓒-Exp-nat (mul a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> (MUL _ _ ∷ done) 𝓒-Exp-nat (sub a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> (SUB _ _ ∷ done) 𝓒-Exp-nat (var x) = FETCH x ∷ done {- Lemma 3.19 -} 𝓒-Exp-bool : ∀ {n e}{s : State n} exp -> ⟨ 𝓒⟦ exp ⟧ᵉ , e , s ⟩▷*⟨ [] , bool (⟦ exp ⟧ᵉ s) ∷ e , s ⟩ 𝓒-Exp-bool tt = TRUE ∷ done 𝓒-Exp-bool ff = FALSE ∷ done 𝓒-Exp-bool (eq a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> EQ _ _ ∷ done 𝓒-Exp-bool (lte a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> LTE _ _ ∷ done 𝓒-Exp-bool (lt a b) = (𝓒-Exp-nat b ▷*<> 𝓒-Exp-nat a) ▷*<> LT _ _ ∷ done 𝓒-Exp-bool (Exp.and a b) = (𝓒-Exp-bool b ▷*<> 𝓒-Exp-bool a) ▷*<> AND _ _ ∷ done 𝓒-Exp-bool (not e) = 𝓒-Exp-bool e ▷*<> NOT _ ∷ done {- A "smart constructor" that gets rid of the trailing (++[]) at the end of the branch. This is not mentioned in the book, because it (rightfully) assumes that appendding an empty list to the end of a list results in the same list, while here we have to make this property explicit -} BRANCH-[] : ∀ {n c₁ c₂ e t}{s : State n} → let c' = ifBool t then c₁ else c₂ in ⟨ BRANCH c₁ c₂ ∷ [] , bool t ∷ e , s ⟩▷⟨ c' , e , s ⟩ BRANCH-[] {n}{c₁}{c₂}{e}{t}{s} = subst (λ b → ⟨ BRANCH c₁ c₂ ∷ [] , bool t ∷ e , s ⟩▷⟨ b , e , s ⟩) (proj₂ LM.identity (ifBool t then c₁ else c₂)) BRANCH
section\<open>Some demonstrations\<close> theory Demonstrations imports Definitions_Main begin text\<open>The following theory is only intended to explore some details of the formalization and to show the appearance of relevant internalized formulas. It is \<^bold>\<open>not\<close> intended as the entry point of the session. For that purpose, consult \<^theory>\<open>Independence_CH.Definitions_Main\<close>\<close> text\<open>The snippet (by M. Pagano) commented out below outputs a directed graph picturing the locale structure.\<close> \<comment> \<open> ML\<open>Locale.pretty_locale_deps @{theory} |> map (fn n => let val nom = #name n in map (writeln o (fn p => "\"" ^ p ^ "\" -> \"" ^ nom ^ "\";")) (#parents n) end) \<close> \<close> locale Demo = M_trivial + M_AC + fixes t\<^sub>1 t\<^sub>2 assumes ts_in_nat[simp]: "t\<^sub>1\<in>\<omega>" "t\<^sub>2\<in>\<omega>" and power_infty: "power_ax(M)" "M(\<omega>)" begin text\<open>The next fake lemma is intended to explore the instances of the axiom schemes that are needed to build our forcing models. They are categorized as plain replacements (using \<^term>\<open>strong_replacement\<close>), “lambda-replacements” using a higher order function, replacements to perform transfinite and general well-founded recursion (using \<^term>\<open>transrec_replacement\<close> and \<^term>\<open>wfrec_replacement\<close> respectively) and for the construction of fixpoints (using \<^term>\<open>iterates_replacement\<close>). Lastly, separations instances.\<close> lemma assumes sorried_replacements: "\<And>P. strong_replacement(M,P)" "\<And>F. lam_replacement(M,F)" "\<And>Q S. iterates_replacement(M,Q,S)" "\<And>Q S. wfrec_replacement(M,Q,S)" "\<And>Q S. transrec_replacement(M,Q,S)" and sorried_separations: "\<And>Q. separation(M,Q)" shows "M_master(M)" apply unfold_locales apply (simp_all add: sorried_replacements(1-2) sorried_separations power_infty) oops \<comment> \<open>NOTE: Only for pretty-printing purposes, overrides previous fundamental notations\<close> no_notation mem (infixl \<open>\<in>\<close> 50) no_notation conj (infixr \<open>\<and>\<close> 35) no_notation disj (infixr \<open>\<or>\<close> 30) no_notation iff (infixr \<open>\<longleftrightarrow>\<close> 25) no_notation imp (infixr \<open>\<longrightarrow>\<close> 25) no_notation not (\<open>\<not> _\<close> [40] 40) no_notation All (\<open>'(\<forall>_')\<close>) no_notation Ex (\<open>'(\<exists>_')\<close>) no_notation Member (\<open>\<cdot>_ \<in>/ _\<cdot>\<close>) no_notation Equal (\<open>\<cdot>_ =/ _\<cdot>\<close>) no_notation Nand (\<open>\<cdot>\<not>'(_ \<and>/ _')\<cdot>\<close>) no_notation And (\<open>\<cdot>_ \<and>/ _\<cdot>\<close>) no_notation Or (\<open>\<cdot>_ \<or>/ _\<cdot>\<close>) no_notation Iff (\<open>\<cdot>_ \<leftrightarrow>/ _\<cdot>\<close>) no_notation Implies (\<open>\<cdot>_ \<rightarrow>/ _\<cdot>\<close>) no_notation Neg (\<open>\<cdot>\<not>_\<cdot>\<close>) no_notation Forall (\<open>'(\<cdot>\<forall>(/_)\<cdot>')\<close>) no_notation Exists (\<open>'(\<cdot>\<exists>(/_)\<cdot>')\<close>) notation Member (infixl \<open>\<in>\<close> 50) notation Equal (infixl \<open>\<equiv>\<close> 50) notation Nand (\<open>\<not>'(_ \<and>/ _')\<close>) notation And (infixr \<open>\<and>\<close> 35) notation Or (infixr \<open>\<or>\<close> 30) notation Iff (infixr \<open>\<longleftrightarrow>\<close> 25) notation Implies (infixr \<open>\<longrightarrow>\<close> 25) notation Neg (\<open>\<not> _\<close> [40] 40) notation Forall (\<open>'(\<forall>_')\<close>) notation Exists (\<open>'(\<exists>_')\<close>) lemma "forces(t\<^sub>1\<in>t\<^sub>2) = (0 \<in> 1 \<and> forces_mem_fm(1, 2, 0, t\<^sub>1+\<^sub>\<omega>4, t\<^sub>2+\<^sub>\<omega>4))" unfolding forces_def by simp (* \<comment> \<open>Prefix abbreviated notation\<close> notation Member (\<open>M\<close>) notation Equal (\<open>Eq\<close>) notation Nand (\<open>Na\<close>) notation And (\<open>A\<close>) notation Or (\<open>O\<close>) notation Iff (\<open>If\<close>) notation Implies (\<open>Im\<close>) notation Neg (\<open>Ne\<close>) notation Forall (\<open>Fo\<close>) notation Exists (\<open>Ex\<close>) *) (* forces_mem_fm(1, 2, 0, t\<^sub>1+\<^sub>\<omega>4, t\<^sub>1+\<^sub>\<omega>4) = forces_mem_fm(1, 2, 0, succ(succ(succ(succ(t\<^sub>1)))), succ(succ(succ(succ(t\<^sub>2))))) = \<dots> *) definition forces_0_mem_1 where "forces_0_mem_1\<equiv>forces_mem_fm(1,2,0,t\<^sub>1+\<^sub>\<omega>4,t\<^sub>2+\<^sub>\<omega>4)" thm forces_0_mem_1_def[ unfolded frc_at_fm_def ftype_fm_def name1_fm_def name2_fm_def snd_snd_fm_def hcomp_fm_def ecloseN_fm_def eclose_n1_fm_def eclose_n2_fm_def is_eclose_fm_def mem_eclose_fm_def eclose_n_fm_def is_If_fm_def least_fm_def Replace_fm_def Collect_fm_def fm_definitions,simplified] (* NOTE: in view of the above, @{thm [source] fm_definitions} might be incomplete *) named_theorems incr_bv_new_simps schematic_goal incr_bv_Neg(* [incr_bv_new_simps] *): "mem(n,\<omega>) \<Longrightarrow> mem(\<phi>,formula) \<Longrightarrow> incr_bv(Neg(\<phi>))`n = ?x" unfolding Neg_def by simp schematic_goal incr_bv_Exists [incr_bv_new_simps]: "mem(n,\<omega>) \<Longrightarrow> mem(\<phi>,formula) \<Longrightarrow> incr_bv(Exists(\<phi>))`n = ?x" unfolding Exists_def by (simp add: incr_bv_Neg) (* schematic_goal incr_bv_And [incr_bv_new_simps]: "mem(n,\<omega>) \<Longrightarrow> mem(\<phi>,formula) \<Longrightarrow>mem(\<psi>,formula)\<Longrightarrow> incr_bv(And(\<phi>,\<psi>))`n = ?x" unfolding And_def by (simp add: incr_bv_Neg) schematic_goal incr_bv_Or [incr_bv_new_simps]: "mem(n,\<omega>) \<Longrightarrow> mem(\<phi>,formula) \<Longrightarrow>mem(\<psi>,formula)\<Longrightarrow> incr_bv(Or(\<phi>,\<psi>))`n = ?x" unfolding Or_def by (simp add: incr_bv_Neg) schematic_goal incr_bv_Implies [incr_bv_new_simps]: "mem(n,\<omega>) \<Longrightarrow> mem(\<phi>,formula) \<Longrightarrow>mem(\<psi>,formula)\<Longrightarrow> incr_bv(Implies(\<phi>,\<psi>))`n = ?x" unfolding Implies_def by (simp add: incr_bv_Neg) *) \<comment> \<open>The two renamings involved in the definition of \<^term>\<open>forces\<close> depend on the recursive function \<^term>\<open>incr_bv\<close>. Here we have an apparently exponential bottleneck, since all the propositional connectives (even \<^term>\<open>Neg\<close>) duplicate the appearances of \<^term>\<open>incr_bv\<close>. Not even the double negation of an atomic formula can be managed by the system (in version 2021-1).\<close> (* schematic_goal "forces(\<not>\<not>0\<in>1) = ?x" unfolding forces_def Neg_def by (simp add:ren_forces_nand_def ren_forces_forall_def frc_at_fm_def ftype_fm_def name1_fm_def name2_fm_def snd_snd_fm_def hcomp_fm_def ecloseN_fm_def eclose_n1_fm_def eclose_n2_fm_def is_eclose_fm_def mem_eclose_fm_def eclose_n_fm_def is_If_fm_def least_fm_def Collect_fm_def fm_definitions incr_bv_Neg incr_bv_Exists) (* exception Size raised (line 183 of "./basis/LibrarySupport.sml") *) *) (* declare is_ContHyp_fm_def[fm_definitions del] thm is_ContHyp_fm_def[unfolded is_eclose_fm_def mem_eclose_fm_def eclose_n_fm_def is_If_fm_def least_fm_def Replace_fm_def Collect_fm_def fm_definitions, simplified] *) end \<comment> \<open>\<^locale>\<open>Demo\<close>\<close> end
= = Attacks on Orsogna = =
State Before: α : Type u l : List α n : ℕ h : length l = 0 ⊢ rotate l n = rotate' l n State After: no goals Tactic: simp_all [length_eq_zero] State Before: α : Type u l : List α n : ℕ h : ¬length l = 0 ⊢ rotate l n = rotate' l n State After: α : Type u l : List α n : ℕ h : ¬length l = 0 ⊢ rotate l n = drop (n % length l) l ++ take (n % length l) l Tactic: rw [← rotate'_mod, rotate'_eq_drop_append_take (le_of_lt (Nat.mod_lt _ (Nat.pos_of_ne_zero h)))] State Before: α : Type u l : List α n : ℕ h : ¬length l = 0 ⊢ rotate l n = drop (n % length l) l ++ take (n % length l) l State After: no goals Tactic: simp [rotate]
function [Y,x,DCM] = spm_dcm_generate(syn_model,SNR,show_graphics) % Generate synthetic data from a DCM specification % FORMAT [Y,x,DCM] = spm_dcm_generate(syn_model,SNR) % % syn_model - Name of synthetic DCM file % SNR - Signal to noise ratio [default: 1] % show_graphics - Whether to plot each timeseries [default: true] % % This routine will update the DCM.Y field as follows: % Y.y - synthetic BOLD data % Y.secs - overall number of seconds % Y.Q - components of error precision % % and will enter neuronal activity (first hidden var in each region) into % DCM.x % % Y - Simulated (Noisy) BOLD data % x - Simulated neuronal activity (first hidden variable in each region) % DCM - Full generative model % %__________________________________________________________________________ % Copyright (C) 2002-2014 Wellcome Trust Centre for Neuroimaging % Will Penny & Klaas Enno Stephan % $Id: spm_dcm_generate.m 6716 2016-02-08 18:21:37Z peter $ % Check parameters and load specified DCM %-------------------------------------------------------------------------- if isstruct(syn_model) DCM = syn_model; syn_model = ['DCM-' date '.mat']; else load(syn_model) end if nargin < 2 || isempty(SNR) SNR = 1; end if nargin < 3 || isempty(show_graphics) show_graphics = true; end % Unpack %-------------------------------------------------------------------------- U = DCM.U; % inputs v = DCM.v; % number of scans n = DCM.n; % number of regions m = size(U.u,2); % number of inputs % Check whether the model is stable by examining the eigenvalue % spectrum for the intrinsic connectivity matrix %-------------------------------------------------------------------------- [is_stable, eigval] = spm_dcm_check_stability(DCM); if ~is_stable fprintf('Modelled system is potentially unstable:\n'); fprintf('Lyapunov exponent of combined connectivity matrix is %f\n',max(eigval)); fprintf('Check the output to ensure that values are in a normal range.\n') end % check whether this is a nonlinear DCM %-------------------------------------------------------------------------- if ~isfield(DCM,'d') || isempty(DCM.d) DCM.d = zeros(n,n,0); M.IS = 'spm_int'; else M.IS = 'spm_int_D'; end % priors %-------------------------------------------------------------------------- [pE,pC] = spm_dcm_fmri_priors(DCM.a,DCM.b,DCM.c,DCM.d); % complete model specification %-------------------------------------------------------------------------- M.f = 'spm_fx_fmri'; M.g = 'spm_gx_state_fmri'; M.x = sparse(n,5); M.pE = pE; M.pC = pC; M.m = size(U.u,2); M.n = size(M.x(:),1); M.l = size(M.x,1)*2; % twice as many "outputs" (as hemo and neuronal) M.N = 32; M.dt = 16/M.N; M.ns = v; % fMRI slice time sampling %-------------------------------------------------------------------------- try, M.delays = DCM.delays; end try, M.TE = DCM.TE; end % twice as many "outputs" (hemo and neuronal) - need this to coerce spm_int %-------------------------------------------------------------------------- M.delays = [M.delays; M.delays]; % Integrate and compute hemodynamic response at v sample points %-------------------------------------------------------------------------- y = feval(M.IS,DCM.Ep,M,U); % Compute required r: standard deviation of additive noise, for all areas %-------------------------------------------------------------------------- if isinf(SNR) r = zeros(n,n); else r = diag(std(y(:,1:n))/SNR); end % Add noise %-------------------------------------------------------------------------- p = 1; a = 1/16; a = [1 -a]; K = inv(spdiags(ones(v,1)*a,-[0:p],v,v)); K = K*sqrt(v/trace(K*K')); z = randn(v,n); e = K*z; Y = DCM.Y; Y.Q = spm_Ce(v*ones(1,n)); Y.y = y(:,1:n) + e*r; x = y(:,n+1:2*n); Y.secs = Y.dt*v; % Save synthetic DCM %-------------------------------------------------------------------------- DCM.Y = Y; % simulated data DCM.y = y(:,1:n); % simulated BOLD DCM.x = x; % simulated neuronal DCM.M = M; % model save(syn_model, 'DCM', spm_get_defaults('mat.format')); if spm('CmdLine') || ~show_graphics, return; end % Display the time series generated %-------------------------------------------------------------------------- spm_figure('GetWin','Simulated BOLD time series'); t = Y.dt*[1:1:v]; for i = 1:n, subplot(n,1,i); plot(t,Y.y(:,i)); title(sprintf('Region %s', Y.name{i})); if i<n set(gca,'XTickLabel',[]); end end xlabel('secs'); spm_figure('GetWin','Simulated Neuronal Activity'); t = Y.dt*[1:1:v]; for i = 1:n, subplot(n,1,i); plot(t,x(:,i)); title(sprintf('Region %s', Y.name{i})); if i<n set(gca,'XTickLabel',[]); end end xlabel('secs');
C C premaptform.f and maptform.f copied from RIP/src C By So-Young Ha on Sep 29, 2005. C C C NCLFORTSTART SUBROUTINE DMAPTFORM(DSKMC,MIYCORS,MJXCORS,NPROJ,XLATC,XLONC, + TRUE1,TRUE2,RIY,RJX,RLAT,RLON,IDIR) C C Input vars: DSKMC, MIYCORS, MJXCORS, NPROJ, XLATC, XLONC, C NPROJ, IDIR C Input/output vars: RIY, RIX, RLAT C Output vars: TRUE1, TRUE2, RLON C C C Possible NCL interface: C C wrf_maptform(dskmc, miycors, mjxcors, nproj, xlatc, xlonc, riy, rjx, C idir, rlat, rlon, opts) C C where opts could contain the TRUE1 and TRUE2 information in some fashion. C DOUBLE PRECISION PI_MPTF DOUBLE PRECISION RPD_MPTF DOUBLE PRECISION REARTH_MPTF DOUBLE PRECISION DSKMC_MPTF DOUBLE PRECISION XLONC_MPTF DOUBLE PRECISION CIY_MPTF DOUBLE PRECISION CJX_MPTF DOUBLE PRECISION CONE_MPTF DOUBLE PRECISION CONEI_MPTF DOUBLE PRECISION C1_MPTF DOUBLE PRECISION C2_MPTF DOUBLE PRECISION YC_MPTF DOUBLE PRECISION COTRUE1 DOUBLE PRECISION YPOINT DOUBLE PRECISION XPOINT DOUBLE PRECISION DLON C c This routine converts a coarse domain dot grid point, <riy,rjx>, c into a lat/lon point <rlat,rlon> if idir=1, or vice versa if c idir=-1. It works for Lambert Conformal (LC,1), c Polar Stereographic (ST,2), or Mercator (ME,3) projections, c with any true latitide(s). c It is assumed that premaptform has been called prior to this so c that the proper constants have been placed in the common block c called mptf, which should be declared in (and only in) the c main program and routines maptform (this routine) and premaptform. c C Input, Output Args INTEGER MIYCORS,MJXCORS,NPROJ DOUBLE PRECISION DSKMC,XLATC,XLONC,TRUE1,TRUE2 INTEGER IDIR C Latitude (-90->90 deg N) DOUBLE PRECISION RLAT C Longitude (-180->180 E) DOUBLE PRECISION RLON C Cartesian X coordinate DOUBLE PRECISION RIY C Cartesian Y coordinate DOUBLE PRECISION RJX C NCLEND c =========== c premaptform c =========== C 3.1415... PI_MPTF = 4.D0*ATAN(1.D0) C radians per degree RPD_MPTF = PI_MPTF/180.D0 C radius of planet, in km REARTH_MPTF = 6370.949D0 DSKMC_MPTF = DSKMC XLONC_MPTF = XLONC NPROJ_MPTF = NPROJ CIY_MPTF = .5D0* (1.D0+MIYCORS) CJX_MPTF = .5D0* (1.D0+MJXCORS) c C Mercator IF (NPROJ_MPTF.EQ.3) THEN c TRUE1 = 0.D0 TRUE2 = 0.D0 IHM_MPTF = 1 CONE_MPTF = 1.D0 CONEI_MPTF = 1.D0 C1_MPTF = 1.D0 C2_MPTF = 1.D0 YC_MPTF = REARTH_MPTF*LOG((1.D0+SIN(RPD_MPTF*XLATC))/ + COS(RPD_MPTF*XLATC)) c C Lambert Comformal or Polar Stereographic ELSE c c Make sure xlatc, true1, and true2 are all in same hemisphere, c and calculate ihm_mptf. c IF (XLATC.GT.0.D0 .AND. TRUE1.GT.0.D0 .AND. + TRUE2.GT.0.D0) THEN IHM_MPTF = 1 ELSE IF (XLATC.LT.0.D0 .AND. TRUE1.LT.0.D0 .AND. + TRUE2.LT.0.D0) THEN IHM_MPTF = -1 ELSE WRITE (*,FMT=*) 'Invalid latitude parameters for map.' STOP END IF c c Calculate cone factor c IF (NPROJ_MPTF.EQ.1) THEN IF (TRUE1.NE.TRUE2) THEN CONE_MPTF = LOG10(COS(RPD_MPTF*TRUE1)/ + COS(RPD_MPTF*TRUE2))/ + LOG10(TAN(.25D0*PI_MPTF- + IHM_MPTF*.5D0*RPD_MPTF*TRUE1)/ + TAN(.25D0*PI_MPTF-IHM_MPTF*.5D0*RPD_MPTF* + TRUE2)) ELSE CONE_MPTF = COS(RPD_MPTF* (90.D0-IHM_MPTF*TRUE1)) END IF ELSE IF (NPROJ_MPTF.EQ.2) THEN CONE_MPTF = 1.D0 END IF c c Calculate other constants c CONEI_MPTF = 1.D0/CONE_MPTF COTRUE1 = IHM_MPTF*90.D0 - TRUE1 IF (NPROJ_MPTF.EQ.1) THEN C1_MPTF = REARTH_MPTF*SIN(RPD_MPTF*COTRUE1)/ + (CONE_MPTF* (IHM_MPTF*TAN(.5D0*RPD_MPTF* + COTRUE1))**CONE_MPTF) C2_MPTF = TAN(.5D0*RPD_MPTF*COTRUE1)* + (CONE_MPTF/ (IHM_MPTF*REARTH_MPTF*SIN(RPD_MPTF* + COTRUE1)))**CONEI_MPTF YC_MPTF = -C1_MPTF* (IHM_MPTF* + TAN(.25D0* (IHM_MPTF*PI_MPTF- + 2.D0*RPD_MPTF*XLATC)))**CONE_MPTF ELSE IF (NPROJ_MPTF.EQ.2) THEN C1_MPTF = 1.D0 + COS(RPD_MPTF*COTRUE1) C2_MPTF = 1.D0 YC_MPTF = -REARTH_MPTF*SIN(.5D0*IHM_MPTF*PI_MPTF- + RPD_MPTF*XLATC)*C1_MPTF/ + (1.D0+COS(.5D0*IHM_MPTF*PI_MPTF-RPD_MPTF*XLATC)) END IF c END IF c ======== c maptform c ======== IF (RLAT.EQ.-90.D0) PRINT *,'maptform:',RIY,RJX,RLAT,RLON,IDIR C First, deal with idir=1 IF (IDIR.EQ.1) THEN c YPOINT = (RIY-CIY_MPTF)*DSKMC_MPTF + YC_MPTF XPOINT = (RJX-CJX_MPTF)*DSKMC_MPTF c IF (NPROJ_MPTF.EQ.3) THEN RLAT = (2.D0*ATAN(EXP(YPOINT/REARTH_MPTF))-.5D0*PI_MPTF)/ + RPD_MPTF RLON = XLONC_MPTF + (XPOINT/REARTH_MPTF)/RPD_MPTF ELSE IF (NPROJ_MPTF.EQ.1) THEN RLAT = (.5D0*IHM_MPTF*PI_MPTF- + 2.D0*ATAN(C2_MPTF* (SQRT(XPOINT**2+ + YPOINT**2))**CONEI_MPTF))/RPD_MPTF RLON = XLONC_MPTF + (CONEI_MPTF* + ATAN2(XPOINT,-IHM_MPTF*YPOINT))/RPD_MPTF ELSE IF (NPROJ_MPTF.EQ.2) THEN RLAT = (.5D0*IHM_MPTF*PI_MPTF- + IHM_MPTF*2.D0*ATAN(SQRT(XPOINT**2+ + YPOINT**2)/ (REARTH_MPTF*C1_MPTF)))/RPD_MPTF IF (XPOINT.EQ.0.D0 .AND. YPOINT.EQ.0.D0) THEN RLON = XLONC_MPTF ELSE RLON = XLONC_MPTF + (ATAN2(XPOINT,-IHM_MPTF*YPOINT))/ + RPD_MPTF END IF END IF RLON = MOD(RLON+900.D0,360.D0) - 180.D0 c C Otherwise, deal with idir=-1 ELSE c DLON = RLON - XLONC_MPTF IF (DLON.LT.-180.D0) DLON = DLON + 360 IF (DLON.GT.180.D0) DLON = DLON - 360 IF (NPROJ_MPTF.EQ.3) THEN YPOINT = REARTH_MPTF*LOG((1.D0+SIN(RPD_MPTF*RLAT))/ + COS(RPD_MPTF*RLAT)) XPOINT = DLON*RPD_MPTF*REARTH_MPTF ELSE IF (NPROJ_MPTF.EQ.1) THEN YPOINT = -C1_MPTF* (IHM_MPTF* + TAN(.25D0* (IHM_MPTF*PI_MPTF-2.D0*RPD_MPTF* + RLAT)))**CONE_MPTF*COS(CONE_MPTF*RPD_MPTF*DLON) XPOINT = IHM_MPTF*C1_MPTF* (IHM_MPTF* + TAN(.25D0* (IHM_MPTF*PI_MPTF- + 2.D0*RPD_MPTF*RLAT)))**CONE_MPTF* + SIN(CONE_MPTF*RPD_MPTF*DLON) ELSE IF (NPROJ_MPTF.EQ.2) THEN YPOINT = -REARTH_MPTF*SIN(.5D0*IHM_MPTF*PI_MPTF- + RPD_MPTF*RLAT)*C1_MPTF/ (1.D0+ + COS(.5D0*IHM_MPTF*PI_MPTF-RPD_MPTF*RLAT))* + COS(RPD_MPTF*DLON) XPOINT = IHM_MPTF*REARTH_MPTF* + SIN(.5D0*IHM_MPTF*PI_MPTF-RPD_MPTF*RLAT)*C1_MPTF/ + (1.D0+COS(.5D0*IHM_MPTF*PI_MPTF-RPD_MPTF*RLAT))* + SIN(RPD_MPTF*DLON) END IF RIY = (YPOINT-YC_MPTF)/DSKMC_MPTF + CIY_MPTF RJX = XPOINT/DSKMC_MPTF + CJX_MPTF c END IF RETURN END C******************************************************** C NCLFORTSTART SUBROUTINE DBINT3D(DATA_OUT,OBSII,OBSJJ,DATA_IN,NX,NY,NZ,NOBSICRS, + NOBSJCRS,ICRS,JCRS) C C Possible NCL interface: C C data_out = wrf_bint3d(data_in,obsii,obsjj,icrs,jcrs) C C !!! 1_based_array (cols x rows) in fortran <=> 0_based_array C (rows x cols) in NCL !!! C !!! Include K-index to make a 3-D array !!! C C INPUT VARIABLES C --------------- INTEGER ICRS,JCRS,NX,NY,NZ INTEGER NOBSJCRS,NOBSICRS DOUBLE PRECISION OBSII(NOBSICRS,NOBSJCRS) DOUBLE PRECISION OBSJJ(NOBSICRS,NOBSJCRS) DOUBLE PRECISION DATA_IN(NX,NY,NZ) C OUTPUT C --------------- DOUBLE PRECISION DATA_OUT(NOBSICRS,NOBSJCRS,NZ) C NCLEND C LOCAL DOUBLE PRECISION OBSI,OBSJ DOUBLE PRECISION DATA_OBS C DO K = 1,NZ DO J = 1,NOBSJCRS DO I = 1,NOBSICRS C grid index in lon OBSI = OBSII(I,J) C grid index in lat OBSJ = OBSJJ(I,J) DATA_OBS = 0.0D0 CALL DBINT(DATA_OBS,OBSI,OBSJ,DATA_IN(1,1,K),NX,NY, + ICRS,JCRS) DATA_OUT(I,J,K) = DATA_OBS END DO END DO END DO RETURN END SUBROUTINE DBINT(PP,XX,YY,LIST,III,JJJ,ICRS,JCRS) DOUBLE PRECISION PP DOUBLE PRECISION X DOUBLE PRECISION Y DOUBLE PRECISION A DOUBLE PRECISION B DOUBLE PRECISION C DOUBLE PRECISION D DOUBLE PRECISION E DOUBLE PRECISION F DOUBLE PRECISION G DOUBLE PRECISION H DOUBLE PRECISION QQ C C --- BI-LINEAR INTERPOLATION AMONG FOUR GRID VALUES C C INPUT : LIST, XX, YY C OUTPUT: PP C INTEGER ICRS,JCRS,III,JJJ DOUBLE PRECISION XX,YY DOUBLE PRECISION LIST(III,JJJ),STL(4,4) C MASS GRID IN WRF (I-> west-east, J-> south-north) C IB = III - ICRS JB = JJJ - JCRS PP = 0.0D0 N = 0 I = INT(XX+0.00001D0) J = INT(YY+0.00001D0) X = XX - I Y = YY - J IF ((ABS(X).GT.0.00001D0) .OR. (ABS(Y).GT.0.00001D0)) THEN C DO 2 K = 1,4 KK = I + K DO 2 L = 1,4 STL(K,L) = 0.D0 LL = J + L IF ((KK.GE.1) .AND. (KK.LE.IB) .AND. (LL.LE.JB) .AND. + (LL.GE.1)) THEN STL(K,L) = LIST(KK,LL) N = N + 1 C .. a zero value inside the domain being set to 1.E-12: IF (STL(K,L).EQ.0.D0) STL(K,L) = 1.D-12 END IF 2 CONTINUE C CALL DONED(A,X,STL(1,1),STL(2,1),STL(3,1),STL(4,1)) CALL DONED(B,X,STL(1,2),STL(2,2),STL(3,2),STL(4,2)) CALL DONED(C,X,STL(1,3),STL(2,3),STL(3,3),STL(4,3)) CALL DONED(D,X,STL(1,4),STL(2,4),STL(3,4),STL(4,4)) C C .. CHECK TANGENT LINEAR OF ONED, SAVE BASIC STATE: C WRITE(20) XX,YY,Y,A,B,C,D C CALL DONED(PP,Y,A,B,C,D) IF (N.NE.16) THEN CALL DONED(E,Y,STL(1,1),STL(1,2),STL(1,3),STL(1,4)) CALL DONED(F,Y,STL(2,1),STL(2,2),STL(2,3),STL(2,4)) CALL DONED(G,Y,STL(3,1),STL(3,2),STL(3,3),STL(3,4)) CALL DONED(H,Y,STL(4,1),STL(4,2),STL(4,3),STL(4,4)) C .. CHECK TANGENT LINEAR OF ONED, SAVE BASIC STATE: C WRITE(20) XX,YY,X,E,F,G,H C CALL DONED(QQ,X,E,F,G,H) PP = (PP+QQ)*0.5D0 END IF C ELSE C PP = LIST(I,J) END IF C RETURN END SUBROUTINE DONED(Y,X,A,B,C,D) DOUBLE PRECISION Y DOUBLE PRECISION X DOUBLE PRECISION A DOUBLE PRECISION B DOUBLE PRECISION C DOUBLE PRECISION D DOUBLE PRECISION ONE C C .. Input : X, A, B, C, D C Output: Y C 1, 2, 3, and 4 points interpolation: C In this subroutine, the zero value of A, B, C, D means that C point outside the domain. C C .. 1-point: C .. take the value at the second point: IF (X.EQ.0.D0) THEN ONE = B C .. take the value at the third point: ELSE IF (X.EQ.1.D0) THEN ONE = C C .. the point X outside the range: ELSE IF (B*C.EQ.0.D0) THEN ONE = 0.D0 ELSE IF (A*D.EQ.0.D0) THEN C .. 3-point interpolation: IF (A.NE.0.D0) THEN ONE = B + X* (0.5D0* (C-A)+X* (0.5D0* (C+A)-B)) ELSE IF (D.NE.0.D0) THEN ONE = C + (1.0D0-X)* (0.5D0* (B-D)+ + (1.0D0-X)* (0.5D0* (B+D)-C)) ELSE C .. 2-point interpolation: ONE = B* (1.0D0-X) + C*X END IF ELSE C .. 4-point interpolation: ONE = (1.0D0-X)* (B+X* (0.5D0* (C-A)+X* (0.5D0* (C+A)-B))) + + X* (C+ (1.0D0-X)* (0.5D0* (B-D)+ (1.0D0- + X)* (0.5D0* (B+D)-C))) END IF END IF C Y = ONE C RETURN END
A set of 12 fanciful and fun Shawl Pins. Each Shawl Pin comes with an organdy gift pouch. Direct your customers to our video, which features creative ways to use the Shaune Bazner Shawl Pin!
\documentclass{stdlocal} \begin{document} \section{Introduction} % (fold) \label{sec:introduction} For various mathematical and physical problems, there exists no feasible, deterministic algorithm to solve them. Especially, the simulations of physical systems with many coupled degrees of freedom, such as fluids and global illumination, seem to be difficult to compute due to their high dimensionality. Instead, a class of randomized algorithms, called Monte Carlo methods, are used to approximate the actual outcome. Monte Carlo methods rely on repeated random sampling to obtain a numerical result. Hence, they are not bound to the \enquote{curse of dimensionality} and are able to quickly evaluate complex equations. \autocite{pharr2016,bauke2007,mueller2012,landau2014}\footnote{In this thesis, citations concerning a whole paragraph will be given after the last sentence.} To obtain precise answers with a small relative error, Monte Carlo algorithms have to use a tremendous amount of random numbers. But the usage of truly random numbers generated by physical processes consists at least of two drawbacks. First, the output of the algorithm will be non-deterministic and, as a result, untestable. Second, the generation of truly random numbers is typically based on a slow process and consequently reduces the performance of the entire program. For that reason, Monte Carlo algorithms usually use so-called pseudorandom number generators (PRNGs). PRNGs generate a sequence of numbers based on a deterministic procedure and a truly random initial value as seed. The sequence of numbers is not truly random but fulfills several properties of truly random sequences. \autocite{bauke2007,intel-drng,lecuyer1994,lecuyer2015,lecuyer2017,volchan2002} The structure of Monte Carlo methods causes a program to spend most of its time with the construction of random numbers. Even the application of PRNGs does not change that. Today's computer processors provide functionality for the parallel execution of code in different ways, mainly single instruction multiple data (SIMD) and multiple instruction multiple data (MIMD). Hence, to efficiently use the computing power of a processor for Monte Carlo algorithms not bound by memory, PRNGs have to be vectorized and parallelized to exploit such features. Whereas parallelization takes place at a high level, vectorization has to be done by the compiler or manually by the programmer at a much lower level. The implementation of PRNGs constrains automatic vectorization due to internal flow and data dependencies. To lift this restriction, a manual vectorization concerning data dependence and latencies appears to be the right way. Often, there are already manually vectorized algorithms that need to use random numbers, such as in \textcite{blacher2018}. As a consequence, vectorizing PRNGs is even essential to provide the utilities for these implementations. \autocite{lecuyer2017,bauke2007,hennessy2019,patterson2014,barash2017,dolbeau2016,intel-optimization-reference,fog2019a,fog2019b,fog2019c,fog2019d,fog2019e} The C++ programming language is an adequate candidate for the development of vectorized PRNGs. It is one of the most used programming languages in the world and can be applied to small research projects as well as large enterprise programs. C++ allows for the high-level abstraction of algorithms and structures. On the other hand, it is capable of accessing low-level routines to exploit special hardware features, like Intel's Streaming SIMD Extensions (SSE), Intel's Advanced Vector Extensions (AVX), and threads. A typical C++ compiler is able to optimize the code with respect to such features automatically. But we as programmers are not bound to this and can manually optimize the code further. Every three years, a new standard is published, such as the latest language specification called C++17. The language is evolving by its communities improvements and therefore it keeps to be modern. On top of this, other languages, such as Python, usually provide an interface to communicate with the C programming language. Through the design of an efficient implementation in C++, we can easily add support for other languages as well by providing a standard C interface. \autocite{stroustrup2014,meyers2014,vandevoorde2018,intel-intrinsics-guide,reddy2011,cppreference,isocpp} Lots of PRNGs have been implemented by different libraries with different Application Programming Interfaces (APIs), such as the STL of C++, \citetitle{boost}, \citetitle{intel-mkl}, and \citetitle{rngavxlib}. For example, the STL and \citetitle{boost} provide a large set of robust PRNGs which are not vectorized but well documented. Their API makes them likely to be used but shows some flaws. It does not allow to explicitly use the vectorization capabilities of a PRNG and gives you a bad default seeding. The use of standard distributions is difficult and not adjustable. \citetitle{rngavxlib} provides highly optimized, open-source, vectorized implementations with bad documentation and difficult-to-use code. The \citetitle{intel-mkl}, too, provides vectorized PRNGs, but is not available as open-source and uses difficult-to-use interfaces. Besides complete libraries, there are also standalone implementations of vectorized PRNGs in \textcite{lemire-pcg} and \textcite{lemire-xorshift}. So far, there has been no easily-accessible, portable, and open-source software library written in C++ which gives a coherent, easy-to-use and consistent interface for vectorized PRNGs. \autocite{intel-mkl,boost,guskova2016,oneill-blog-api,gcc-libstdcpp} In this thesis, precisely in sections \ref{sec:design_of_the_api} and \ref{sec:implementation}, we develop a new library, called \citetitle{pxart}, in the C++ programming language \footfullcite{pxart}. \citetitle{pxart} vectorizes a few already known PRNGs which partly do not exist as vectorized versions and provides a new API for their usage to accommodate the disadvantages of the random facilities of the STL. The library itself is header-only, open-source, and can be found on GitHub. It is easily installable on every operating system. % Additionally, we compare the performance of our vectorized PRNGs to other already accessible implementations in Boost, Intel MKL, Lemire, RNGAVXLIB and others. % The performance is measured by speed, code size, memory size, complexity, and random properties. The necessary theoretical background to understand the design- and the implementation-specific aspects is given in the sections \ref{sub:preliminaries}, \ref{sub:simulation_in_physics_and_mathematics}, and \ref{sec:pseudorandom_number_generators}. Here, we will give a brief introduction to computer architecture, Monte Carlo methods and random sequences. Especially, section \ref{sec:pseudorandom_number_generators} will give a mathematically rigorous introduction to PRNGs to make the reader familiar with the topic. Section \ref{sec:previous_work} refers to the previous work concerning the vectorization of PRNGs. % Meanwhile, we apply the implementations to an example Monte Carlo simulation. % For this, a small test framework is implemented which allows us to easily test and evaluate PRNGs with respect to stated measures. To show that our vectorized implementations result in a performance improvement without reducing the statistical quality of generated random numbers, we have used standard test suites, namely \citetitle{dieharder} and \citetitle{testu01-lib}, and created benchmarks to measure the actual speed-up in section \ref{sec:testing_framework}. At the end, we have designed an application based on Monte Carlo algorithms to simulate essential parts of photon propagation and global illumination to show the usage of our PRNGs in the context of physics. In the sections \ref{sec:evaluation} and \ref{sec:conclusions}, the evaluation is shown followed by a discussion dealing with further improvements. \autocite{dieharder,testu01-lib,testu01} % section introduction (end) \end{document}
% kapitel5.tex \chapter{Optimization Studies for the Event Selection} \section{Search for Discriminating Variables } \label{distributions} The first part of the optimization studies is the search for variables which provide a significant distinction between background and signal. Caused by the basic selection discussed in section \ref{basic selection} already much background is rejected. Moreover, the requirement of two large-R jets, which fulfill the minimum criteria (Table \ref{calibration}, cause that the remaining background events have high momenta. Therefore the background is also expected in the high energy regions, which is also expeced for the signal processes.\\ %This complicates the search for discriminating variables, because the signal is expected to contain high energies,too.\\ Figure \ref{H_T} shows the distribution for the scalar sum of the transverse momenta of all jets in an event. \begin{figure} \centering \includegraphics[width=8cm]{figures/H_T.png} \caption{Distribution of the scalar sum of all jet $p_{T}$'s in an event after the preselection. Both signal and background are presented and the distributions are normalized to unity. The number of events, displayed in brackets, is expected for an integrated luminosity $\int L dt$ = \SI{3.2}{fb^{-1}.} The vertical lines represent the statistical uncertainties.} \label{H_T} \end{figure} The distribution shows that the signal is shifted to the right compared to the background, because there are higher momenta in the events resulting from the very massive vector-like quarks. There are also much background events, relative to the total amount of background events, in the signal region, which is as expected, because of the requirements of the basic selection. \\ Figure \ref{Zpt} presents the distribution of the Z candidate $p_{T}$, which in the following is denoted as $p_{T}(Z)$. \begin{figure} \centering \includegraphics[width=8cm]{figures/Zpt.png} \caption{$p_{T}(Z)$ distribution for signal and background after the preselection. Both signal and background are normalized to unity. The number of events, displayed in brackets, is expected for an integrated luminosity $\int L dt$ = \SI{3.2}{fb^{-1}.} The vertical lines represent the statistical uncertainties.} \label{Zpt} \end{figure} As mentioned for the $H_{T}$ distribution the signal is shifted to the right. That is expected, because the Z boson results straight from the vector-like quark and has a momentum $p$ about \SI{450}{GeV}.\\ In figure \ref{leadingljet} the $p_{T}$ of the large-R jet with the highest $p_{T}$ of an event is represented, which in the following is denoted as $p_{T}(leading large-R jet)$. \vspace{-0.5cm} \begin{figure}[h!] \centering \includegraphics[width=8cm]{figures/leadingljet.png} \caption{Distribution of $p_{T}(leading large-R jet)$ for signal and background after the preselection. Both signal and background are normalized to unity. The number of events, displayed in brackets, is expected for an integrated luminosity $\int L dt$ = \SI{3.2}{fb^{-1}.} The vertical lines represent the statistical uncertainties.} \label{leadingljet} \end{figure} It is visible that the signal has higher values for $p_{T}(leading large-R jet)$ than the background. The large-R jet with the highest $p_{T}$ is expected to cluster the decay products of the top quark or W boson resulting from the vector-like quark decay. Therefore a high momentum is expected for the leading large-R jets of the signal processes.\\ Figure \ref{mZbdist} shows the distribution of the invariant mass of the Z candidate and the highest $p_{T}$ b-jet $m(Zb)$ and \ref{mZtdist} the invariant mass of the Z candidate and the highest $p_{T}$ top-jet $m(Zt)$. %\resizebox{0.48\columnwidth}{!}{ \begin{figure}[h] \centering \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/mZb.png} \caption{} \label{mZbdist} \end{subfigure} } \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/mZt.png} \caption{} \label{mZtdist} \end{subfigure} } \caption{Plot for (a) the invariant mass of the Z candidate and the highest $p_{T}$ b-jet and (b) the invariant mass of the Z candidate and the highest $p_{T}$ top-jet . Both signal and background are presented and the distributions are normalized to unity. The number of events, displayed in brackets, is expected for an integrated luminosity $\int L dt$ = \SI{3.2}{fb^{-1}.} The vertical lines represent the statistical uncertainties.} \label{mZb+mZt} \end{figure} %} The signal is shifted to the right, because the Z candidate and both the b-jet and top-jet are expected to have high momenta, which is shown in the previous distributions. For the BBS signal process there is a peak at \SI{900}{GeV} in figure \ref{mZbdist} and for the TTS signal process in figure \ref{mZtdist}. This is as expected because the Z candidate and the highest $p_{T}$ b-jet respectively top-jet result from the vector-like quark decay B \texorpdfstring{$\longrightarrow$}~Zb or T \texorpdfstring{$\longrightarrow$}~Zt and the vector-like quark masses are simulated with $m_{T,B}$ = \SI{900}{GeV} .\\ Generally, the presented distributions provide the possibility to achieve a distinction between background and signal by requiring limits for different variables. \section{Significance for Different Cuts} \label{optimization} In this section the significance for different limits on variables, which are shown in section \ref{distributions}, are examined. In a previous search for vector-like quarks with a center of mass energy $\sqrt{s}$ = \SI{8}{TeV} \cite{8tevanalysis}, in the optimization studies $m(Zb)$ is chosen as final discriminant for the BBS and TTS process . In this analysis $m(Zb)$ is chosen as final discriminant for the BBS process,too, but $m(Zt)$ is chosen separately for the TTS process. The boosted analysis provides the possibility of this variable by using top tagging. The optimization studies are performed with an interval of the distributions of the final discriminants. The interval is chosen, so that 80\% of all signal events of BBS respectively TTS are within the interval starting from the highest values of $m(Zb)$ or $m(Zt)$. This interval is chosen because the signal is shifted to higher values of $m(Zb)$ and $m(Zt)$ compared to the background. Therefore in the interval the main background is rejected. The significance of the signal relative to the fluctuations of the background is investigated with formula $\frac{s}{\sqrt{b}}$, while $\sqrt{b}$ describes the statistical uncertainty of the background and $s$ the number of signal events. For both s and b the weighted number of events is considered.\\ Figure \ref{mZbcut} shows the significance as function of varying limits considering the variables presented in section \ref{distributions} for the chosen interval of $m(Zb)$. \begin{figure}[h] \centering \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/H_TcutmZb.pdf} \caption{} \label{HTmZb} \end{subfigure} } \centering \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/leadingljetptcutmZb.pdf} \caption{} \label{ljetmZb} \end{subfigure} } \centering \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/ZptcutmZb.pdf} \caption{} \label{ZpTmZb} \end{subfigure} } \caption{Distribution for the significance for m(Zb) as function of varying limits for (a) $H_{T}$ , (b) leading large-R jet $p_{T}$ and (c) Z boson $p_{T}$. The cut values varying with \SI{50}{GeV} steps. The significance is calculated for interval of m(Zb), which starts with the highest value of m(Zb) and ends if 80 \% of the total number of BBS signal events are within the interval.} \label{mZbcut} \end{figure} The graphs are consistent with the trends of the distributions presented in section \ref{distributions}. For $H_{T}$ and leading large-R jet $p_{T}$ the significance has higher values for lower limits and decreases fastly for higher limits. This is expected, because the signal distribution is only slightly shifted to higher values and therefore for higher limits the peak of the signal is rejected. The significance is proportional to the absolute number of signal events, therefore lower values are expected if a lot of signal is rejected.\\ For the $p_{T}(Z)$ distribution the signal shift is more distinct. Therefore higher limits can be set to reject a lot of background and still not cut into the main signal region. The significance has lower values for lower limits, because there is not much background rejected, and it increases, if the main background is rejected but not the signal and finally decreases when big parts of the signal are discarded.\\ Figure \ref{mZtcut} shows the significance as function of varying limits considering the variables presented in section \ref{distributions} for the chosen interval of $m(Zt)$. \begin{figure}[h!] \centering \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/H_TcutmZt.pdf} \caption{} \label{HTmZt} \end{subfigure} } \centering \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/leadingljetptcutmZt.pdf} \caption{} \label{ljetmZt} \end{subfigure} } \centering \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/ZptcutmZt.pdf} \caption{} \label{ZpTmZt} \end{subfigure} } \caption{Distribution for the significance for m(Zt) as function of varying limits for (a) $H_{T}$ , (b) leading large-R jet $p_{T}$ and (c) Z boson $p_{T}$. The cut values varying with \SI{50}{GeV} steps. The significance is calculated for interval of m(Zt), which starts with the highest value of m(Zt) and ends if 80 \% of the total number of BBS signal events are within the interval.} \label{mZtcut} \end{figure} The absolute value of the significance for the BBS process is higher, because there is a lower number of events for the TTS process. The TTS distribution in figure \ref{Zpt} is shifted to lower values compared to the BBS distribution. Therefore it is as expected that the maximum of the significance for TTS is reached for lower limits than for the BBS signal process. Figure \ref{HTmZb} and \ref{HTmZt} confirm the argumentation mentioned before. The trends for leading large-R jet $p_{T}$ and $H_{T}$ can be explained with the same argumentation used for the BBS signal process.\\ Considering the plots for $p_{T}(leading large-R jet)$, $p_{T}(Z)$ and $H_{T}$ limits, the significance for the $p_{T}(Z)$ limits increases for both $m(Zt)$ and $m(Zb)$ to the highest values. Therefore the first limit is set for $p_{T}(Z)$. The limit for both TTS and BBS are chosen to reach the highest value of $\frac{s}{\sqrt{b}}$. Thereby the resulting limits are $p_{T}(Z) \geq$ \SI{250}{GeV} for TTS and $p_{T}(Z) \geq$ \SI{450}{GeV} for BBS. \\ In the following the significance as function of different limit for $p_{T}(leading large-R jet)$ and $H_{T}$, after requiring the $p_{T}(Z)$ limits, is investigated. Figure \ref{mZbcutafterZpt} shows the significance for the $m(Zb)$ interval as function of varying limits, considering $H_{T}$ and leading large-R jet $p_{T}$, after the Z candidate $p_{T}$ limit is set. Figure \ref{mZtcutafterZpt} represents the same varying limits for $m(Zt)$. \begin{figure}[h] \centering \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/H_TcutmZbafterZpt.pdf} \caption{} \label{HTmZbafterZpt} \end{subfigure} } \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/leadingljetptcutmZbafterZpt.pdf} \caption{} \label{ljetmZbafterZpt} \end{subfigure} } \caption{Plot for the significance for $m(Zb)$ as function of varying limits for (a) $H_{T}$ , leading large-R jet (b) $p_{T}$ after requiring $p_{T} \geq$ \SI{450}{GeV}. The values of the limits varying with \SI{50}{GeV} steps.. The significance is calculated for interval of m(Zb), which starts with the highest value of m(Zb) and ends if 80 \% of the total number of BBS signal events are within the interval.} \label{mZbcutafterZpt} \end{figure} \begin{figure}[h] \centering \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/H_TcutmZtafterZpt.pdf} \caption{} \label{HTmZtafterZpt} \end{subfigure} } \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/leadingljetptcutmZtafterZpt.pdf} \caption{} \label{ljetmZtafterZpt} \end{subfigure} } \caption{Plot for the significance for m(Zt) as function of varying limits for (a) $H_{T}$ ,(b) leading large-R jet $p_{T}$ after requiring $p_{T} \geq$ \SI{250}{GeV}. The values of the limits varying with \SI{50}{GeV} steps for $H_{T}$ and leading large-R jet $p_{T}$. The significance is calculated for interval of m(Zt), which starts with the highest value of m(Zt) and ends if 80 \% of the total number of BBS signal events are within the interval.} \label{mZtcutafterZpt} \end{figure} For both TTS and BBS the $H_{T}$ limit distribution reaches a higher significance than the significance distribution for $p_{T}(leading large-R jet)$. The limit $H_ {T} \geq =$ \SI{1150}{GeV} provides the best significance for both TTS and BBS.\\ In the following it is examined, whether a further limit for $p_{T}(leading large-R jet)$, after requiring a Z candidate $p_{T}$ and $H_{T}$ limit, lead to an increasing significance. Figure \ref{ljetptcutafterZptHT} shows the significance as function of varying leading large-R jet $p_{T}$ after the limits for Z candidate $p_{T}$ and $H_{T}$ limit are set. \begin{figure}[h] \centering \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/ljetcutafterZptHTmZb.pdf} \caption{} \label{HTmZtafterZptmZb} \end{subfigure} } \resizebox{0.46\columnwidth}{!}{ \begin{subfigure}{.49\textwidth} \centering \includegraphics[width=.99\linewidth]{figures/ljetptcutafterZptHTmZt.pdf} \caption{} \label{ljetptcutafterZptmZt} \end{subfigure} } \caption{Plot for the significance for (a) $m(Zb)$ and (b) $m(Zt)$ as function of varying limits for $p_{T}(leading large-R jet)$ after requiring limits for $p_{T}(Z)$ and $H_{T}$. The values of the limits varying with \SI{50}{GeV} steps. The significance is calculated for an interval of $m(Zb)$ respectively $m(Zt)$, which starts with the highest value of $m(Zb)$ or $m(Zt)$ and ends if 80 \% of the total number of BBS or TTS signal events are within the interval} \label{ljetptcutafterZptHT} \end{figure} Figure \ref{HTmZtafterZptmZb} shows that for the BBS signal process a limit for $p_{T}(leading large-R jet)$ would not increase the significance. For the TTS processes \ref{ljetptcutafterZptHTmZt} presents that a higher significance can be reached with a limit for the leading large-R jet $p_{T}$. Therefore a limit of $p_{T}$(leading large-R jet) $\geq$ \SI{400}{GeV} is set. \section{Proposal for a Boosted Event Selection} In this section the results which were worked out in section \ref{optimization} are summarized to give a proposal for the optimization studies in the boosted event selection in a search for vector-like quark pair production in the Channels TT \texorpdfstring{$\longrightarrow$}~ZtWb and BB \texorpdfstring{$\longrightarrow$}~ZbWt. Table \ref{significancemZt} respectively \ref{significancemZb} gives an overview over the different optimization steps for the TTS respectively BBS process, showing the significance for different limitations. \begin{table} \centering %\setlength{\tab}{\textwidth} \resizebox{\columnwidth}{!}{ \begin{tabular}{|c|c|c|c|c|c|} \hline & No limitation & $m(Zt)$ confined to the chosen integral & $p_{T}(Z) \geq$ \SI{250}{GeV} & $H_{T} \geq$ \SI{1150}{GeV} & $p_{T}$(leading large-R jet) $\geq$ \SI{400}{GeV} \\ \hline \hline & & & & &\\ $\frac{s}{\sqrt{b}}$ & 0.01 & 0.14 & 0.22 & 0.29 & 0.32\\ & & & & &\\ \hline \end{tabular} } \caption{Significances for the TTS signal process for different limitations. The limits are added respectively to the listed further left. The significance is calculated concering an interval of $m(Zt)$, which starts with the highest value of $m(Zt)$ and ends if 80 \% of the total number of TTS signal events are within the interval. } \label{significancemZt} \end{table} \begin{table} \centering %\setlength{\tab}{\textwidth} \resizebox{\columnwidth}{!}{ \begin{tabular}{|c|c|c|c|c|} \hline & No limitation & $m(Zb)$ confined to the chosen integral & $p_{T}(Z) \geq$ \SI{450}{GeV} & $H_{T} \geq$ \SI{1150}{GeV}\\ \hline \hline & & & & \\ $\frac{s}{\sqrt{b}}$ & 0.11 & 0.21 & 0.40 & 0.48 \\ & & & & \\ \hline \end{tabular} } \caption{Significances for the BBS signal process for different limitations. The limits are added respectively to the listed further left. The significance is calculated concering an interval of $m(Zb)$, which starts with the highest value of $m(Zb)$ and ends if 80 \% of the total number of TTS signal events are within the interval.} \label{significancemZb} \end{table} The trend of the significances for both TTS and BBS shows, that the limits are chosen sensible, because the significances increase to higher values for each limit. %Therefore the trend is adequate although the absolute value of the significance after requiring all limitations is not high enough to
\documentclass{memoir} \usepackage{notestemplate} %\logo{~/School-Work/Auxiliary-Files/resources/png/logo.png} %\institute{Rice University} %\faculty{Faculty of Whatever Sciences} %\department{Department of Mathematics} %\title{Class Notes} %\subtitle{Based on MATH xxx} %\author{\textit{Author}\\Gabriel \textsc{Gress}} %\supervisor{Linus \textsc{Torvalds}} %\context{Well, I was bored...} %\date{\today} %\makeindex \begin{document} % \maketitle % Notes taken on \chapter{Vector Spaces} \begin{defn}[Vector Space] A \textbf{vector space} has four key elements: \begin{itemize} \item Our space of vectors $V$ \item A field $F$ \item An addition operation \(+:V\times V \to V\) \item A scalar multiplication operation \(\cdot:F\times V \to V\) \end{itemize} where operations (3) and (4) must satisfy: \begin{itemize} \item Commutativity: $u + v = v + u$ $ \forall u,v \in V$ \item Associativity: $(u+v)+w = u+(v+w)$, $ \forall u,v,w \in V$ AND $(\lambda_1 \cdot \lambda_2)\cdot v = \lambda_1 \cdot (\lambda_2\cdot v)$ \item Additive identity: $\exists \overline{0}\in V$ such that $v+\overline{0} = v$, $\forall v\in V$. \item Scalar multiplicative identity: $1_F \cdot v = v$, $\forall v\in V$ \item Distributivity: \begin{align*} \lambda \cdot (u+v) = \lambda \cdot u + \lambda * v \quad \lambda \in F, \; u,v \in V\\ (\lambda_1 + \lambda_2) \cdot v = \lambda_1 \cdot v + \lambda_2 \cdot v \quad \lambda_1, \lambda_2 \in F, \; v \in V \end{align*} \end{itemize} We call elements \(v \in V\) \textbf{vectors}. \end{defn} \begin{exmp}[Vector Spaces] Some pedagogical examples: \begin{itemize} \item $(\R^2,\R,+,\cdot)$ \item $(\mathbb{C}^2, \mathbb{C}, +, \cdot)$ (via complex scalar multiplication) \item $(\mathbb{C}^2,\R,+,\cdot)$ (via real scalar multiplication) \item $(F^{n}, F, +, \cdot )$ \item $(F^{\infty}, F, +, \cdot )$ where $F^{\infty} = \left\{ (x_1,x_2,\ldots) \mid x_i \in F, i=1,2,\ldots \right\}$ (note that this space is infinite dimensional) \item Let $F$ be a field, and $S$ a set. Let $V = F^{S} := \left\{ \text{ all functions } f:S\to F \right\} $. Addition is defined in $V$ as follows: Let $f,g:S\to F$. Then $\forall s \in S$ \begin{align*} (f+g): S\to F \text{ and } (f+g)(s) := f(s)+g(s) \end{align*} Scalar multiplication is defined as follows: Let $\lambda \in F; f\in V; f:S\to F$, so $(\lambda \cdot f):S\to F$. Then $\forall s \in S$ \begin{align*} (\lambda \cdot f)(s) := \lambda \cdot f(s) \forall s\in S \end{align*} \item Let $F = \R$ and $V = \left\{ \text{polynomials of degree }\leq 19 \text{ with coefficients in }\R \right\} $. Then V is a vector space. \end{itemize} \end{exmp} \begin{rmrk} If $S = \left\{ 1,\ldots,n \right\} $ then $V = F^{S}$ which is equivalent to functions $f:\left\{ 1,\ldots,n \right\} \to F$, which is equivalent to $F^{n}$. Thus they are isomorphic. \end{rmrk} % \printindex \end{document}
From iris.algebra Require Import excl auth cmra gmap agree gset numbers. From iris.algebra.lib Require Import frac_agree. From iris.heap_lang Require Export notation locations lang. From iris.base_logic.lib Require Export invariants. From iris.program_logic Require Export atomic. From iris.proofmode Require Import tactics. From iris.heap_lang Require Import proofmode par. From iris.bi.lib Require Import fractional. Set Default Proof Using "All". Require Export auth_ext multicopy_lsm. Section multicopy_lsm_util. Context {Σ} `{!heapG Σ, !multicopyG Σ, !multicopy_lsmG Σ}. Notation iProp := (iProp Σ). Local Notation "m !1 i" := (nzmap_total_lookup i m) (at level 20). (** Useful lemmas *) Lemma inFP_domm γ_f n D : inFP γ_f n -∗ own γ_f (● D) -∗ ⌜n ∈ D⌝. Proof. iIntros "FP HD". iPoseProof (own_valid_2 _ _ _ with "[$HD] [$FP]") as "H'". iDestruct "H'" as %H'. apply auth_both_valid_discrete in H'. destruct H' as [H' _]. apply gset_included in H'. iPureIntro. set_solver. Qed. Lemma inFP_domm_glob γ_I γ_J γ_f γ_gh r hγ I J n : inFP γ_f n -∗ global_state γ_I γ_J γ_f γ_gh r hγ I J -∗ ⌜n ∈ domm I⌝. Proof. iIntros "#FP_n Hglob". iDestruct "Hglob" as "(HI & Out_I & HJ & Out_J & Inf_J & Hf & Hγ & FP_r & domm_IJ & domm_Iγ)". iPoseProof (inFP_domm with "[$FP_n] [$]") as "%". by iPureIntro. Qed. Lemma own_alloc_set (S: gset K): True ==∗ ∃ (γ: gmap K gname), ([∗ set] k ∈ S, own (γ !!! k) (● (MaxNat 0))). Proof. iIntros "_". iInduction S as [| s S] "IH" using set_ind_L. - iModIntro. iExists _. try done. - iMod (own_alloc (● (MaxNat 0))) as (γs)"H'". { rewrite auth_auth_valid. try done. } iDestruct "IH" as ">IH". iDestruct "IH" as (γ)"IH". iModIntro. iExists (<[s := γs]> γ). rewrite (big_sepS_delete _ ({[s]} ∪ S) s); last by set_solver. iSplitL "H'". by rewrite lookup_total_insert. assert (({[s]} ∪ S) ∖ {[s]} = S) as HS. set_solver. rewrite HS. iApply (big_sepS_mono (λ y, own (γ !!! y) (● {| max_nat_car := 0 |}) )%I (λ y, own (<[s:=γs]> γ !!! y) (● {| max_nat_car := 0 |}))%I S); try done. intros k k_in_S. iFrame. iIntros "H'". rewrite lookup_total_insert_ne; last by set_solver. done. (* No idea what is happening here *) Unshelve. exact (∅: gmap K gname). Qed. Lemma ghost_heap_sync γ_gh n γ_en γ_cn γ_qn γ_cirn γ_en' γ_cn' γ_qn' γ_cirn' : own γ_gh (◯ {[n := ghost_loc γ_en γ_cn γ_qn γ_cirn]}) -∗ own γ_gh (◯ {[n := ghost_loc γ_en' γ_cn' γ_qn' γ_cirn']}) -∗ ⌜γ_en = γ_en'⌝ ∗ ⌜γ_cn = γ_cn'⌝ ∗ ⌜γ_qn = γ_qn'⌝ ∗ ⌜γ_cirn = γ_cirn'⌝. Proof. iIntros "H1 H2". iCombine "H1" "H2" as "H". iPoseProof (own_valid with "H") as "Valid". iDestruct "Valid" as %Valid. rewrite auth_frag_valid in Valid *; intros Valid. apply singleton_valid in Valid. apply to_agree_op_inv in Valid. apply leibniz_equiv in Valid. inversion Valid. by iPureIntro. Qed. Lemma ghost_heap_update γ_gh (hγ: gmap Node per_node_gl) n γ_en γ_cn γ_qn γ_cirn : ⌜n ∉ dom (gset Node) hγ⌝ -∗ own γ_gh (● hγ) ==∗ own γ_gh (● <[n := ghost_loc γ_en γ_cn γ_qn γ_cirn]> hγ) ∗ own γ_gh (◯ {[n := ghost_loc γ_en γ_cn γ_qn γ_cirn]}). Proof. iIntros "%". rename H into n_notin_hγ. iIntros "Hown". set (<[ n := ghost_loc γ_en γ_cn γ_qn γ_cirn ]> hγ) as hγ'. iDestruct (own_update _ _ (● hγ' ⋅ ◯ {[ n := ghost_loc γ_en γ_cn γ_qn γ_cirn ]}) with "Hown") as "Hown". { apply auth_update_alloc. rewrite /hγ'. apply alloc_local_update; last done. by rewrite <-not_elem_of_dom. } iMod (own_op with "Hown") as "[Ht● Ht◯]". iModIntro. iFrame. Qed. Lemma frac_eq γ_e γ_c γ_q es Cn Qn es' Cn' Qn' : frac_ghost_state γ_e γ_c γ_q es Cn Qn -∗ frac_ghost_state γ_e γ_c γ_q es' Cn' Qn' -∗ ⌜es = es'⌝ ∗ ⌜Cn = Cn'⌝ ∗ ⌜Qn = Qn'⌝. Proof. iIntros "H1 H2". unfold frac_ghost_state. iDestruct "H1" as "(H1_es & H1_c & H1_q)". iDestruct "H2" as "(H2_es & H2_c & H2_q)". iPoseProof (own_valid_2 _ _ _ with "[$H1_es] [$H2_es]") as "Hes". iPoseProof (own_valid_2 _ _ _ with "[$H1_c] [$H2_c]") as "Hc". iPoseProof (own_valid_2 _ _ _ with "[$H1_q] [$H2_q]") as "Hq". iDestruct "Hes" as %Hes. iDestruct "Hc" as %Hc. iDestruct "Hq" as %Hq. apply frac_agree_op_valid in Hes. destruct Hes as [_ Hes]. apply frac_agree_op_valid in Hc. destruct Hc as [_ Hc]. apply frac_agree_op_valid in Hq. destruct Hq as [_ Hq]. apply leibniz_equiv_iff in Hes. apply leibniz_equiv_iff in Hc. apply leibniz_equiv_iff in Hq. iPureIntro. repeat split; try done. Qed. Lemma frac_update γ_e γ_c γ_q es Cn Qn es' Cn' Qn' : frac_ghost_state γ_e γ_c γ_q es Cn Qn ∗ frac_ghost_state γ_e γ_c γ_q es Cn Qn ==∗ frac_ghost_state γ_e γ_c γ_q es' Cn' Qn' ∗ frac_ghost_state γ_e γ_c γ_q es' Cn' Qn'. Proof. iIntros "(H1 & H2)". iDestruct "H1" as "(H1_es & H1_c & H1_q)". iDestruct "H2" as "(H2_es & H2_c & H2_q)". iCombine "H1_es H2_es" as "Hes". iEval (rewrite <-frac_agree_op) in "Hes". iEval (rewrite Qp_half_half) in "Hes". iCombine "H1_c H2_c" as "Hc". iEval (rewrite <-frac_agree_op) in "Hc". iEval (rewrite Qp_half_half) in "Hc". iCombine "H1_q H2_q" as "Hq". iEval (rewrite <-frac_agree_op) in "Hq". iEval (rewrite Qp_half_half) in "Hq". iMod ((own_update (γ_e) (to_frac_agree 1 es) (to_frac_agree 1 es')) with "[$Hes]") as "Hes". { apply cmra_update_exclusive. unfold valid, cmra_valid. simpl. unfold prod_valid_instance. split; simpl; try done. } iEval (rewrite <-Qp_half_half) in "Hes". iEval (rewrite frac_agree_op) in "Hes". iDestruct "Hes" as "(H1_es & H2_es)". iMod ((own_update (γ_c) (to_frac_agree 1 Cn) (to_frac_agree 1 Cn')) with "[$Hc]") as "Hc". { apply cmra_update_exclusive. unfold valid, cmra_valid. simpl. unfold prod_valid_instance. split; simpl; try done. } iEval (rewrite <-Qp_half_half) in "Hc". iEval (rewrite frac_agree_op) in "Hc". iDestruct "Hc" as "(H1_c & H2_c)". iMod ((own_update (γ_q) (to_frac_agree 1 Qn) (to_frac_agree 1 Qn')) with "[$Hq]") as "Hq". { apply cmra_update_exclusive. unfold valid, cmra_valid. simpl. unfold prod_valid_instance. split; simpl; try done. } iEval (rewrite <-Qp_half_half) in "Hq". iEval (rewrite frac_agree_op) in "Hq". iDestruct "Hq" as "(H1_q & H2_q)". iModIntro. iFrame. Qed. Lemma flowint_update_result (γ: gname) (I I_n I_n': multiset_flowint_ur K) x : ⌜flowint_update_P (_) I I_n I_n' x⌝ ∗ own γ x -∗ ∃ I', ⌜contextualLeq (_) I I'⌝ ∗ ⌜∃ I_o, I = I_n ⋅ I_o ∧ I' = I_n' ⋅ I_o⌝ ∗ own γ (● I' ⋅ ◯ I_n'). Proof. unfold flowint_update_P. case_eq (view_auth_proj x); last first. - intros Hx. iIntros "(% & ?)". iExFalso. done. - intros [q a] Hx. iIntros "[HI' Hown]". iDestruct "HI'" as %HI'. destruct HI' as [I' HI']. destruct HI' as [Hagree [Hq [HIn [Hcontxl HIo]]]]. iExists I'. iSplit. by iPureIntro. iSplit. by iPureIntro. destruct x. simpl in Hx. simpl in HIn. rewrite Hx. rewrite <-HIn. rewrite Hq Hagree. assert (● I' ⋅ ◯ I_n' = View (Some (1%Qp, to_agree I')) I_n') as H'. { rewrite /(● I' ⋅ ◯ I_n'). unfold cmra_op. simpl. unfold view_op_instance. simpl. assert (ε ⋅ I_n' = I_n') as H'. by rewrite left_id. rewrite H'. unfold op, cmra_op. by simpl. } by iEval (rewrite H'). Qed. Lemma flowint_update_result' (γ: gname) (I I_n I_n': multiset_flowint_ur KT) x : ⌜flowint_update_P (_) I I_n I_n' x⌝ ∗ own γ x -∗ ∃ I', ⌜contextualLeq (_) I I'⌝ ∗ ⌜∃ I_o, I = I_n ⋅ I_o ∧ I' = I_n' ⋅ I_o⌝ ∗ own γ (● I' ⋅ ◯ I_n'). Proof. unfold flowint_update_P. case_eq (view_auth_proj x); last first. - intros Hx. iIntros "(% & ?)". iExFalso. done. - intros [q a] Hx. iIntros "[HI' Hown]". iDestruct "HI'" as %HI'. destruct HI' as [I' HI']. destruct HI' as [Hagree [Hq [HIn [Hcontxl HIo]]]]. iExists I'. iSplit. by iPureIntro. iSplit. by iPureIntro. destruct x. simpl in Hx. simpl in HIn. rewrite Hx. rewrite <-HIn. rewrite Hq Hagree. assert (● I' ⋅ ◯ I_n' = View (Some (1%Qp, to_agree I')) I_n') as H'. { rewrite /(● I' ⋅ ◯ I_n'). unfold cmra_op. simpl. unfold view_op_instance. simpl. assert (ε ⋅ I_n' = I_n') as H'. by rewrite left_id. rewrite H'. unfold op, cmra_op. by simpl. } by iEval (rewrite H'). Qed. Lemma dom_lookup (C: gmap K nat) k : C !! k ≠ None → k ∈ dom (gset K) C. Proof. intros Hcn. destruct (C !! k) eqn: Hcnk. rewrite elem_of_dom. rewrite Hcnk. by exists n. done. Qed. Definition map_subset (S: gset K) (C: gmap K nat) := let f := λ a s', s' ∪ {[(a, C !!! a)]} in set_fold f (∅: gset KT) S. Definition map_restriction (S: gset K) (C: gmap K T) := let f := λ a m, <[a := C !!! a ]> m in set_fold f (∅: gmap K T) S. Lemma lookup_map_restriction S (C: gmap K nat) (k: K): k ∈ S → map_restriction S C !! k = Some (C !!! k). Proof. set (P := λ (m: gmap K nat) (X: gset K), ∀ x, x ∈ X → m !! x = Some (C !!! x)). apply (set_fold_ind_L P); try done. intros x X r Hx HP. unfold P in HP. unfold P. intros x' Hx'. destruct (decide (x' = x)). - subst x'. by rewrite lookup_insert. - assert (x' ∈ X) as x'_in_X. set_solver. rewrite lookup_insert_ne. apply HP. done. done. Qed. Lemma map_subset_member S C k t: (k, t) ∈ map_subset S C ↔ k ∈ S ∧ t = C !!! k. Proof. set (P := λ (m: gset KT) (X: gset K), ∀ kx tx, (kx, tx) ∈ m ↔ kx ∈ X ∧ tx = C !!! kx). apply (set_fold_ind_L P); try done. - unfold P. intros kx tx. set_solver. - intros x X r Hx HP. unfold P. unfold P in HP. intros kx' tx'. split. + intros Hktx. rewrite elem_of_union in Hktx*; intros Hktx. destruct Hktx as [H' | H']. * apply HP in H'. destruct H' as [H' H'']. split; try done. set_solver. * rewrite elem_of_singleton in H'*; intros H'. inversion H'. split; try done; set_solver. + intros [H' H'']. rewrite elem_of_union in H'*; intros H'. destruct H' as [H' | H']. rewrite elem_of_singleton in H'*; intros H'. rewrite H'. rewrite H''. set_solver. assert ((kx', tx') ∈ r) as Hkt. apply HP. split; try done. set_solver. Qed. Lemma map_restriction_dom S C : dom (gset K) (map_restriction S C) = S. Proof. set (P := λ (m: gmap K nat) (X: gset K), dom (gset K) m = X). apply (set_fold_ind_L P); try done. - unfold P; set_solver. - intros x X r Hx HP. unfold P. unfold P in HP. apply leibniz_equiv. rewrite dom_insert. rewrite HP. done. Qed. Lemma nodePred_nodeShared_eq γ_I γ_J γ_f γ_gh r n γ_en γ_cn γ_qn γ_cirn γ_en' γ_cn' γ_qn' γ_cirn' es Tn Qn es' Tn' Qn' Bn In Jn H : own γ_gh (◯ {[n := ghost_loc γ_en γ_cn γ_qn γ_cirn]}) -∗ frac_ghost_state γ_en γ_cn γ_qn es Tn Qn -∗ nodeShared' γ_I γ_J γ_f γ_gh r n Tn' Qn' Bn H γ_en' γ_cn' γ_qn' γ_cirn' es' In Jn -∗ frac_ghost_state γ_en γ_cn γ_qn es Tn Qn ∗ nodeShared' γ_I γ_J γ_f γ_gh r n Tn Qn Bn H γ_en γ_cn γ_qn γ_cirn es In Jn ∗ ⌜es' = es⌝ ∗ ⌜Tn' = Tn⌝ ∗ ⌜Qn' = Qn⌝. Proof. iIntros "HnP_gh HnP_frac HnS". iDestruct "HnS" as "(HnS_gh & HnS_frac & HnS_si & HnS_FP & HnS_cl & HnS_oc & HnS_Bn & HnS_H & HnS_star & Hφ)". iPoseProof (ghost_heap_sync with "[$HnP_gh] [$HnS_gh]") as "(% & % & % & %)". subst γ_en'. subst γ_cn'. subst γ_qn'. subst γ_cirn'. iPoseProof (frac_eq with "[$HnP_frac] [$HnS_frac]") as "%". destruct H0 as [Hes [Hc Hq]]. subst es'. subst Tn'. subst Qn'. iFrame. by iPureIntro. Qed. (** Lock module **) Lemma lockNode_spec_high N γ_te γ_he γ_s Prot γ_I γ_J γ_f γ_gh r n: ⊢ mcs_inv N γ_te γ_he γ_s Prot (Inv_LSM γ_s γ_I γ_J γ_f γ_gh r) -∗ inFP γ_f n -∗ <<< True >>> lockNode #n @ ⊤ ∖ ↑(mcsN N) <<< ∃ Cn Qn, nodePred γ_gh γ_s r n Cn Qn, RET #() >>>. Proof. iIntros "#mcsInv #FP_n". iIntros (Φ) "AU". awp_apply (lockNode_spec n). iInv "mcsInv" as (T H) "(mcs_high & >Inv_LSM)". iDestruct "Inv_LSM" as (hγ I J) "(Hglob & Hstar)". iPoseProof (inFP_domm_glob with "[$FP_n] [$Hglob]") as "%". rename H0 into n_in_I. iEval (rewrite (big_sepS_elem_of_acc (_) (domm I) n); last by eauto) in "Hstar". iDestruct "Hstar" as "(Hn & Hstar')". iDestruct "Hn" as (b Cn Qn) "(HlockR & Hns)". iAaccIntro with "HlockR". { iIntros "HlockRn". iModIntro. iSplitR "AU". { iExists T, H. iNext. iFrame. iExists hγ, I, J. iFrame. iPoseProof ("Hstar'" with "[-]") as "Hstar". iExists b, Cn, Qn. iFrame. iFrame. } iFrame. } iIntros "(HlockRn & Hnp)". iMod "AU" as "[_ [_ Hclose]]". iMod ("Hclose" with "[Hnp]") as "HΦ"; try done. iModIntro. iSplitR "HΦ". iNext. iExists T, H. iFrame. iExists hγ, I, J. iFrame. iPoseProof ("Hstar'" with "[HlockRn Hns]") as "Hstar". iExists true, Cn, Qn. iFrame. iFrame. done. Qed. Lemma nodePred_lockR_true γ_gh γ_s r bn n es Cn Cn' Qn' : node r n es Cn -∗ lockR bn n (nodePred γ_gh γ_s r n Cn' Qn') -∗ ⌜bn = true⌝. Proof. iIntros "node Hl_n". destruct bn; try done. iDestruct "Hl_n" as "(Hl & HnP')". iDestruct "HnP'" as (? ? ? ? ? ? ?) "(n' & _)". iExFalso. iApply (node_sep_star r n). iFrame. Qed. Lemma lockR_true Cn' Qn' γ_gh γ_s r n Cn Qn: lockR true n (nodePred γ_gh γ_s r n Cn Qn) -∗ lockR true n (nodePred γ_gh γ_s r n Cn' Qn'). Proof. iIntros "(Hl & _)". iFrame. Qed. Lemma unlockNode_spec_high N γ_te γ_he γ_s Prot γ_I γ_J γ_f γ_gh r n Cn Qn: ⊢ mcs_inv N γ_te γ_he γ_s Prot (Inv_LSM γ_s γ_I γ_J γ_f γ_gh r) -∗ inFP γ_f n -∗ nodePred γ_gh γ_s r n Cn Qn -∗ <<< True >>> unlockNode #n @ ⊤ ∖ ↑(mcsN N) <<< True, RET #() >>>. Proof. iIntros "#mcsInv #FP_n Hnp". iIntros (Φ) "AU". awp_apply (unlockNode_spec n). iInv "mcsInv" as (T H) "(mcs_high & >Inv_LSM)". iDestruct "Inv_LSM" as (hγ I J) "(Hglob & Hstar)". iPoseProof (inFP_domm_glob with "[$FP_n] [$Hglob]") as "%". rename H0 into n_in_I. iEval (rewrite (big_sepS_elem_of_acc (_) (domm I) n); last by eauto) in "Hstar". iDestruct "Hstar" as "(Hn & Hstar')". iDestruct "Hn" as (b Cn' Qn') "(HlockR & Hns)". iAssert (lockR true n (nodePred γ_gh γ_s r n Cn Qn) ∗ (nodePred γ_gh γ_s r n Cn Qn))%I with "[HlockR Hnp]" as "HlockR". { destruct b eqn: Hb. - (* Case n locked *) iFrame "∗". - (* Case n unlocked: impossible *) iDestruct "Hnp" as (? ? ? ? ? ? ?)"(node & _)". iPoseProof (nodePred_lockR_true with "[$node] [$HlockR]") as "H'". iDestruct "H'" as %H'; inversion H'. } iAaccIntro with "HlockR". { iIntros "(HlockR & Hnp)". iModIntro. iSplitR "Hnp AU". iExists T, H. iNext. iFrame. iExists hγ, I, J. iFrame. iPoseProof ("Hstar'" with "[HlockR Hns]") as "Hstar". iExists true, Cn', Qn'. iFrame. iFrame. iFrame. } iIntros "HlockR". iMod "AU" as "[_ [_ Hclose]]". iMod ("Hclose" with "[]") as "HΦ"; try done. iModIntro. iSplitR "HΦ". iNext. iExists T, H. iFrame. iExists hγ, I, J. iFrame. iPoseProof ("Hstar'" with "[HlockR Hns]") as "Hstar". iExists false, Cn, Qn. iAssert (lockR false n (nodePred γ_gh γ_s r n Cn Qn) ∗ nodeShared γ_I γ_J γ_f γ_gh r n Qn H)%I with "[Hns HlockR]" as "(HlockR & Hns)". { iDestruct "HlockR" as "(Hl & Hnp)". iDestruct "Hnp" as (γ_en γ_cn γ_qn γ_cirn esn Vn Tn) "(node_n & #HnP_gh & HnP_frac & HnP_C & HnP_cts)". iDestruct "Hns" as (γ_en' γ_cn' γ_qn' γ_cirn' es' Tn' Bn' In0 Jn0) "Hns'". iPoseProof (nodePred_nodeShared_eq with "[$HnP_gh] [$HnP_frac] [$Hns']") as "(HnP_frac & Hns' & % & % & %)". iSplitR "Hns'". - iFrame. iExists γ_en, γ_cn, γ_qn, γ_cirn, esn, Vn, Tn. iFrame "∗#". - iExists γ_en, γ_cn, γ_qn, γ_cirn, esn, Tn, Bn', In0. iExists Jn0. iFrame. } iFrame. iFrame. iFrame. Qed. End multicopy_lsm_util.
/- Copyright (c) 2018 Mario Carneiro. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. Author: Mario Carneiro Supplementary theorems about the `string` type. -/ import data.list.basic data.char namespace string def ltb : iterator → iterator → bool | s₁ s₂ := begin cases s₂.has_next, {exact ff}, cases h₁ : s₁.has_next, {exact tt}, exact if s₁.curr = s₂.curr then have s₁.next.2.length < s₁.2.length, from match s₁, h₁ with ⟨_, a::l⟩, h := nat.lt_succ_self _ end, ltb s₁.next s₂.next else s₁.curr < s₂.curr, end using_well_founded {rel_tac := λ _ _, `[exact ⟨_, measure_wf (λ s, s.1.2.length)⟩]} instance has_lt' : has_lt string := ⟨λ s₁ s₂, ltb s₁.mk_iterator s₂.mk_iterator⟩ instance decidable_lt : @decidable_rel string (<) := by apply_instance @[simp] theorem lt_iff_to_list_lt : ∀ {s₁ s₂ : string}, s₁ < s₂ ↔ s₁.to_list < s₂.to_list | ⟨i₁⟩ ⟨i₂⟩ := suffices ∀ {p₁ p₂ s₁ s₂}, ltb ⟨p₁, s₁⟩ ⟨p₂, s₂⟩ ↔ s₁ < s₂, from this, begin intros, induction s₁ with a s₁ IH generalizing p₁ p₂ s₂; cases s₂ with b s₂; rw ltb; simp [iterator.has_next], { exact iff_of_false bool.ff_ne_tt (lt_irrefl _) }, { exact iff_of_true rfl list.lex.nil }, { exact iff_of_false bool.ff_ne_tt (not_lt_of_lt list.lex.nil) }, { dsimp [iterator.has_next, iterator.curr, iterator.next], split_ifs, { subst b, exact IH.trans list.lex.cons_iff.symm }, { simp, refine ⟨list.lex.rel, λ e, _⟩, cases e, {cases h rfl}, assumption } } end instance has_le : has_le string := ⟨λ s₁ s₂, ¬ s₂ < s₁⟩ instance decidable_le : @decidable_rel string (≤) := by apply_instance @[simp] theorem le_iff_to_list_le {s₁ s₂ : string} : s₁ ≤ s₂ ↔ s₁.to_list ≤ s₂.to_list := (not_congr lt_iff_to_list_lt).trans not_lt theorem to_list_inj : ∀ {s₁ s₂}, to_list s₁ = to_list s₂ ↔ s₁ = s₂ | ⟨s₁⟩ ⟨s₂⟩ := ⟨congr_arg _, congr_arg _⟩ instance : decidable_linear_order string := by refine_struct { lt := (<), le := (≤), le_antisymm := by simp; exact λ a b h₁ h₂, to_list_inj.1 (le_antisymm h₁ h₂), decidable_lt := by apply_instance, decidable_le := string.decidable_le, decidable_eq := by apply_instance, .. }; { simp [-not_le], introv, apply_field } def map_tokens (c : char) (f : list string → list string) : string → string := intercalate (singleton c) ∘ f ∘ split (= c) end string
lemma closed_real_abs_le: "closed {w \<in> \<real>. \<bar>Re w\<bar> \<le> r}"
function exact = p04_exact ( ) %*****************************************************************************80 % %% P04_EXACT returns the estimated integral for problem 4. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 28 July 2007 % % Author: % % John Burkardt % % Parameters: % % Output, real EXACT, the estimated value of the integral. % exact = -0.0046848541335080643181; return end
function zero_halo_regions!(fields::Tuple, grid) for field in fields zero_halo_regions!(field, grid) end return nothing end function zero_halo_regions!(c::AbstractArray, grid) zero_west_halo!(c, grid.Hx, grid.Nx) zero_east_halo!(c, grid.Hx, grid.Nx) zero_south_halo!(c, grid.Hy, grid.Ny) zero_north_halo!(c, grid.Hy, grid.Ny) zero_top_halo!(c, grid.Hz, grid.Nz) zero_bottom_halo!(c, grid.Hz, grid.Nz) return nothing end zero_west_halo!(c, H, N) = @views @. c[1:H, :, :] = 0 zero_south_halo!(c, H, N) = @views @. c[:, 1:H, :] = 0 zero_bottom_halo!(c, H, N) = @views @. c[:, :, 1:H] = 0 zero_east_halo!(c, H, N) = @views @. c[N+H+1:N+2H, :, :] = 0 zero_north_halo!(c, H, N) = @views @. c[:, N+H+1:N+2H, :] = 0 zero_top_halo!(c, H, N) = @views @. c[:, :, N+H+1:N+2H] = 0
Require Import List Extraction. Section LLists. Variable (A:Type). CoInductive LList := | LNil: LList | LCons : A -> LList -> LList. Inductive Finite : LList -> Prop := |Finite_LNil: Finite LNil |Finite_LCons : forall a l, Finite l-> Finite (LCons a l). (* An equivalent (one contructor) definition of Finite *) Inductive Finite_alt (x:LList) :Prop := |finite_alt_intro: (forall a y , x = LCons a y ->Finite_alt y)-> Finite_alt x. Lemma Finite_Finite_alt : forall x, Finite x -> Finite_alt x. Proof. intros x H;induction H. - constructor; intros a y H;inversion H. - constructor;intros b y;injection 1; intros;subst y;assumption. Qed. Lemma Finite_alt_Finite : forall x, Finite_alt x -> Finite x. Proof. intros x H; induction H as [x H H0]; destruct x;constructor. eapply H0;eauto. Qed. Definition Finite_rect_0 (P:LList->Type) : (forall x : LList, (forall(h:A) (y : LList), x = LCons h y -> P y) -> P x) -> forall x : LList, Finite x -> P x. Proof. intros H x Hx;apply Finite_Finite_alt in Hx. induction Hx. apply H; auto. Defined. Definition Finite_rect (P:LList->Type) : P LNil -> (forall x (l:LList), P l -> (P (LCons x l))) -> forall l, Finite l -> P l. Proof. intros X X0 l H; induction H using Finite_rect_0. destruct x; auto. apply X0; apply X1 with a;reflexivity. Defined. Fixpoint list_inject (l:list A) : LList := match l with nil => LNil |List.cons a l' => LCons a (list_inject l') end. Lemma inj_Finite : forall l, Finite (list_inject l). Proof. induction l;constructor;auto. Qed. Definition to_list_strong: forall x, Finite x-> {l:list A | x=list_inject l}. Proof. intros x H; induction H using Finite_rect. - exists nil;auto. - destruct IHFinite as [l0 H0]; exists (x::l0);subst l;trivial. Defined. Definition to_list: forall x, Finite x-> list A. Proof. intros x Hx;destruct (to_list_strong _ Hx) as [x0 _]; exact x0. Defined. End LLists. Recursive Extraction to_list_strong.
Program testCR Use FileIO_Utilities, Only: creturn,wait Implicit None Integer:: i Write(*,*) Do i = 1,10 Write(*,'(A,I0,A)',ADVANCE='NO') 'Testing...',i,creturn Call Wait(500) End Do Write(*,'(A)') 'Did it work? ' Write(*,*) Write(*,'(A)') 'Press a key to exit...' Read(*,*) End Program
import MyNat.Definition /-! # Tactic exfalso ## Summary `exfalso` changes your goal to `False`. ## Details We know that `False` implies `P` for any proposition `P`, and so if your goal is `P` then you should be able to `apply` `False → P` and reduce your goal to `False`. This is what the `exfalso` tactic does. The theorem that `False → P` is called `False.elim` so one can achieve the same effect with `apply False.elim`. You might think this is a step backwards, but if you have a hypothesis `h : ¬ P` then after `rw [not_iff_imp_false] at h,` you can `apply h,` to make progress. This tactic can also be used in a proof by contradiction, where the hypotheses are enough to deduce a contradiction and the goal happens to be some random statement (possibly a False one) which you just want to simplify to `False`. -/
#define BOOST_TEST_MODULE pcraster model_engine field #include <boost/test/unit_test.hpp> #include "calc_nonspatial.h" #include "calc_spatial.h" BOOST_AUTO_TEST_CASE(testCtorNonSpatial) { using namespace calc; { REAL4 v; NonSpatial ns(VS_S,v); BOOST_CHECK(ns.cr()==CR_REAL4); } { INT4 vb[3]={2,MV_INT4,6}; Spatial sb(VS_N,vb,3); BOOST_CHECK(sb.cr()==CR_INT4); BOOST_CHECK(sb.nrValues()==3); double v; BOOST_CHECK(sb.getCell(v,0)); BOOST_CHECK(v==2); BOOST_CHECK(!sb.getCell(v,1)); BOOST_CHECK(sb.getCell(v,2)); BOOST_CHECK(v==6); } }
From cap_machine Require Import rules_base. From iris.base_logic Require Export invariants gen_heap. From iris.program_logic Require Export weakestpre ectx_lifting. From iris.proofmode Require Import tactics. From iris.algebra Require Import frac. Section cap_lang_rules. Context `{memG Σ, regG Σ, MonRef: MonRefG (leibnizO _) CapR_rtc Σ}. Context `{MachineParameters}. Implicit Types P Q : iProp Σ. Implicit Types σ : ExecConf. Implicit Types a b : Addr. Implicit Types r : RegName. Implicit Types v : cap_lang.val. Implicit Types w : Word. Implicit Types reg : gmap RegName Word. Implicit Types ms : gmap Addr Word. (* TODO: Move somewhere *) Ltac destruct_cap c := let p := fresh "p" in let g := fresh "g" in let b := fresh "b" in let e := fresh "e" in let a := fresh "a" in destruct c as ((((p & g) & b) & e) & a). Inductive Subseg_failure (regs: Reg) (dst: RegName) (src1 src2: Z + RegName) : Reg → Prop := | Subseg_fail_dst_noncap z : regs !! dst = Some (inl z) → Subseg_failure regs dst src1 src2 regs | Subseg_fail_pE p g b e a : regs !! dst = Some (inr (p, g, b, e, a)) → p = E → Subseg_failure regs dst src1 src2 regs | Subseg_fail_src1_nonaddr : addr_of_argument regs src1 = None → Subseg_failure regs dst src1 src2 regs | Subseg_fail_src2_nonaddr : addr_of_argument regs src2 = None → Subseg_failure regs dst src1 src2 regs | Subseg_fail_not_iswithin p g b e a a1 a2 : regs !! dst = Some (inr (p, g, b, e, a)) → addr_of_argument regs src1 = Some a1 → addr_of_argument regs src2 = Some a2 → isWithin a1 a2 b e = false → Subseg_failure regs dst src1 src2 regs | Subseg_fail_incrPC p g b e a a1 a2 : regs !! dst = Some (inr (p, g, b, e, a)) → p <> E → addr_of_argument regs src1 = Some a1 → addr_of_argument regs src2 = Some a2 → isWithin a1 a2 b e = true → incrementPC (<[ dst := inr (p, g, a1, a2, a) ]> regs) = None → Subseg_failure regs dst src1 src2 (<[ dst := inr (p, g, a1, a2, a) ]> regs). Inductive Subseg_spec (regs: Reg) (dst: RegName) (src1 src2: Z + RegName) (regs': Reg): cap_lang.val -> Prop := | Subseg_spec_success p g b e a a1 a2: regs !! dst = Some (inr (p, g, b, e, a)) -> p <> E -> addr_of_argument regs src1 = Some a1 -> addr_of_argument regs src2 = Some a2 -> isWithin a1 a2 b e = true -> incrementPC (<[ dst := inr (p, g, a1, a2, a) ]> regs) = Some regs' -> Subseg_spec regs dst src1 src2 regs' NextIV | Subseg_spec_failure : Subseg_failure regs dst src1 src2 regs' → Subseg_spec regs dst src1 src2 regs' FailedV. Lemma wp_Subseg Ep pc_p pc_g pc_b pc_e pc_a pc_p' w dst src1 src2 regs : decodeInstrW w = Subseg dst src1 src2 -> PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p, pc_g), pc_b, pc_e, pc_a)) → regs !! PC = Some (inr ((pc_p, pc_g), pc_b, pc_e, pc_a)) → regs_of (Subseg dst src1 src2) ⊆ dom _ regs → {{{ ▷ pc_a ↦ₐ[pc_p'] w ∗ ▷ [∗ map] k↦y ∈ regs, k ↦ᵣ y }}} Instr Executable @ Ep {{{ regs' retv, RET retv; ⌜ Subseg_spec regs dst src1 src2 regs' retv ⌝ ∗ pc_a ↦ₐ[pc_p'] w ∗ [∗ map] k↦y ∈ regs', k ↦ᵣ y }}}. Proof. iIntros (Hinstr Hfl Hvpc HPC Dregs φ) "(>Hpc_a & >Hmap) Hφ". iApply wp_lift_atomic_head_step_no_fork; auto. iIntros (σ1 l1 l2 n) "Hσ1 /=". destruct σ1; simpl. iDestruct "Hσ1" as "[Hr Hm]". assert (pc_p' ≠ O). { destruct pc_p'; auto. destruct pc_p; inversion Hfl. inversion Hvpc; naive_solver. } iDestruct (gen_heap_valid_inclSepM with "Hr Hmap") as %Hregs. have HPC' := regs_lookup_eq _ _ _ HPC. have ? := lookup_weaken _ _ _ _ HPC Hregs. iDestruct (@gen_heap_valid_cap with "Hm Hpc_a") as %Hpc_a; auto. iModIntro. iSplitR. by iPureIntro; apply normal_always_head_reducible. iNext. iIntros (e2 σ2 efs Hpstep). apply prim_step_exec_inv in Hpstep as (-> & -> & (c & -> & Hstep)). iSplitR; auto. eapply step_exec_inv in Hstep; eauto. specialize (indom_regs_incl _ _ _ Dregs Hregs) as Hri. unfold regs_of in Hri, Dregs. destruct (Hri dst) as [wdst [H'dst Hdst]]. by set_solver+. destruct wdst as [| cdst]; [| destruct_cap cdst]. { rewrite /= /RegLocate Hdst in Hstep. repeat case_match; inv Hstep; simplify_pair_eq. all: iFailWP "Hφ" Subseg_fail_dst_noncap. } destruct (decide (p = E)). { subst p. rewrite /= /RegLocate Hdst in Hstep. repeat case_match; inv Hstep; simplify_pair_eq. all: iFailWP "Hφ" Subseg_fail_pE. } destruct (addr_of_argument regs src1) as [a1|] eqn:Ha1; pose proof Ha1 as H'a1; cycle 1. { destruct src1 as [| r1] eqn:?; cbn in Ha1. { rewrite /= /RegLocate Hdst Ha1 in Hstep. assert (c = Failed ∧ σ2 = (r, m)) as (-> & ->). { repeat case_match; inv Hstep; auto. } iFailWP "Hφ" Subseg_fail_src1_nonaddr. } subst src1. destruct (Hri r1) as [r1v [Hr'1 Hr1]]. by unfold regs_of_argument; set_solver+. rewrite /addr_of_argument /= Hr'1 in Ha1. assert (c = Failed ∧ σ2 = (r, m)) as (-> & ->). { repeat case_match; simplify_pair_eq. all: rewrite /= /RegLocate Hdst Hr1 ?Ha1 in Hstep. all: repeat case_match; inv Hstep; auto. } repeat case_match; try congruence. all: iFailWP "Hφ" Subseg_fail_src1_nonaddr. } eapply addr_of_argument_Some_inv' in Ha1 as [z1 [Hz1 Hz1']]; eauto. destruct (addr_of_argument regs src2) as [a2|] eqn:Ha2; pose proof Ha2 as H'a2; cycle 1. { destruct src2 as [| r2] eqn:?; cbn in Ha2. { rewrite /= /RegLocate Hdst Ha2 in Hstep. assert (c = Failed ∧ σ2 = (r, m)) as (-> & ->). { repeat case_match; inv Hstep; auto. } iFailWP "Hφ" Subseg_fail_src2_nonaddr. } subst src2. destruct (Hri r2) as [r2v [Hr'2 Hr2]]. by unfold regs_of_argument; set_solver+. rewrite /addr_of_argument /= Hr'2 in Ha2. assert (c = Failed ∧ σ2 = (r, m)) as (-> & ->). { repeat case_match; simplify_pair_eq. all: rewrite /= /RegLocate Hdst Hr2 ?Ha2 in Hstep. all: repeat case_match; inv Hstep; auto. } repeat case_match; try congruence. all: iFailWP "Hφ" Subseg_fail_src2_nonaddr. } eapply addr_of_argument_Some_inv' in Ha2 as [z2 [Hz2 Hz2']]; eauto. assert ((c, σ2) = if isWithin a1 a2 b e then updatePC (update_reg (r, m) dst (inr (p, g, a1, a2, a))) else (Failed, (r, m))) as Hexec. { rewrite -Hstep; clear Hstep. rewrite /= /RegLocate Hdst. destruct Hz1' as [ -> | [r1 (-> & Hr1 & Hr1') ] ]; destruct Hz2' as [ -> | [r2 (-> & Hr2 & Hr2') ] ]. all: rewrite ?Hz1 ?Hz2 ?Hr1' ?Hr2'. all: repeat case_match; auto; congruence. } clear Hstep. destruct (isWithin a1 a2 b e) eqn:Hiw; cycle 1. { inv Hexec. iFailWP "Hφ" Subseg_fail_not_iswithin. } destruct (incrementPC (<[ dst := (inr (p, g, a1, a2, a)) ]> regs)) eqn:HX; pose proof HX as H'X; cycle 1. { apply incrementPC_fail_updatePC with (m:=m) in HX. eapply updatePC_fail_incl with (m':=m) in HX. 2: by apply lookup_insert_is_Some'; eauto. 2: by apply insert_mono; eauto. simplify_pair_eq. iMod ((gen_heap_update_inSepM _ _ dst) with "Hr Hmap") as "[Hr Hmap]"; eauto. iFailWP "Hφ" Subseg_fail_incrPC. } eapply (incrementPC_success_updatePC _ m) in HX as (p' & g' & b' & e' & a'' & a_pc' & HPC'' & Ha_pc' & HuPC & ->). eapply updatePC_success_incl with (m':=m) in HuPC. 2: by eapply insert_mono; eauto. simplify_pair_eq. iFrame. iMod ((gen_heap_update_inSepM _ _ dst) with "Hr Hmap") as "[Hr Hmap]"; eauto. iMod ((gen_heap_update_inSepM _ _ PC) with "Hr Hmap") as "[Hr Hmap]"; eauto. iFrame. iApply "Hφ". iFrame. iPureIntro. econstructor; eauto. Qed. Lemma wp_subseg_success E pc_p pc_g pc_b pc_e pc_a w dst r1 r2 p g b e a n1 n2 a1 a2 pc_p' pc_a' : decodeInstrW w = Subseg dst (inr r1) (inr r2) → PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p,pc_g),pc_b,pc_e,pc_a)) → z_to_addr n1 = Some a1 ∧ z_to_addr n2 = Some a2 → p ≠ machine_base.E → dst ≠ PC → isWithin a1 a2 b e = true → (pc_a + 1)%a = Some pc_a' → {{{ ▷ PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a) ∗ ▷ pc_a ↦ₐ[pc_p'] w ∗ ▷ dst ↦ᵣ inr ((p,g),b,e,a) ∗ ▷ r1 ↦ᵣ inl n1 ∗ ▷ r2 ↦ᵣ inl n2 }}} Instr Executable @ E {{{ RET NextIV; PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a') ∗ pc_a ↦ₐ[pc_p'] w ∗ r1 ↦ᵣ inl n1 ∗ r2 ↦ᵣ inl n2 ∗ dst ↦ᵣ inr (p, g, a1, a2, a) }}}. Proof. iIntros (Hinstr Hfl Hvpc [Hn1 Hn2] Hpne Hdstne Hwb Hpc_a' ϕ) "(>HPC & >Hpc_a & >Hdst & >Hr1 & >Hr2) Hφ". iDestruct (map_of_regs_4 with "HPC Hr1 Hr2 Hdst") as "[Hmap (%&%&%&%&%&%)]". iApply (wp_Subseg with "[$Hmap Hpc_a]"); eauto; simplify_map_eq; eauto. by unfold regs_of; rewrite !dom_insert; set_solver+. iNext. iIntros (regs' retv) "(#Hspec & Hpc_a & Hmap)". iDestruct "Hspec" as %Hspec. destruct Hspec as [| * Hfail]. { (* Success *) iApply "Hφ". iFrame. incrementPC_inv; simplify_map_eq. unfold addr_of_argument, z_of_argument in *. simplify_map_eq. rewrite (insert_commute _ PC dst) // insert_insert (insert_commute _ r2 dst) // (insert_commute _ r1 dst) // (insert_commute _ PC dst) // insert_insert. iDestruct (regs_of_map_4 with "Hmap") as "(?&?&?&?)"; eauto; iFrame. } { (* Failure (contradiction) *) destruct Hfail; try incrementPC_inv; unfold addr_of_argument, z_of_argument in *. all: simplify_map_eq; eauto; congruence. } Qed. Lemma wp_subseg_success_same E pc_p pc_g pc_b pc_e pc_a w dst r1 p g b e a n1 a1 pc_p' pc_a' : decodeInstrW w = Subseg dst (inr r1) (inr r1) → PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p,pc_g),pc_b,pc_e,pc_a)) → z_to_addr n1 = Some a1 → p ≠ machine_base.E → dst ≠ PC → isWithin a1 a1 b e = true → (pc_a + 1)%a = Some pc_a' → {{{ ▷ PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a) ∗ ▷ pc_a ↦ₐ[pc_p'] w ∗ ▷ dst ↦ᵣ inr ((p,g),b,e,a) ∗ ▷ r1 ↦ᵣ inl n1 }}} Instr Executable @ E {{{ RET NextIV; PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a') ∗ pc_a ↦ₐ[pc_p'] w ∗ r1 ↦ᵣ inl n1 ∗ dst ↦ᵣ inr (p, g, a1, a1, a) }}}. Proof. iIntros (Hinstr Hfl Hvpc Hn1 Hpne Hdstne Hwb Hpc_a' ϕ) "(>HPC & >Hpc_a & >Hdst & >Hr1) Hφ". iDestruct (map_of_regs_3 with "HPC Hr1 Hdst") as "[Hmap (%&%&%)]". iApply (wp_Subseg with "[$Hmap Hpc_a]"); eauto; simplify_map_eq; eauto. by unfold regs_of; rewrite !dom_insert; set_solver+. iNext. iIntros (regs' retv) "(#Hspec & Hpc_a & Hmap)". iDestruct "Hspec" as %Hspec. destruct Hspec as [| * Hfail]. { (* Success *) iApply "Hφ". iFrame. incrementPC_inv; simplify_map_eq. unfold addr_of_argument, z_of_argument in *. simplify_map_eq. rewrite (insert_commute _ PC dst) // insert_insert (insert_commute _ r1 dst) // (insert_commute _ PC dst) // insert_insert. iDestruct (regs_of_map_3 with "Hmap") as "(?&?&?)"; eauto; iFrame. } { (* Failure (contradiction) *) destruct Hfail; try incrementPC_inv; unfold addr_of_argument, z_of_argument in *. all: simplify_map_eq; eauto; congruence. } Qed. Lemma wp_subseg_success_l E pc_p pc_g pc_b pc_e pc_a w dst r2 p g b e a n1 n2 a1 a2 pc_p' pc_a' : decodeInstrW w = Subseg dst (inl n1) (inr r2) → PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p,pc_g),pc_b,pc_e,pc_a)) → z_to_addr n1 = Some a1 ∧ z_to_addr n2 = Some a2 → p ≠ machine_base.E → dst ≠ PC → isWithin a1 a2 b e = true → (pc_a + 1)%a = Some pc_a' → {{{ ▷ PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a) ∗ ▷ pc_a ↦ₐ[pc_p'] w ∗ ▷ dst ↦ᵣ inr ((p,g),b,e,a) ∗ ▷ r2 ↦ᵣ inl n2 }}} Instr Executable @ E {{{ RET NextIV; PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a') ∗ pc_a ↦ₐ[pc_p'] w ∗ r2 ↦ᵣ inl n2 ∗ dst ↦ᵣ inr (p, g, a1, a2, a) }}}. Proof. iIntros (Hinstr Hfl Hvpc [Hn1 Hn2] Hpne Hdstne Hwb Hpc_a' ϕ) "(>HPC & >Hpc_a & >Hdst & >Hr2) Hφ". iDestruct (map_of_regs_3 with "HPC Hr2 Hdst") as "[Hmap (%&%&%)]". iApply (wp_Subseg with "[$Hmap Hpc_a]"); eauto; simplify_map_eq; eauto. by unfold regs_of; rewrite !dom_insert; set_solver+. iNext. iIntros (regs' retv) "(#Hspec & Hpc_a & Hmap)". iDestruct "Hspec" as %Hspec. destruct Hspec as [| * Hfail]. { (* Success *) iApply "Hφ". iFrame. incrementPC_inv; simplify_map_eq. unfold addr_of_argument, z_of_argument in *. simplify_map_eq. rewrite (insert_commute _ PC dst) // insert_insert (insert_commute _ r2 dst) // (insert_commute _ PC dst) // insert_insert. iDestruct (regs_of_map_3 with "Hmap") as "(?&?&?)"; eauto; iFrame. } { (* Failure (contradiction) *) destruct Hfail; try incrementPC_inv; unfold addr_of_argument, z_of_argument in *. all: simplify_map_eq; eauto; congruence. } Qed. Lemma wp_subseg_success_r E pc_p pc_g pc_b pc_e pc_a w dst r1 p g b e a n1 n2 a1 a2 pc_p' pc_a' : decodeInstrW w = Subseg dst (inr r1) (inl n2) → PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p,pc_g),pc_b,pc_e,pc_a)) → z_to_addr n1 = Some a1 ∧ z_to_addr n2 = Some a2 → p ≠ machine_base.E → dst ≠ PC → isWithin a1 a2 b e = true → (pc_a + 1)%a = Some pc_a' → {{{ ▷ PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a) ∗ ▷ pc_a ↦ₐ[pc_p'] w ∗ ▷ dst ↦ᵣ inr ((p,g),b,e,a) ∗ ▷ r1 ↦ᵣ inl n1 }}} Instr Executable @ E {{{ RET NextIV; PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a') ∗ pc_a ↦ₐ[pc_p'] w ∗ r1 ↦ᵣ inl n1 ∗ dst ↦ᵣ inr (p, g, a1, a2, a) }}}. Proof. iIntros (Hinstr Hfl Hvpc [Hn1 Hn2] Hpne Hdstne Hwb Hpc_a' ϕ) "(>HPC & >Hpc_a & >Hdst & >Hr1) Hφ". iDestruct (map_of_regs_3 with "HPC Hr1 Hdst") as "[Hmap (%&%&%)]". iApply (wp_Subseg with "[$Hmap Hpc_a]"); eauto; simplify_map_eq; eauto. by unfold regs_of; rewrite !dom_insert; set_solver+. iNext. iIntros (regs' retv) "(#Hspec & Hpc_a & Hmap)". iDestruct "Hspec" as %Hspec. destruct Hspec as [| * Hfail]. { (* Success *) iApply "Hφ". iFrame. incrementPC_inv; simplify_map_eq. unfold addr_of_argument, z_of_argument in *. simplify_map_eq. rewrite (insert_commute _ PC dst) // insert_insert (insert_commute _ r1 dst) // (insert_commute _ PC dst) // insert_insert. iDestruct (regs_of_map_3 with "Hmap") as "(?&?&?)"; eauto; iFrame. } { (* Failure (contradiction) *) destruct Hfail; try incrementPC_inv; unfold addr_of_argument, z_of_argument in *. all: simplify_map_eq; eauto; congruence. } Qed. Lemma wp_subseg_success_lr E pc_p pc_g pc_b pc_e pc_a w dst p g b e a n1 n2 a1 a2 pc_p' pc_a' : decodeInstrW w = Subseg dst (inl n1) (inl n2) → PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p,pc_g),pc_b,pc_e,pc_a)) → z_to_addr n1 = Some a1 ∧ z_to_addr n2 = Some a2 → p ≠ machine_base.E → dst ≠ PC → isWithin a1 a2 b e = true → (pc_a + 1)%a = Some pc_a' → {{{ ▷ PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a) ∗ ▷ pc_a ↦ₐ[pc_p'] w ∗ ▷ dst ↦ᵣ inr ((p,g),b,e,a) }}} Instr Executable @ E {{{ RET NextIV; PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a') ∗ pc_a ↦ₐ[pc_p'] w ∗ dst ↦ᵣ inr (p, g, a1, a2, a) }}}. Proof. iIntros (Hinstr Hfl Hvpc [Hn1 Hn2] Hpne Hdstne Hwb Hpc_a' ϕ) "(>HPC & >Hpc_a & >Hdst) Hφ". iDestruct (map_of_regs_2 with "HPC Hdst") as "[Hmap %]". iApply (wp_Subseg with "[$Hmap Hpc_a]"); eauto; simplify_map_eq; eauto. by unfold regs_of; rewrite !dom_insert; set_solver+. iNext. iIntros (regs' retv) "(#Hspec & Hpc_a & Hmap)". iDestruct "Hspec" as %Hspec. destruct Hspec as [| * Hfail]. { (* Success *) iApply "Hφ". iFrame. incrementPC_inv; simplify_map_eq. unfold addr_of_argument, z_of_argument in *. simplify_map_eq. rewrite (insert_commute _ PC dst) // insert_insert insert_commute // insert_insert. iDestruct (regs_of_map_2 with "Hmap") as "(?&?)"; eauto; iFrame. } { (* Failure (contradiction) *) destruct Hfail; try incrementPC_inv; unfold addr_of_argument, z_of_argument in *. all: simplify_map_eq; eauto; congruence. } Qed. Lemma wp_subseg_success_pc E pc_p pc_g pc_b pc_e pc_a w r1 r2 n1 n2 a1 a2 pc_p' pc_a' : decodeInstrW w = Subseg PC (inr r1) (inr r2) → PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p,pc_g),pc_b,pc_e,pc_a)) → z_to_addr n1 = Some a1 ∧ z_to_addr n2 = Some a2 → pc_p ≠ machine_base.E → isWithin a1 a2 pc_b pc_e = true → (pc_a + 1)%a = Some pc_a' → {{{ ▷ PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a) ∗ ▷ pc_a ↦ₐ[pc_p'] w ∗ ▷ r1 ↦ᵣ inl n1 ∗ ▷ r2 ↦ᵣ inl n2 }}} Instr Executable @ E {{{ RET NextIV; PC ↦ᵣ inr ((pc_p,pc_g),a1,a2,pc_a') ∗ pc_a ↦ₐ[pc_p'] w ∗ r1 ↦ᵣ inl n1 ∗ r2 ↦ᵣ inl n2 }}}. Proof. iIntros (Hinstr Hfl Hvpc [Hn1 Hn2] Hpne Hwb Hpc_a' ϕ) "(>HPC & >Hpc_a & >Hr1 & >Hr2) Hφ". iDestruct (map_of_regs_3 with "HPC Hr1 Hr2") as "[Hmap (%&%&%)]". iApply (wp_Subseg with "[$Hmap Hpc_a]"); eauto; simplify_map_eq; eauto. by unfold regs_of; rewrite !dom_insert; set_solver+. iNext. iIntros (regs' retv) "(#Hspec & Hpc_a & Hmap)". iDestruct "Hspec" as %Hspec. destruct Hspec as [| * Hfail]. { (* Success *) iApply "Hφ". iFrame. incrementPC_inv; simplify_map_eq. unfold addr_of_argument, z_of_argument in *. simplify_map_eq. rewrite !insert_insert. iDestruct (regs_of_map_3 with "Hmap") as "(?&?&?)"; eauto; iFrame. } { (* Failure (contradiction) *) destruct Hfail; try incrementPC_inv; unfold addr_of_argument, z_of_argument in *. all: simplify_map_eq; eauto; try congruence. congruence. } Qed. Lemma wp_subseg_success_pc_same E pc_p pc_g pc_b pc_e pc_a w r1 n1 a1 pc_p' pc_a' : decodeInstrW w = Subseg PC (inr r1) (inr r1) → PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p,pc_g),pc_b,pc_e,pc_a)) → z_to_addr n1 = Some a1 → pc_p ≠ machine_base.E → isWithin a1 a1 pc_b pc_e = true → (pc_a + 1)%a = Some pc_a' → {{{ ▷ PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a) ∗ ▷ pc_a ↦ₐ[pc_p'] w ∗ ▷ r1 ↦ᵣ inl n1 }}} Instr Executable @ E {{{ RET NextIV; PC ↦ᵣ inr ((pc_p,pc_g),a1,a1,pc_a') ∗ pc_a ↦ₐ[pc_p'] w ∗ r1 ↦ᵣ inl n1 }}}. Proof. iIntros (Hinstr Hfl Hvpc Hn1 Hpne Hwb Hpc_a' ϕ) "(>HPC & >Hpc_a & >Hr1) Hφ". iDestruct (map_of_regs_2 with "HPC Hr1") as "[Hmap %]". iApply (wp_Subseg with "[$Hmap Hpc_a]"); eauto; simplify_map_eq; eauto. by unfold regs_of; rewrite !dom_insert; set_solver+. iNext. iIntros (regs' retv) "(#Hspec & Hpc_a & Hmap)". iDestruct "Hspec" as %Hspec. destruct Hspec as [| * Hfail]. { (* Success *) iApply "Hφ". iFrame. incrementPC_inv; simplify_map_eq. unfold addr_of_argument, z_of_argument in *. simplify_map_eq. rewrite (insert_commute _ PC r1) // insert_insert insert_commute // insert_insert. iDestruct (regs_of_map_2 with "Hmap") as "(?&?)"; eauto; iFrame. } { (* Failure (contradiction) *) destruct Hfail; try incrementPC_inv; unfold addr_of_argument, z_of_argument in *. all: simplify_map_eq; eauto; try congruence. congruence. } Qed. Lemma wp_subseg_success_pc_l E pc_p pc_g pc_b pc_e pc_a w r2 n1 n2 a1 a2 pc_p' pc_a' : decodeInstrW w = Subseg PC (inl n1) (inr r2) → PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p,pc_g),pc_b,pc_e,pc_a)) → z_to_addr n1 = Some a1 ∧ z_to_addr n2 = Some a2 → pc_p ≠ machine_base.E → isWithin a1 a2 pc_b pc_e = true → (pc_a + 1)%a = Some pc_a' → {{{ ▷ PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a) ∗ ▷ pc_a ↦ₐ[pc_p'] w ∗ ▷ r2 ↦ᵣ inl n2 }}} Instr Executable @ E {{{ RET NextIV; PC ↦ᵣ inr ((pc_p,pc_g),a1,a2,pc_a') ∗ pc_a ↦ₐ[pc_p'] w ∗ r2 ↦ᵣ inl n2 }}}. Proof. iIntros (Hinstr Hfl Hvpc [Hn1 Hn2] Hpne Hwb Hpc_a' ϕ) "(>HPC & >Hpc_a & >Hr2) Hφ". iDestruct (map_of_regs_2 with "HPC Hr2") as "[Hmap %]". iApply (wp_Subseg with "[$Hmap Hpc_a]"); eauto; simplify_map_eq; eauto. by unfold regs_of; rewrite !dom_insert; set_solver+. iNext. iIntros (regs' retv) "(#Hspec & Hpc_a & Hmap)". iDestruct "Hspec" as %Hspec. destruct Hspec as [| * Hfail]. { (* Success *) iApply "Hφ". iFrame. incrementPC_inv; simplify_map_eq. unfold addr_of_argument, z_of_argument in *. simplify_map_eq. rewrite (insert_commute _ PC r2) // insert_insert insert_commute // insert_insert. iDestruct (regs_of_map_2 with "Hmap") as "(?&?)"; eauto; iFrame. } { (* Failure (contradiction) *) destruct Hfail; try incrementPC_inv; unfold addr_of_argument, z_of_argument in *. all: simplify_map_eq; eauto; try congruence. congruence. } Qed. Lemma wp_subseg_success_pc_r E pc_p pc_g pc_b pc_e pc_a w r1 n1 n2 a1 a2 pc_p' pc_a' : decodeInstrW w = Subseg PC (inr r1) (inl n2) → PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p,pc_g),pc_b,pc_e,pc_a)) → z_to_addr n1 = Some a1 ∧ z_to_addr n2 = Some a2 → pc_p ≠ machine_base.E → isWithin a1 a2 pc_b pc_e = true → (pc_a + 1)%a = Some pc_a' → {{{ ▷ PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a) ∗ ▷ pc_a ↦ₐ[pc_p'] w ∗ ▷ r1 ↦ᵣ inl n1 }}} Instr Executable @ E {{{ RET NextIV; PC ↦ᵣ inr ((pc_p,pc_g),a1,a2,pc_a') ∗ pc_a ↦ₐ[pc_p'] w ∗ r1 ↦ᵣ inl n1 }}}. Proof. iIntros (Hinstr Hfl Hvpc [Hn1 Hn2] Hpne Hwb Hpc_a' ϕ) "(>HPC & >Hpc_a & >Hr1) Hφ". iDestruct (map_of_regs_2 with "HPC Hr1") as "[Hmap %]". iApply (wp_Subseg with "[$Hmap Hpc_a]"); eauto; simplify_map_eq; eauto. by unfold regs_of; rewrite !dom_insert; set_solver+. iNext. iIntros (regs' retv) "(#Hspec & Hpc_a & Hmap)". iDestruct "Hspec" as %Hspec. destruct Hspec as [| * Hfail]. { (* Success *) iApply "Hφ". iFrame. incrementPC_inv; simplify_map_eq. unfold addr_of_argument, z_of_argument in *. simplify_map_eq. rewrite (insert_commute _ PC r1) // insert_insert insert_commute // insert_insert. iDestruct (regs_of_map_2 with "Hmap") as "(?&?)"; eauto; iFrame. } { (* Failure (contradiction) *) destruct Hfail; try incrementPC_inv; unfold addr_of_argument, z_of_argument in *. all: simplify_map_eq; eauto; try congruence. congruence. } Qed. Lemma wp_subseg_success_pc_lr E pc_p pc_g pc_b pc_e pc_a w n1 n2 a1 a2 pc_p' pc_a' : decodeInstrW w = Subseg PC (inl n1) (inl n2) → PermFlows pc_p pc_p' → isCorrectPC (inr ((pc_p,pc_g),pc_b,pc_e,pc_a)) → z_to_addr n1 = Some a1 ∧ z_to_addr n2 = Some a2 → pc_p ≠ machine_base.E → isWithin a1 a2 pc_b pc_e = true → (pc_a + 1)%a = Some pc_a' → {{{ ▷ PC ↦ᵣ inr ((pc_p,pc_g),pc_b,pc_e,pc_a) ∗ ▷ pc_a ↦ₐ[pc_p'] w }}} Instr Executable @ E {{{ RET NextIV; PC ↦ᵣ inr ((pc_p,pc_g),a1,a2,pc_a') ∗ pc_a ↦ₐ[pc_p'] w }}}. Proof. iIntros (Hinstr Hfl Hvpc [Hn1 Hn2] Hpne Hwb Hpc_a' ϕ) "(>HPC & >Hpc_a) Hφ". iDestruct (map_of_regs_1 with "HPC") as "Hmap". iApply (wp_Subseg with "[$Hmap Hpc_a]"); eauto; simplify_map_eq; eauto. by unfold regs_of; rewrite !dom_insert; set_solver+. iNext. iIntros (regs' retv) "(#Hspec & Hpc_a & Hmap)". iDestruct "Hspec" as %Hspec. destruct Hspec as [| * Hfail]. { (* Success *) iApply "Hφ". iFrame. incrementPC_inv; simplify_map_eq. unfold addr_of_argument, z_of_argument in *. simplify_map_eq. rewrite !insert_insert. iDestruct (regs_of_map_1 with "Hmap") as "?"; eauto; iFrame. } { (* Failure (contradiction) *) destruct Hfail; try incrementPC_inv; unfold addr_of_argument, z_of_argument in *. all: simplify_map_eq; eauto; try congruence. congruence. } Qed. End cap_lang_rules.
subroutine initializeSubModelData( & & gFile, & ! for SDCM Data & pFile, dFile, & ! for MDCM Data & mFile, lFile, sFile, & ! For Evaporation data & dataInitialized) ! ==================================================================== ! ! Initializes all sub-model data variables ! ! ==================================================================== use, intrinsic:: iso_fortran_env, only: int32 use standardDCMData, only: initializeStandardDCMData, & & sDCMDataEstablished use modifiedDCMData, only: initializeModifiedDCMData, & & mDCMDataInitialized use fermiBreakUpClass, only: initializeFermiData use preequilibriumClass, only: preequilibriumInit use evaporationFissionData, only: initializeEvaporationData, & & evaporationDataEstablished implicit none character(LEN=128), intent(in ) :: gFile ! Photon file name character(LEN=128), intent(in ) :: pFile ! Photon file name (mDCM) character(LEN=128), intent(in ) :: dFile ! Decay file name (mDCM) character(LEN=128), intent(in ) :: mFile ! Mass file name character(LEN=128), intent(in ) :: lFile ! Level file name character(LEN=128), intent(in ) :: sFile ! Shell file name logical, intent(inout) :: dataInitialized integer(int32) :: errorFlag ! ==================================================================== !>>> ASSIGN EACH CALL BELOW AN OPENMP TASK TO READ IN PHYSICS DATA ! sDCM Data: errorFlag = initializeStandardDCMData(gFile, dataIO%print) if ( .not.sDCMDataEstablished ) then ! Failure: write(dataIO%message, 1000) "Standard" call dataIO%print(2, 2, dataIO%message) dataInitialized = .FALSE. end if ! mDCM Data: call initializeModifiedDCMData(pFile, dFile, dataIO%print) if ( .not.mDCMDataInitialized ) then ! Failure: write(dataIO%message, 1000) "Modified" call dataIO%print(2, 2, dataIO%message) dataInitialized = .FALSE. end if ! Fermi Break-Up Data: call initializeFermiData() ! Preequilibrium Data: call preequilibriumInit() ! Evaporation Data: errorFlag = initializeEvaporationData(mFile, lFile, & & sFile) if ( .not.evaporationDataEstablished ) then ! Failure: write(dataIO%message, 1300) call dataIO%print(2, 2, dataIO%message) dataInitialized = .FALSE. end if return ! ==================================================================== 1000 format("The ", A, " DCM models' data parameterizations failed ", & & "to initialize.") 1300 format("The Evaporation model's data parameterizations failed ", & & "to initialize.") ! ==================================================================== end subroutine initializeSubModelData
[GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹² : Semiring R inst✝¹¹ : AddCommMonoid M inst✝¹⁰ : Module R M inst✝⁹ : TopologicalSpace M inst✝⁸ : AddCommMonoid M' inst✝⁷ : Module R M' inst✝⁶ : TopologicalSpace M' inst✝⁵ : AddCommMonoid N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : AddCommMonoid N' inst✝¹ : Module R N' inst✝ : TopologicalSpace N' n : ℕ f✝ g✝ f g : M[Λ^ι]→L[R]N h : toAlternatingMap f = toAlternatingMap g ⊢ ↑f = ↑g [PROOFSTEP] convert FunLike.ext'_iff.1 h [GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹² : Semiring R inst✝¹¹ : AddCommMonoid M inst✝¹⁰ : Module R M inst✝⁹ : TopologicalSpace M inst✝⁸ : AddCommMonoid M' inst✝⁷ : Module R M' inst✝⁶ : TopologicalSpace M' inst✝⁵ : AddCommMonoid N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : AddCommMonoid N' inst✝¹ : Module R N' inst✝ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N e : M ≃L[R] M' f : M[Λ^ι]→L[R]N ⊢ (fun f => compContinuousLinearMap f ↑e) ((fun f => compContinuousLinearMap f ↑(ContinuousLinearEquiv.symm e)) f) = f [PROOFSTEP] ext [GOAL] case H R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹² : Semiring R inst✝¹¹ : AddCommMonoid M inst✝¹⁰ : Module R M inst✝⁹ : TopologicalSpace M inst✝⁸ : AddCommMonoid M' inst✝⁷ : Module R M' inst✝⁶ : TopologicalSpace M' inst✝⁵ : AddCommMonoid N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : AddCommMonoid N' inst✝¹ : Module R N' inst✝ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N e : M ≃L[R] M' f : M[Λ^ι]→L[R]N x✝ : ι → M ⊢ ↑((fun f => compContinuousLinearMap f ↑e) ((fun f => compContinuousLinearMap f ↑(ContinuousLinearEquiv.symm e)) f)) x✝ = ↑f x✝ [PROOFSTEP] simp [(· ∘ ·)] [GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹² : Semiring R inst✝¹¹ : AddCommMonoid M inst✝¹⁰ : Module R M inst✝⁹ : TopologicalSpace M inst✝⁸ : AddCommMonoid M' inst✝⁷ : Module R M' inst✝⁶ : TopologicalSpace M' inst✝⁵ : AddCommMonoid N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : AddCommMonoid N' inst✝¹ : Module R N' inst✝ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N e : M ≃L[R] M' f : M'[Λ^ι]→L[R]N ⊢ (fun f => compContinuousLinearMap f ↑(ContinuousLinearEquiv.symm e)) ((fun f => compContinuousLinearMap f ↑e) f) = f [PROOFSTEP] ext [GOAL] case H R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹² : Semiring R inst✝¹¹ : AddCommMonoid M inst✝¹⁰ : Module R M inst✝⁹ : TopologicalSpace M inst✝⁸ : AddCommMonoid M' inst✝⁷ : Module R M' inst✝⁶ : TopologicalSpace M' inst✝⁵ : AddCommMonoid N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : AddCommMonoid N' inst✝¹ : Module R N' inst✝ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N e : M ≃L[R] M' f : M'[Λ^ι]→L[R]N x✝ : ι → M' ⊢ ↑((fun f => compContinuousLinearMap f ↑(ContinuousLinearEquiv.symm e)) ((fun f => compContinuousLinearMap f ↑e) f)) x✝ = ↑f x✝ [PROOFSTEP] simp [(· ∘ ·)] [GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹² : Semiring R inst✝¹¹ : AddCommMonoid M inst✝¹⁰ : Module R M inst✝⁹ : TopologicalSpace M inst✝⁸ : AddCommMonoid M' inst✝⁷ : Module R M' inst✝⁶ : TopologicalSpace M' inst✝⁵ : AddCommMonoid N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : AddCommMonoid N' inst✝¹ : Module R N' inst✝ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N e : N ≃L[R] N' f : M[Λ^ι]→L[R]N ⊢ ContinuousLinearMap.compContinuousAlternatingMap (↑(ContinuousLinearEquiv.symm e)) (ContinuousLinearMap.compContinuousAlternatingMap (↑e) f) = f [PROOFSTEP] ext [GOAL] case H R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹² : Semiring R inst✝¹¹ : AddCommMonoid M inst✝¹⁰ : Module R M inst✝⁹ : TopologicalSpace M inst✝⁸ : AddCommMonoid M' inst✝⁷ : Module R M' inst✝⁶ : TopologicalSpace M' inst✝⁵ : AddCommMonoid N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : AddCommMonoid N' inst✝¹ : Module R N' inst✝ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N e : N ≃L[R] N' f : M[Λ^ι]→L[R]N x✝ : ι → M ⊢ ↑(ContinuousLinearMap.compContinuousAlternatingMap (↑(ContinuousLinearEquiv.symm e)) (ContinuousLinearMap.compContinuousAlternatingMap (↑e) f)) x✝ = ↑f x✝ [PROOFSTEP] simp [(· ∘ ·)] [GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹² : Semiring R inst✝¹¹ : AddCommMonoid M inst✝¹⁰ : Module R M inst✝⁹ : TopologicalSpace M inst✝⁸ : AddCommMonoid M' inst✝⁷ : Module R M' inst✝⁶ : TopologicalSpace M' inst✝⁵ : AddCommMonoid N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : AddCommMonoid N' inst✝¹ : Module R N' inst✝ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N e : N ≃L[R] N' f : M[Λ^ι]→L[R]N' ⊢ ContinuousLinearMap.compContinuousAlternatingMap (↑e) (ContinuousLinearMap.compContinuousAlternatingMap (↑(ContinuousLinearEquiv.symm e)) f) = f [PROOFSTEP] ext [GOAL] case H R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹² : Semiring R inst✝¹¹ : AddCommMonoid M inst✝¹⁰ : Module R M inst✝⁹ : TopologicalSpace M inst✝⁸ : AddCommMonoid M' inst✝⁷ : Module R M' inst✝⁶ : TopologicalSpace M' inst✝⁵ : AddCommMonoid N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : AddCommMonoid N' inst✝¹ : Module R N' inst✝ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N e : N ≃L[R] N' f : M[Λ^ι]→L[R]N' x✝ : ι → M ⊢ ↑(ContinuousLinearMap.compContinuousAlternatingMap (↑e) (ContinuousLinearMap.compContinuousAlternatingMap (↑(ContinuousLinearEquiv.symm e)) f)) x✝ = ↑f x✝ [PROOFSTEP] simp [(· ∘ ·)] [GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N✝ : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁵ : Semiring R inst✝¹⁴ : AddCommMonoid M inst✝¹³ : Module R M inst✝¹² : TopologicalSpace M inst✝¹¹ : AddCommMonoid M' inst✝¹⁰ : Module R M' inst✝⁹ : TopologicalSpace M' inst✝⁸ : AddCommMonoid N✝ inst✝⁷ : Module R N✝ inst✝⁶ : TopologicalSpace N✝ inst✝⁵ : AddCommMonoid N' inst✝⁴ : Module R N' inst✝³ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N✝ ι' : Type u_7 N : ι' → Type u_8 inst✝² : (i : ι') → AddCommMonoid (N i) inst✝¹ : (i : ι') → TopologicalSpace (N i) inst✝ : (i : ι') → Module R (N i) f : (i : ι') → M[Λ^ι]→L[R]N i ⊢ (fun f i => ContinuousLinearMap.compContinuousAlternatingMap (ContinuousLinearMap.proj i) f) (pi f) = f [PROOFSTEP] ext [GOAL] case h.H R : Type u_1 M : Type u_2 M' : Type u_3 N✝ : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁵ : Semiring R inst✝¹⁴ : AddCommMonoid M inst✝¹³ : Module R M inst✝¹² : TopologicalSpace M inst✝¹¹ : AddCommMonoid M' inst✝¹⁰ : Module R M' inst✝⁹ : TopologicalSpace M' inst✝⁸ : AddCommMonoid N✝ inst✝⁷ : Module R N✝ inst✝⁶ : TopologicalSpace N✝ inst✝⁵ : AddCommMonoid N' inst✝⁴ : Module R N' inst✝³ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N✝ ι' : Type u_7 N : ι' → Type u_8 inst✝² : (i : ι') → AddCommMonoid (N i) inst✝¹ : (i : ι') → TopologicalSpace (N i) inst✝ : (i : ι') → Module R (N i) f : (i : ι') → M[Λ^ι]→L[R]N i x✝¹ : ι' x✝ : ι → M ⊢ ↑((fun f i => ContinuousLinearMap.compContinuousAlternatingMap (ContinuousLinearMap.proj i) f) (pi f) x✝¹) x✝ = ↑(f x✝¹) x✝ [PROOFSTEP] rfl [GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N✝ : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁵ : Semiring R inst✝¹⁴ : AddCommMonoid M inst✝¹³ : Module R M inst✝¹² : TopologicalSpace M inst✝¹¹ : AddCommMonoid M' inst✝¹⁰ : Module R M' inst✝⁹ : TopologicalSpace M' inst✝⁸ : AddCommMonoid N✝ inst✝⁷ : Module R N✝ inst✝⁶ : TopologicalSpace N✝ inst✝⁵ : AddCommMonoid N' inst✝⁴ : Module R N' inst✝³ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N✝ ι' : Type u_7 N : ι' → Type u_8 inst✝² : (i : ι') → AddCommMonoid (N i) inst✝¹ : (i : ι') → TopologicalSpace (N i) inst✝ : (i : ι') → Module R (N i) f : M[Λ^ι]→L[R]((i : ι') → N i) ⊢ pi ((fun f i => ContinuousLinearMap.compContinuousAlternatingMap (ContinuousLinearMap.proj i) f) f) = f [PROOFSTEP] ext [GOAL] case H.h R : Type u_1 M : Type u_2 M' : Type u_3 N✝ : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁵ : Semiring R inst✝¹⁴ : AddCommMonoid M inst✝¹³ : Module R M inst✝¹² : TopologicalSpace M inst✝¹¹ : AddCommMonoid M' inst✝¹⁰ : Module R M' inst✝⁹ : TopologicalSpace M' inst✝⁸ : AddCommMonoid N✝ inst✝⁷ : Module R N✝ inst✝⁶ : TopologicalSpace N✝ inst✝⁵ : AddCommMonoid N' inst✝⁴ : Module R N' inst✝³ : TopologicalSpace N' n : ℕ f✝ g : M[Λ^ι]→L[R]N✝ ι' : Type u_7 N : ι' → Type u_8 inst✝² : (i : ι') → AddCommMonoid (N i) inst✝¹ : (i : ι') → TopologicalSpace (N i) inst✝ : (i : ι') → Module R (N i) f : M[Λ^ι]→L[R]((i : ι') → N i) x✝¹ : ι → M x✝ : ι' ⊢ ↑(pi ((fun f i => ContinuousLinearMap.compContinuousAlternatingMap (ContinuousLinearMap.proj i) f) f)) x✝¹ x✝ = ↑f x✝¹ x✝ [PROOFSTEP] rfl [GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁶ : CommSemiring R inst✝¹⁵ : AddCommMonoid M inst✝¹⁴ : Module R M inst✝¹³ : TopologicalSpace M inst✝¹² : AddCommMonoid M' inst✝¹¹ : Module R M' inst✝¹⁰ : TopologicalSpace M' inst✝⁹ : AddCommMonoid N inst✝⁸ : Module R N inst✝⁷ : TopologicalSpace N inst✝⁶ : ContinuousAdd N inst✝⁵ : ContinuousConstSMul R N inst✝⁴ : AddCommMonoid N' inst✝³ : Module R N' inst✝² : TopologicalSpace N' inst✝¹ : ContinuousAdd N' inst✝ : ContinuousConstSMul R N' f : M →L[R] M' g g' : M'[Λ^ι]→L[R]N ⊢ (fun g => compContinuousLinearMap g f) (g + g') = (fun g => compContinuousLinearMap g f) g + (fun g => compContinuousLinearMap g f) g' [PROOFSTEP] ext [GOAL] case H R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁶ : CommSemiring R inst✝¹⁵ : AddCommMonoid M inst✝¹⁴ : Module R M inst✝¹³ : TopologicalSpace M inst✝¹² : AddCommMonoid M' inst✝¹¹ : Module R M' inst✝¹⁰ : TopologicalSpace M' inst✝⁹ : AddCommMonoid N inst✝⁸ : Module R N inst✝⁷ : TopologicalSpace N inst✝⁶ : ContinuousAdd N inst✝⁵ : ContinuousConstSMul R N inst✝⁴ : AddCommMonoid N' inst✝³ : Module R N' inst✝² : TopologicalSpace N' inst✝¹ : ContinuousAdd N' inst✝ : ContinuousConstSMul R N' f : M →L[R] M' g g' : M'[Λ^ι]→L[R]N x✝ : ι → M ⊢ ↑((fun g => compContinuousLinearMap g f) (g + g')) x✝ = ↑((fun g => compContinuousLinearMap g f) g + (fun g => compContinuousLinearMap g f) g') x✝ [PROOFSTEP] simp [GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁶ : CommSemiring R inst✝¹⁵ : AddCommMonoid M inst✝¹⁴ : Module R M inst✝¹³ : TopologicalSpace M inst✝¹² : AddCommMonoid M' inst✝¹¹ : Module R M' inst✝¹⁰ : TopologicalSpace M' inst✝⁹ : AddCommMonoid N inst✝⁸ : Module R N inst✝⁷ : TopologicalSpace N inst✝⁶ : ContinuousAdd N inst✝⁵ : ContinuousConstSMul R N inst✝⁴ : AddCommMonoid N' inst✝³ : Module R N' inst✝² : TopologicalSpace N' inst✝¹ : ContinuousAdd N' inst✝ : ContinuousConstSMul R N' f : M →L[R] M' c : R g : M'[Λ^ι]→L[R]N ⊢ AddHom.toFun { toFun := fun g => compContinuousLinearMap g f, map_add' := (_ : ∀ (g g' : M'[Λ^ι]→L[R]N), (fun g => compContinuousLinearMap g f) (g + g') = (fun g => compContinuousLinearMap g f) g + (fun g => compContinuousLinearMap g f) g') } (c • g) = ↑(RingHom.id R) c • AddHom.toFun { toFun := fun g => compContinuousLinearMap g f, map_add' := (_ : ∀ (g g' : M'[Λ^ι]→L[R]N), (fun g => compContinuousLinearMap g f) (g + g') = (fun g => compContinuousLinearMap g f) g + (fun g => compContinuousLinearMap g f) g') } g [PROOFSTEP] ext [GOAL] case H R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁶ : CommSemiring R inst✝¹⁵ : AddCommMonoid M inst✝¹⁴ : Module R M inst✝¹³ : TopologicalSpace M inst✝¹² : AddCommMonoid M' inst✝¹¹ : Module R M' inst✝¹⁰ : TopologicalSpace M' inst✝⁹ : AddCommMonoid N inst✝⁸ : Module R N inst✝⁷ : TopologicalSpace N inst✝⁶ : ContinuousAdd N inst✝⁵ : ContinuousConstSMul R N inst✝⁴ : AddCommMonoid N' inst✝³ : Module R N' inst✝² : TopologicalSpace N' inst✝¹ : ContinuousAdd N' inst✝ : ContinuousConstSMul R N' f : M →L[R] M' c : R g : M'[Λ^ι]→L[R]N x✝ : ι → M ⊢ ↑(AddHom.toFun { toFun := fun g => compContinuousLinearMap g f, map_add' := (_ : ∀ (g g' : M'[Λ^ι]→L[R]N), (fun g => compContinuousLinearMap g f) (g + g') = (fun g => compContinuousLinearMap g f) g + (fun g => compContinuousLinearMap g f) g') } (c • g)) x✝ = ↑(↑(RingHom.id R) c • AddHom.toFun { toFun := fun g => compContinuousLinearMap g f, map_add' := (_ : ∀ (g g' : M'[Λ^ι]→L[R]N), (fun g => compContinuousLinearMap g f) (g + g') = (fun g => compContinuousLinearMap g f) g + (fun g => compContinuousLinearMap g f) g') } g) x✝ [PROOFSTEP] simp [GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁶ : CommSemiring R inst✝¹⁵ : AddCommMonoid M inst✝¹⁴ : Module R M inst✝¹³ : TopologicalSpace M inst✝¹² : AddCommMonoid M' inst✝¹¹ : Module R M' inst✝¹⁰ : TopologicalSpace M' inst✝⁹ : AddCommMonoid N inst✝⁸ : Module R N inst✝⁷ : TopologicalSpace N inst✝⁶ : ContinuousAdd N inst✝⁵ : ContinuousConstSMul R N inst✝⁴ : AddCommMonoid N' inst✝³ : Module R N' inst✝² : TopologicalSpace N' inst✝¹ : ContinuousAdd N' inst✝ : ContinuousConstSMul R N' f : N →L[R] N' g₁ g₂ : M[Λ^ι]→L[R]N ⊢ ContinuousLinearMap.compContinuousAlternatingMap f (g₁ + g₂) = ContinuousLinearMap.compContinuousAlternatingMap f g₁ + ContinuousLinearMap.compContinuousAlternatingMap f g₂ [PROOFSTEP] ext1 [GOAL] case H R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁶ : CommSemiring R inst✝¹⁵ : AddCommMonoid M inst✝¹⁴ : Module R M inst✝¹³ : TopologicalSpace M inst✝¹² : AddCommMonoid M' inst✝¹¹ : Module R M' inst✝¹⁰ : TopologicalSpace M' inst✝⁹ : AddCommMonoid N inst✝⁸ : Module R N inst✝⁷ : TopologicalSpace N inst✝⁶ : ContinuousAdd N inst✝⁵ : ContinuousConstSMul R N inst✝⁴ : AddCommMonoid N' inst✝³ : Module R N' inst✝² : TopologicalSpace N' inst✝¹ : ContinuousAdd N' inst✝ : ContinuousConstSMul R N' f : N →L[R] N' g₁ g₂ : M[Λ^ι]→L[R]N x✝ : ι → M ⊢ ↑(ContinuousLinearMap.compContinuousAlternatingMap f (g₁ + g₂)) x✝ = ↑(ContinuousLinearMap.compContinuousAlternatingMap f g₁ + ContinuousLinearMap.compContinuousAlternatingMap f g₂) x✝ [PROOFSTEP] apply f.map_add [GOAL] R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁶ : CommSemiring R inst✝¹⁵ : AddCommMonoid M inst✝¹⁴ : Module R M inst✝¹³ : TopologicalSpace M inst✝¹² : AddCommMonoid M' inst✝¹¹ : Module R M' inst✝¹⁰ : TopologicalSpace M' inst✝⁹ : AddCommMonoid N inst✝⁸ : Module R N inst✝⁷ : TopologicalSpace N inst✝⁶ : ContinuousAdd N inst✝⁵ : ContinuousConstSMul R N inst✝⁴ : AddCommMonoid N' inst✝³ : Module R N' inst✝² : TopologicalSpace N' inst✝¹ : ContinuousAdd N' inst✝ : ContinuousConstSMul R N' c : R f : N →L[R] N' g : M[Λ^ι]→L[R]N ⊢ ContinuousLinearMap.compContinuousAlternatingMap f (c • g) = c • ContinuousLinearMap.compContinuousAlternatingMap f g [PROOFSTEP] ext1 [GOAL] case H R : Type u_1 M : Type u_2 M' : Type u_3 N : Type u_4 N' : Type u_5 ι : Type u_6 inst✝¹⁶ : CommSemiring R inst✝¹⁵ : AddCommMonoid M inst✝¹⁴ : Module R M inst✝¹³ : TopologicalSpace M inst✝¹² : AddCommMonoid M' inst✝¹¹ : Module R M' inst✝¹⁰ : TopologicalSpace M' inst✝⁹ : AddCommMonoid N inst✝⁸ : Module R N inst✝⁷ : TopologicalSpace N inst✝⁶ : ContinuousAdd N inst✝⁵ : ContinuousConstSMul R N inst✝⁴ : AddCommMonoid N' inst✝³ : Module R N' inst✝² : TopologicalSpace N' inst✝¹ : ContinuousAdd N' inst✝ : ContinuousConstSMul R N' c : R f : N →L[R] N' g : M[Λ^ι]→L[R]N x✝ : ι → M ⊢ ↑(ContinuousLinearMap.compContinuousAlternatingMap f (c • g)) x✝ = ↑(c • ContinuousLinearMap.compContinuousAlternatingMap f g) x✝ [PROOFSTEP] simp [GOAL] R : Type u_1 M : Type u_2 N : Type u_3 ι : Type u_4 inst✝⁹ : Semiring R inst✝⁸ : AddCommMonoid M inst✝⁷ : Module R M inst✝⁶ : TopologicalSpace M inst✝⁵ : AddCommGroup N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : TopologicalAddGroup N inst✝¹ : Fintype ι inst✝ : DecidableEq ι f✝ g f : ContinuousMultilinearMap R (fun x => M) N v : ι → M i j : ι hv : v i = v j hne : i ≠ j ⊢ MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0 [PROOFSTEP] simpa [MultilinearMap.alternatization_apply] using f.1.alternatization.map_eq_zero_of_eq' v i j hv hne [GOAL] R : Type u_1 M : Type u_2 N : Type u_3 ι : Type u_4 inst✝⁹ : Semiring R inst✝⁸ : AddCommMonoid M inst✝⁷ : Module R M inst✝⁶ : TopologicalSpace M inst✝⁵ : AddCommGroup N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : TopologicalAddGroup N inst✝¹ : Fintype ι inst✝ : DecidableEq ι f g : ContinuousMultilinearMap R (fun x => M) N ⊢ (fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }) 0 = 0 [PROOFSTEP] ext [GOAL] case H R : Type u_1 M : Type u_2 N : Type u_3 ι : Type u_4 inst✝⁹ : Semiring R inst✝⁸ : AddCommMonoid M inst✝⁷ : Module R M inst✝⁶ : TopologicalSpace M inst✝⁵ : AddCommGroup N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : TopologicalAddGroup N inst✝¹ : Fintype ι inst✝ : DecidableEq ι f g : ContinuousMultilinearMap R (fun x => M) N x✝ : ι → M ⊢ ↑((fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }) 0) x✝ = ↑0 x✝ [PROOFSTEP] simp [GOAL] R : Type u_1 M : Type u_2 N : Type u_3 ι : Type u_4 inst✝⁹ : Semiring R inst✝⁸ : AddCommMonoid M inst✝⁷ : Module R M inst✝⁶ : TopologicalSpace M inst✝⁵ : AddCommGroup N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : TopologicalAddGroup N inst✝¹ : Fintype ι inst✝ : DecidableEq ι f g x✝¹ x✝ : ContinuousMultilinearMap R (fun x => M) N ⊢ ZeroHom.toFun { toFun := fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }, map_zero' := (_ : (fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }) 0 = 0) } (x✝¹ + x✝) = ZeroHom.toFun { toFun := fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }, map_zero' := (_ : (fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }) 0 = 0) } x✝¹ + ZeroHom.toFun { toFun := fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }, map_zero' := (_ : (fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }) 0 = 0) } x✝ [PROOFSTEP] ext [GOAL] case H R : Type u_1 M : Type u_2 N : Type u_3 ι : Type u_4 inst✝⁹ : Semiring R inst✝⁸ : AddCommMonoid M inst✝⁷ : Module R M inst✝⁶ : TopologicalSpace M inst✝⁵ : AddCommGroup N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : TopologicalAddGroup N inst✝¹ : Fintype ι inst✝ : DecidableEq ι f g x✝² x✝¹ : ContinuousMultilinearMap R (fun x => M) N x✝ : ι → M ⊢ ↑(ZeroHom.toFun { toFun := fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }, map_zero' := (_ : (fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }) 0 = 0) } (x✝² + x✝¹)) x✝ = ↑(ZeroHom.toFun { toFun := fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }, map_zero' := (_ : (fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }) 0 = 0) } x✝² + ZeroHom.toFun { toFun := fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }, map_zero' := (_ : (fun f => { toContinuousMultilinearMap := ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f, map_eq_zero_of_eq' := (_ : ∀ (v : ι → M) (i j : ι), v i = v j → i ≠ j → MultilinearMap.toFun (∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • domDomCongr σ f).toMultilinearMap v = 0) }) 0 = 0) } x✝¹) x✝ [PROOFSTEP] simp [Finset.sum_add_distrib] [GOAL] R : Type u_1 M : Type u_2 N : Type u_3 ι : Type u_4 inst✝⁹ : Semiring R inst✝⁸ : AddCommMonoid M inst✝⁷ : Module R M inst✝⁶ : TopologicalSpace M inst✝⁵ : AddCommGroup N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : TopologicalAddGroup N inst✝¹ : Fintype ι inst✝ : DecidableEq ι f g : ContinuousMultilinearMap R (fun x => M) N v : ι → M ⊢ ↑(↑alternatization f) v = ∑ σ : Equiv.Perm ι, ↑Equiv.Perm.sign σ • ↑f (v ∘ ↑σ) [PROOFSTEP] simp [alternatization, (· ∘ ·)] [GOAL] R : Type u_1 M : Type u_2 N : Type u_3 ι : Type u_4 inst✝⁹ : Semiring R inst✝⁸ : AddCommMonoid M inst✝⁷ : Module R M inst✝⁶ : TopologicalSpace M inst✝⁵ : AddCommGroup N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : TopologicalAddGroup N inst✝¹ : Fintype ι inst✝ : DecidableEq ι f g : ContinuousMultilinearMap R (fun x => M) N ⊢ ContinuousAlternatingMap.toAlternatingMap (↑alternatization f) = ↑MultilinearMap.alternatization f.toMultilinearMap [PROOFSTEP] ext v [GOAL] case H R : Type u_1 M : Type u_2 N : Type u_3 ι : Type u_4 inst✝⁹ : Semiring R inst✝⁸ : AddCommMonoid M inst✝⁷ : Module R M inst✝⁶ : TopologicalSpace M inst✝⁵ : AddCommGroup N inst✝⁴ : Module R N inst✝³ : TopologicalSpace N inst✝² : TopologicalAddGroup N inst✝¹ : Fintype ι inst✝ : DecidableEq ι f g : ContinuousMultilinearMap R (fun x => M) N v : ι → M ⊢ ↑(ContinuousAlternatingMap.toAlternatingMap (↑alternatization f)) v = ↑(↑MultilinearMap.alternatization f.toMultilinearMap) v [PROOFSTEP] simp [alternatization_apply_apply, MultilinearMap.alternatization_apply, (· ∘ ·)]
/*************************************************************************** * Copyright 1998-2018 by authors (see AUTHORS.txt) * * * * This file is part of LuxCoreRender. * * * * 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. * ***************************************************************************/ #include <boost/lexical_cast.hpp> #include "luxrays/core/geometry/frame.h" #include "slg/materials/material.h" #include "slg/bsdf/bsdf.h" using namespace std; using namespace luxrays; using namespace slg; //------------------------------------------------------------------------------ // Material //------------------------------------------------------------------------------ Material::Material(const Texture *transp, const Texture *emitted, const Texture *bump) : NamedObject("material"), matID(0), lightID(0), directLightSamplingType(DLS_AUTO), samples(-1), emittedSamples(-1), emittedImportance(1.f), emittedGain(1.f), emittedPower(0.f), emittedEfficency(0.f), transparencyTex(transp), emittedTex(emitted), bumpTex(bump), bumpSampleDistance(.001f), emissionMap(NULL), emissionFunc(NULL), interiorVolume(NULL), exteriorVolume(NULL), isVisibleIndirectDiffuse(true), isVisibleIndirectGlossy(true), isVisibleIndirectSpecular(true), isShadowCatcher(false), isShadowCatcherOnlyInfiniteLights(false) { UpdateEmittedFactor(); SetEmittedTheta(90.f); } Material::~Material() { delete emissionFunc; } void Material::SetEmittedTheta(const float v) { emittedTheta = v; if (emittedTheta == 0.f) emittedCosThetaMax = 1.f - MachineEpsilon::E(1.f); else { const float radTheta = Radians(emittedTheta); emittedCosThetaMax = cosf(radTheta); } } void Material::SetEmissionMap(const ImageMap *map) { emissionMap = map; delete emissionFunc; if (emissionMap) emissionFunc = new SampleableSphericalFunction(new ImageMapSphericalFunction(emissionMap)); else emissionFunc = NULL; } Spectrum Material::GetPassThroughTransparency(const HitPoint &hitPoint, const luxrays::Vector &localFixedDir, const float passThroughEvent) const { if (transparencyTex) { const float weight = Clamp(transparencyTex->GetFloatValue(hitPoint), 0.f, 1.f); return (passThroughEvent > weight) ? Spectrum(1.f) : Spectrum(0.f); } else return Spectrum(0.f); } Spectrum Material::GetEmittedRadiance(const HitPoint &hitPoint, const float oneOverPrimitiveArea) const { if (emittedTex) { return (emittedFactor * (usePrimitiveArea ? oneOverPrimitiveArea : 1.f)) * emittedTex->GetSpectrumValue(hitPoint); } else return Spectrum(); } float Material::GetEmittedRadianceY() const { if (emittedTex) return emittedFactor.Y() * emittedTex->Y(); else return 0.f; } void Material::Bump(HitPoint *hitPoint) const { if (bumpTex) { hitPoint->shadeN = bumpTex->Bump(*hitPoint, bumpSampleDistance); // Update dpdu and dpdv so they are still orthogonal to shadeN hitPoint->dpdu = Cross(hitPoint->shadeN, Cross(hitPoint->dpdu, hitPoint->shadeN)); hitPoint->dpdv = Cross(hitPoint->shadeN, Cross(hitPoint->dpdv, hitPoint->shadeN)); } } Properties Material::ToProperties(const ImageMapCache &imgMapCache, const bool useRealFileName) const { luxrays::Properties props; const string name = GetName(); if (transparencyTex) props.Set(Property("scene.materials." + name + ".transparency")(transparencyTex->GetName())); props.Set(Property("scene.materials." + name + ".id")(matID)); props.Set(Property("scene.materials." + name + ".emission.gain")(emittedGain)); props.Set(Property("scene.materials." + name + ".emission.power")(emittedPower)); props.Set(Property("scene.materials." + name + ".emission.efficency")(emittedEfficency)); props.Set(Property("scene.materials." + name + ".emission.theta")(emittedTheta)); props.Set(Property("scene.materials." + name + ".emission.samples")(emittedSamples)); props.Set(Property("scene.materials." + name + ".emission.id")(lightID)); if (emittedTex) props.Set(Property("scene.materials." + name + ".emission")(emittedTex->GetName())); if (emissionMap) { const string fileName = useRealFileName ? emissionMap->GetName() : imgMapCache.GetSequenceFileName(emissionMap); props.Set(Property("scene.materials." + name + ".emission.mapfile")(fileName)); props.Set(emissionMap->ToProperties("scene.materials." + name, false)); } if (bumpTex) props.Set(Property("scene.materials." + name + ".bumptex")(bumpTex->GetName())); if (interiorVolume) props.Set(Property("scene.materials." + name + ".volume.interior")(interiorVolume->GetName())); if (exteriorVolume) props.Set(Property("scene.materials." + name + ".volume.exterior")(exteriorVolume->GetName())); props.Set(Property("scene.materials." + name + ".visibility.indirect.diffuse.enable")(isVisibleIndirectDiffuse)); props.Set(Property("scene.materials." + name + ".visibility.indirect.glossy.enable")(isVisibleIndirectGlossy)); props.Set(Property("scene.materials." + name + ".visibility.indirect.specular.enable")(isVisibleIndirectSpecular)); props.Set(Property("scene.materials." + name + ".shadowcatcher.enable")(isShadowCatcher)); props.Set(Property("scene.materials." + name + ".shadowcatcher.onlyinfinitelights")(isShadowCatcherOnlyInfiniteLights)); return props; } void Material::UpdateEmittedFactor() { if (emittedTex) { emittedFactor = emittedGain * (emittedPower * emittedEfficency / (M_PI * emittedTex->Y())); if (emittedFactor.Black() || emittedFactor.IsInf() || emittedFactor.IsNaN()) { emittedFactor = emittedGain; usePrimitiveArea = false; } else usePrimitiveArea = true; } else { emittedFactor = emittedGain; usePrimitiveArea = false; } } void Material::UpdateMaterialReferences(const Material *oldMat, const Material *newMat) { if (oldMat == interiorVolume) interiorVolume = (const Volume *)newMat; if (oldMat == exteriorVolume) exteriorVolume = (const Volume *)newMat; } void Material::AddReferencedMaterials(boost::unordered_set<const Material *> &referencedMats) const { referencedMats.insert(this); if (interiorVolume) referencedMats.insert((const Material *)interiorVolume); if (exteriorVolume) referencedMats.insert((const Material *)exteriorVolume); } void Material::AddReferencedTextures(boost::unordered_set<const Texture *> &referencedTexs) const { if (transparencyTex) transparencyTex->AddReferencedTextures(referencedTexs); if (emittedTex) emittedTex->AddReferencedTextures(referencedTexs); if (bumpTex) bumpTex->AddReferencedTextures(referencedTexs); } void Material::AddReferencedImageMaps(boost::unordered_set<const ImageMap *> &referencedImgMaps) const { if (emissionMap) referencedImgMaps.insert(emissionMap); } // Update any reference to oldTex with newTex void Material::UpdateTextureReferences(const Texture *oldTex, const Texture *newTex) { if (transparencyTex == oldTex) transparencyTex = newTex; if (emittedTex == oldTex) emittedTex = newTex; if (bumpTex == oldTex) bumpTex = newTex; } string Material::MaterialType2String(const MaterialType type) { switch (type) { case MATTE: return "MATTE"; case MIRROR: return "MIRROR"; case GLASS: return "GLASS"; case ARCHGLASS: return "ARCHGLASS"; case MIX: return "MIX"; case NULLMAT: return "NULLMAT"; case MATTETRANSLUCENT: return "MATTETRANSLUCENT"; case GLOSSY2: return "GLOSSY2"; case METAL2: return "METAL2"; case ROUGHGLASS: return "ROUGHGLASS"; case VELVET: return "VELVET"; case CLOTH: return "CLOTH"; case CARPAINT: return "CARPAINT"; case ROUGHMATTE: return "ROUGHMATTE"; case ROUGHMATTETRANSLUCENT: return "ROUGHMATTETRANSLUCENT"; case GLOSSYTRANSLUCENT: return "GLOSSYTRANSLUCENT"; case GLOSSYCOATING: return "GLOSSYCOATING"; // Volumes case HOMOGENEOUS_VOL: return "HOMOGENEOUS_VOL"; case CLEAR_VOL: return "CLEAR_VOL"; case HETEROGENEOUS_VOL: return "HETEROGENEOUS_VOL"; // The following types are used (in PATHOCL CompiledScene class) only to // recognize the usage of some specific material option case GLOSSY2_ANISOTROPIC: return "GLOSSY2_ANISOTROPIC"; case GLOSSY2_ABSORPTION: return "GLOSSY2_ABSORPTION"; case GLOSSY2_INDEX: return "GLOSSY2_INDEX"; case GLOSSY2_MULTIBOUNCE: return "GLOSSY2_MULTIBOUNCE"; case GLOSSYTRANSLUCENT_ANISOTROPIC: return "GLOSSYTRANSLUCENT_ANISOTROPIC"; case GLOSSYTRANSLUCENT_ABSORPTION: return "GLOSSYTRANSLUCENT_ABSORPTION"; case GLOSSYTRANSLUCENT_INDEX: return "GLOSSYTRANSLUCENT_INDEX"; case GLOSSYTRANSLUCENT_MULTIBOUNCE: return "GLOSSYTRANSLUCENT_MULTIBOUNCE"; case GLOSSYCOATING_ANISOTROPIC: return "GLOSSYCOATING_ANISOTROPIC"; case GLOSSYCOATING_ABSORPTION: return "GLOSSYCOATING_ABSORPTION"; case GLOSSYCOATING_INDEX: return "GLOSSYCOATING_INDEX"; case GLOSSYCOATING_MULTIBOUNCE: return "GLOSSYCOATING_MULTIBOUNCE"; case METAL2_ANISOTROPIC: return "METAL2_ANISOTROPIC"; case ROUGHGLASS_ANISOTROPIC: return "ROUGHGLASS_ANISOTROPIC"; default: throw runtime_error("Unknown material type in Material::MaterialType2String(): " + ToString(type)); } } //------------------------------------------------------------------------------ // IOR utilities //------------------------------------------------------------------------------ float slg::ExtractExteriorIors(const HitPoint &hitPoint, const Texture *exteriorIor) { float nc = 1.f; if (exteriorIor) nc = exteriorIor->GetFloatValue(hitPoint); else if (hitPoint.exteriorVolume) nc = hitPoint.exteriorVolume->GetIOR(hitPoint); return nc; } float slg::ExtractInteriorIors(const HitPoint &hitPoint, const Texture *interiorIor) { float nt = 1.f; if (interiorIor) nt = interiorIor->GetFloatValue(hitPoint); else if (hitPoint.interiorVolume) nt = hitPoint.interiorVolume->GetIOR(hitPoint); return nt; } //------------------------------------------------------------------------------ // Coating absorption //------------------------------------------------------------------------------ Spectrum slg::CoatingAbsorption(const float cosi, const float coso, const Spectrum &alpha, const float depth) { if (depth > 0.f) { // 1/cosi+1/coso=(cosi+coso)/(cosi*coso) const float depthFactor = depth * (cosi + coso) / (cosi * coso); return Exp(alpha * -depthFactor); } else return Spectrum(1.f); } //------------------------------------------------------------------------------ // SchlickDistribution //------------------------------------------------------------------------------ float slg::SchlickDistribution_SchlickZ(const float roughness, const float cosNH) { if (roughness > 0.f) { const float cosNH2 = cosNH * cosNH; // expanded for increased numerical stability const float d = cosNH2 * roughness + (1.f - cosNH2); // use double division to avoid overflow in d*d product return (roughness / d) / d; } return 0.f; } float slg::SchlickDistribution_SchlickA(const Vector &H, const float anisotropy) { const float h = sqrtf(H.x * H.x + H.y * H.y); if (h > 0.f) { const float w = (anisotropy > 0.f ? H.x : H.y) / h; const float p = 1.f - fabsf(anisotropy); return sqrtf(p / (p * p + w * w * (1.f - p * p))); } return 1.f; } float slg::SchlickDistribution_D(const float roughness, const Vector &wh, const float anisotropy) { const float cosTheta = fabsf(wh.z); return SchlickDistribution_SchlickZ(roughness, cosTheta) * SchlickDistribution_SchlickA(wh, anisotropy) * INV_PI; } float slg::SchlickDistribution_SchlickG(const float roughness, const float costheta) { return costheta / (costheta * (1.f - roughness) + roughness); } float slg::SchlickDistribution_G(const float roughness, const Vector &localFixedDir, const Vector &localSampledDir) { return SchlickDistribution_SchlickG(roughness, fabsf(localFixedDir.z)) * SchlickDistribution_SchlickG(roughness, fabsf(localSampledDir.z)); } static float GetPhi(const float a, const float b) { return M_PI * .5f * sqrtf(a * b / (1.f - a * (1.f - b))); } void slg::SchlickDistribution_SampleH(const float roughness, const float anisotropy, const float u0, const float u1, Vector *wh, float *d, float *pdf) { float u1x4 = u1 * 4.f; const float cos2Theta = u0 / (roughness * (1 - u0) + u0); const float cosTheta = sqrtf(cos2Theta); const float sinTheta = sqrtf(1.f - cos2Theta); const float p = 1.f - fabsf(anisotropy); float phi; if (u1x4 < 1.f) { phi = GetPhi(u1x4 * u1x4, p * p); } else if (u1x4 < 2.f) { u1x4 = 2.f - u1x4; phi = M_PI - GetPhi(u1x4 * u1x4, p * p); } else if (u1x4 < 3.f) { u1x4 -= 2.f; phi = M_PI + GetPhi(u1x4 * u1x4, p * p); } else { u1x4 = 4.f - u1x4; phi = M_PI * 2.f - GetPhi(u1x4 * u1x4, p * p); } if (anisotropy > 0.f) phi += M_PI * .5f; *wh = Vector(sinTheta * cosf(phi), sinTheta * sinf(phi), cosTheta); *d = SchlickDistribution_SchlickZ(roughness, cosTheta) * SchlickDistribution_SchlickA(*wh, anisotropy) * INV_PI; *pdf = *d; } float slg::SchlickDistribution_Pdf(const float roughness, const Vector &wh, const float anisotropy) { return SchlickDistribution_D(roughness, wh, anisotropy); } //------------------------------------------------------------------------------ // Schlick BSDF //------------------------------------------------------------------------------ float slg::SchlickBSDF_CoatingWeight(const Spectrum &ks, const Vector &localFixedDir) { // Approximate H by using reflection direction for wi const float u = fabsf(localFixedDir.z); const Spectrum S = FresnelTexture::SchlickEvaluate(ks, u); // Ensures coating is never sampled less than half the time return .5f * (1.f + S.Filter()); } Spectrum slg::SchlickBSDF_CoatingF(const bool fromLight, const Spectrum &ks, const float roughness, const float anisotropy, const bool mbounce, const Vector &localFixedDir, const Vector &localSampledDir) { const float coso = fabsf(localFixedDir.z); const float cosi = fabsf(localSampledDir.z); const Vector wh(Normalize(localFixedDir + localSampledDir)); const Spectrum S = FresnelTexture::SchlickEvaluate(ks, AbsDot(localSampledDir, wh)); const float G = SchlickDistribution_G(roughness, localFixedDir, localSampledDir); // Multibounce - alternative with interreflection in the coating creases float factor = SchlickDistribution_D(roughness, wh, anisotropy) * G; if (!fromLight) factor = factor / (4.f * coso) + (mbounce ? cosi * Clamp((1.f - G) / (4.f * coso * cosi), 0.f, 1.f) : 0.f); else factor = factor / (4.f * cosi) + (mbounce ? coso * Clamp((1.f - G) / (4.f * cosi * coso), 0.f, 1.f) : 0.f); return factor * S; } Spectrum slg::SchlickBSDF_CoatingSampleF(const bool fromLight, const Spectrum ks, const float roughness, const float anisotropy, const bool mbounce, const Vector &localFixedDir, Vector *localSampledDir, float u0, float u1, float *pdf) { Vector wh; float d, specPdf; SchlickDistribution_SampleH(roughness, anisotropy, u0, u1, &wh, &d, &specPdf); const float cosWH = Dot(localFixedDir, wh); *localSampledDir = 2.f * cosWH * wh - localFixedDir; if ((fabsf(localSampledDir->z) < DEFAULT_COS_EPSILON_STATIC) || (localFixedDir.z * localSampledDir->z < 0.f)) return Spectrum(); const float coso = fabsf(localFixedDir.z); const float cosi = fabsf(localSampledDir->z); *pdf = specPdf / (4.f * fabsf(cosWH)); if (*pdf <= 0.f) return Spectrum(); Spectrum S = FresnelTexture::SchlickEvaluate(ks, fabsf(cosWH)); const float G = SchlickDistribution_G(roughness, localFixedDir, *localSampledDir); if (!fromLight) //CoatingF(sw, *wi, wo, f_); S *= (d / *pdf) * G / (4.f * coso) + (mbounce ? cosi * Clamp((1.f - G) / (4.f * coso * cosi), 0.f, 1.f) / *pdf : 0.f); else //CoatingF(sw, wo, *wi, f_); S *= (d / *pdf) * G / (4.f * cosi) + (mbounce ? coso * Clamp((1.f - G) / (4.f * cosi * coso), 0.f, 1.f) / *pdf : 0.f); return S; } float slg::SchlickBSDF_CoatingPdf(const float roughness, const float anisotropy, const Vector &localFixedDir, const Vector &localSampledDir) { const Vector wh(Normalize(localFixedDir + localSampledDir)); return SchlickDistribution_Pdf(roughness, wh, anisotropy) / (4.f * AbsDot(localFixedDir, wh)); }
lemma measurable_restrict_space2: "f \<in> space M \<rightarrow> \<Omega> \<Longrightarrow> f \<in> measurable M N \<Longrightarrow> f \<in> measurable M (restrict_space N \<Omega>)"
State Before: C : Type ?u.50202 inst✝ : Category C P Q : Karoubi C f : P ⟶ Q ⊢ mk P.X (𝟙 P.X) ⟶ mk Q.X (𝟙 Q.X) State After: no goals Tactic: exact Hom.mk f.f (by simp) State Before: C : Type ?u.50202 inst✝ : Category C P Q : Karoubi C f : P ⟶ Q ⊢ f.f = (mk P.X (𝟙 P.X)).p ≫ f.f ≫ (mk Q.X (𝟙 Q.X)).p State After: no goals Tactic: simp State Before: C : Type u_1 inst✝ : Category C P Q : Karoubi C f : P ⟶ Q ⊢ f ≫ decompId_i Q = decompId_i P ≫ Hom.mk f.f State After: no goals Tactic: aesop_cat
#ifndef LINALG_H_GUARD #define LINALG_H_GUARD #include "coneOS.h" #include <cblas.h> #include <math.h> void setAsScaledArray(double *x, const double * a,const double b,int len); void scaleArray(double * a,const double b,int len); double innerProd(const double * x, const double * y, int len); double calcNorm(const double * v,int len); double calcNormInf(const double *a, int l); double calcNormSq(const double * v,int len); void addScaledArray(double * a, const double * b, int n, const double sc); double calcNormDiff(const double *a,const double *b, int l); double calcNormInfDiff(const double *a, const double *b, int l); void accumByAtrans(Data * d, const double *x, double *y); void accumByA(Data * d, const double *x, double *y); #endif
State Before: K : Type u V V₁ V₂ V₃ : Type v V' V'₁ : Type v' V'' : Type v'' ι : Type w ι' : Type w' η : Type u₁' φ : η → Type ?u.1021823 inst✝¹⁰ : DivisionRing K inst✝⁹ : AddCommGroup V inst✝⁸ : Module K V inst✝⁷ : AddCommGroup V' inst✝⁶ : Module K V' inst✝⁵ : AddCommGroup V₁ inst✝⁴ : Module K V₁ inst✝³ : AddCommGroup V₂ inst✝² : Module K V₂ inst✝¹ : AddCommGroup V₃ inst✝ : Module K V₃ s t : Submodule K V ⊢ Module.rank K { x // x ∈ s ⊔ t } ≤ Module.rank K { x // x ∈ s } + Module.rank K { x // x ∈ t } State After: K : Type u V V₁ V₂ V₃ : Type v V' V'₁ : Type v' V'' : Type v'' ι : Type w ι' : Type w' η : Type u₁' φ : η → Type ?u.1021823 inst✝¹⁰ : DivisionRing K inst✝⁹ : AddCommGroup V inst✝⁸ : Module K V inst✝⁷ : AddCommGroup V' inst✝⁶ : Module K V' inst✝⁵ : AddCommGroup V₁ inst✝⁴ : Module K V₁ inst✝³ : AddCommGroup V₂ inst✝² : Module K V₂ inst✝¹ : AddCommGroup V₃ inst✝ : Module K V₃ s t : Submodule K V ⊢ Module.rank K { x // x ∈ s ⊔ t } ≤ Module.rank K { x // x ∈ s ⊔ t } + Module.rank K { x // x ∈ s ⊓ t } Tactic: rw [← Submodule.rank_sup_add_rank_inf_eq] State Before: K : Type u V V₁ V₂ V₃ : Type v V' V'₁ : Type v' V'' : Type v'' ι : Type w ι' : Type w' η : Type u₁' φ : η → Type ?u.1021823 inst✝¹⁰ : DivisionRing K inst✝⁹ : AddCommGroup V inst✝⁸ : Module K V inst✝⁷ : AddCommGroup V' inst✝⁶ : Module K V' inst✝⁵ : AddCommGroup V₁ inst✝⁴ : Module K V₁ inst✝³ : AddCommGroup V₂ inst✝² : Module K V₂ inst✝¹ : AddCommGroup V₃ inst✝ : Module K V₃ s t : Submodule K V ⊢ Module.rank K { x // x ∈ s ⊔ t } ≤ Module.rank K { x // x ∈ s ⊔ t } + Module.rank K { x // x ∈ s ⊓ t } State After: no goals Tactic: exact self_le_add_right _ _
------------------------------------------------------------------------------ -- Well-founded induction on the relation TreeT ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOT.FOTC.Program.Mirror.TreeR.Induction.Acc.WellFoundedInduction where open import FOTC.Base open import FOT.FOTC.Program.Mirror.Induction.Acc.WellFounded open import FOT.FOTC.Program.Mirror.TreeR open import FOTC.Program.Mirror.Type ------------------------------------------------------------------------------ -- The relation TreeR is well-founded. postulate wf-TreeR : WellFounded TreeR -- Well-founded induction on the relation TreeT. wfInd-TreeR : (P : D → Set) → (∀ {t} → Tree t → (∀ {t'} → Tree t' → TreeR t' t → P t') → P t) → ∀ {t} → Tree t → P t wfInd-TreeR P = WellFoundedInduction wf-TreeR
(* Copyright 2016 Luxembourg University Copyright 2017 Luxembourg University Copyright 2018 Luxembourg University This file is part of Velisarios. Velisarios is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Velisarios 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 Velisarios. If not, see <http://www.gnu.org/licenses/>. Authors: Vincent Rahli Ivana Vukotic *) Require Export PBFTexecute4. Require Export PBFTsame_states. Section PBFTagreement. Local Open Scope eo. Local Open Scope proc. Context { pbft_context : PBFTcontext }. Context { pbft_auth : PBFTauth }. Context { pbft_keys : PBFTinitial_keys }. Context { pbft_hash : PBFThash }. Context { pbft_hash_axioms : PBFThash_axioms }. Lemma agreement : forall (eo : EventOrdering) (e1 e2 : Event) v1 v2 ts c j1 j2 r1 r2 a1 a2 i1 i2, authenticated_messages_were_sent_or_byz_usys eo PBFTsys -> PBFTcorrect_keys eo -> exists_at_most_f_faulty [e1,e2] F -> loc e1 = PBFTreplica i1 -> loc e2 = PBFTreplica i2 -> In (send_reply (mk_reply v1 ts c j1 r1 a1)) (output_system_on_event_ldata PBFTsys e1) -> In (send_reply (mk_reply v2 ts c j2 r2 a2)) (output_system_on_event_ldata PBFTsys e2) -> r1 = r2. Proof. introv sendbyz ckeys atmost eqloc1 eqloc2 out1 out2. applydup @output_system_on_event_ldata_implies_state_sm_on_event in out1 as h; [|introv; simpl in *; unfold PBFTsys, PBFTnstate; remember (loc e1); destruct n; ginv; eauto 3 with pbft; try apply replicas_never_stop]. revert h; unfold PBFTnstate; rewrite eqloc1; introv h; exrepnd. applydup @output_system_on_event_ldata_implies_state_sm_on_event in out2 as z; [|introv; simpl in *; unfold PBFTsys, PBFTnstate; remember (loc e2); destruct n; ginv; eauto 3 with pbft; try apply replicas_never_stop]. revert z; unfold PBFTnstate; rewrite eqloc2; introv z; exrepnd. pose proof (state_sm_before_event_some_between3 e1 e1 (PBFTreplicaSM i1) st) as q. repeat (autodimp q hyp); eauto 3 with eo; exrepnd. pose proof (state_sm_before_event_some_between3 e2 e2 (PBFTreplicaSM i2) st0) as w. repeat (autodimp w hyp); eauto 3 with eo; exrepnd. rename st into st1. rename st0 into st. rename s' into st2. rename s'0 into st0. eapply replies_from in out1; eauto. eapply replies_from in out2; eauto. exrepnd. subst. match goal with | [ H1 : committed_log _ _ = _, H2 : committed_log _ _ = _ |- _ ] => rename H1 into com1; rename H2 into com2; dup com1 as com end. match goal with | [ H1 : find_first_reply _ _ _ = _, H2 : find_first_reply _ _ _ = _ |- _ ] => rename H1 into ffr1; rename H2 into ffr2 end. match goal with | [ H1 : find_last_reply_entry_corresponding_to_client _ _ = _, H2 : find_last_reply_entry_corresponding_to_client _ _ = _, H3 : find_last_reply_entry_corresponding_to_client _ _ = _, H4 : find_last_reply_entry_corresponding_to_client _ _ = _ |- _ ] => rename H1 into fl1; rename H2 into fl2; rename H3 into fl3; rename H4 into fl4 end. match goal with | [ H1 : reply2requests _ _ _ _ _ _ = _, H2 : reply2requests _ _ _ _ _ _ = _ |- _ ] => rename H1 into r2rs1; rename H2 into r2rs2 end. match goal with | [ H1 : request2info _ = _, H2 : request2info _ = _ |- _ ] => rename H1 into r2i1; rename H2 into r2i2 end. destruct (SeqNumDeq (next_to_execute st0) (next_to_execute st2)) as [d|d]. { rewrite d in *. eapply PBFT_A_1_11_before in com; try exact com2; try (exact q0); try (exact w0); auto; eauto 3 with pbft eo;[]. apply eq_digests_implies_eq_requests in com; subst. rewrite ffr1 in ffr2; ginv. pose proof (next_to_execute_from_before eo e1 e2 j1 j2 st2 st0) as u. repeat (autodimp u hyp);[]. repnd. rewrite u0 in *. rewrite u in *. pose proof (same_states_if_same_next_to_execute eo e1 e2 j1 j2 st1 st) as v. repeat (autodimp v hyp); try (complete (allrw; tcsp));[]. repnd. try rewrite v0 in *. try rewrite v in *. eapply matching_reply2requests_implies in r2rs1; try (exact r2rs2). repnd; subst. rewrite fl1 in *; ginv. rewrite fl2 in *; ginv. rewrite r2i1 in *; ginv. smash_pbft. } assert (seqnum2nat (next_to_execute st0) <> seqnum2nat (next_to_execute st2)) as d'. { intro xx; destruct d. destruct (next_to_execute st0), (next_to_execute st2); simpl in *; tcsp. } apply not_eq in d'; repndors;[|]. { assert (next_to_execute st <= next_to_execute st2) as lenext by (allrw; simpl; omega). applydup next_to_execute_is_greater_than_one in z0; auto;[]. rewrite <- ite_first_state_sm_on_event_as_before in q0. unfold ite_first in *. destruct (dec_isFirst e1) as [d1|d1]; ginv; subst; simpl in *;[]. pose proof (last_reply_state_increases eo (local_pred e1) j1 st2 (next_to_execute st)) as u. repeat (autodimp u hyp); autorewrite with eo; auto; try omega; eauto 3 with pbft eo;[]. exrepnd. pose proof (same_states_if_same_next_to_execute eo e' e2 j j2 st' st) as v. repeat (autodimp v hyp); try (complete (allrw; auto)); eauto 4 with pbft eo;[]. repnd. rewrite v in u0. applydup u0 in fl4. exrepnd. match goal with | [ H : context[reply2requests j1] |- _ ] => rename H into rep2req end. applydup reply2requests_implies_last_reply_state_extends in rep2req as ext. applydup ext in fl0. exrepnd. rewrite fl8 in *; ginv. assert (ts <= lre_timestamp e4) as lets by omega. autodimp fl5 hyp;[apply eq_nats_implies_eq_timestamps; omega|]. autodimp fl9 hyp;[apply eq_nats_implies_eq_timestamps; omega|]. autodimp out0 hyp;[apply eq_nats_implies_eq_timestamps; omega|]. assert (lre_reply e4 = Some r1) as eqr1 by (pbft_dest_all x; try omega). assert (Some r1 = Some r2) as eqrs by congruence. ginv. } { assert (next_to_execute st1 <= next_to_execute st0) as lenext by (allrw; simpl; omega). applydup next_to_execute_is_greater_than_one in h0; auto;[]. rewrite <- ite_first_state_sm_on_event_as_before in w0. unfold ite_first in *. destruct (dec_isFirst e2) as [d1|d1]; ginv; subst; simpl in *;[]. pose proof (last_reply_state_increases eo (local_pred e2) j2 st0 (next_to_execute st1)) as u. repeat (autodimp u hyp); autorewrite with eo; auto; try omega; eauto 3 with pbft eo;[]. exrepnd. pose proof (same_states_if_same_next_to_execute eo e' e1 j j1 st' st1) as v. repeat (autodimp v hyp); try (complete (allrw; auto)); eauto 5 with pbft eo;[]. repnd. rewrite v in u0. applydup u0 in fl2. exrepnd. match goal with | [ H : context[reply2requests j2] |- _ ] => rename H into rep2req end. applydup reply2requests_implies_last_reply_state_extends in rep2req as ext. applydup ext in fl0. exrepnd. rewrite fl8 in *; ginv. assert (ts <= lre_timestamp e0) as lets by omega. autodimp fl5 hyp;[apply eq_nats_implies_eq_timestamps; omega|]. autodimp fl9 hyp;[apply eq_nats_implies_eq_timestamps; omega|]. autodimp out14 hyp;[apply eq_nats_implies_eq_timestamps; omega|]. assert (lre_reply e0 = Some r2) as eqr2 by (pbft_dest_all x; try omega). assert (Some r1 = Some r2) as eqrs by congruence. ginv. } Qed. (* Definition mk_reply (v : View) (t : Timestamp) (c : Client) (i : Rep) (r : PBFTresult) (a : Tokens) : Reply := reply (bare_reply v t c i r) a. Lemma sent_replies_are_committed : forall (eo : EventOrdering) (e : Event) p dst st i, loc e = PBFTreplica i -> In (send_reply v t c i r) (output_system_on_event_ldata PBFTsys eo e) -> state_sm_on_event (PBFTreplicaSM i) eo e = Some st -> prepare_in_log p (log st) = true -> exists n, committed_log (request_data ) (log e). Proof. Qed.*) (* Lemma in_check_send_replies_implies : forall i v ks (giop : option GeneratedInfo) (msgs : DirectedMsgs) (sn : SeqNum) (m : DirectedMsg) (st1 st2 : PBFTstate), check_send_replies i v ks giop st1 sn = (msgs, st2) -> In m msgs -> exists (prepop : option Prepare) (commop : option Commit) (entry : PBFTlogEntry), giop = Some (MkGeneratedInfo prepop commop entry) /\ is_committed_entry entry = true /\ m = send_check_ready check_ready (PBFTreplica i) /\ st2 = add_to_ready st1 sn. Proof. introv h j. unfold check_send_replies in h. destruct giop; simpl in *; tcsp. - destruct g. dest_cases x; ginv; simpl in *; tcsp. + inversion h; subst; clear h; simpl in *; repndors; subst; tcsp. eexists; eexists; eexists; dands; eauto. + inversion h; subst; clear h; simpl in *; tcsp. - inversion h; subst; simpl in *; tcsp. Qed. Lemma add_prepares_to_log_from_new_view_pre_prepares_returns_prep_comm_rep : forall (slf : Rep) (pps : list (Pre_prepare * PBFTdigest)) (st1 st2 : PBFTstate) (msgs : DirectedMsgs) (m : DirectedMsg), add_prepares_to_log_from_new_view_pre_prepares slf st1 pps = (st2, msgs) -> In m msgs -> (exists i p, m = MkDMsg i (PBFTprepare p)) \/ (exists i c, m = MkDMsg i (PBFTcommit c)) \/ (exists i r, m = MkDMsg i (PBFTcheck_ready r)). Proof. induction pps; introv e i; simpl in *; ginv. - inversion e; clear e; subst; simpl in *; tcsp. - dest_cases w; symmetry in Heqw. dest_cases x; symmetry in Heqx. inversion e; clear e; subst. apply in_app_iff in i; repndors. + unfold add_prepare_to_log_from_new_view_pre_prepare in Heqw. repnd; simpl in *. dest_cases y; symmetry in Heqy; simpl in *; tcsp;[|]. * dest_cases u; symmetry in Hequ; simpl in *; tcsp;[]. dest_cases v; symmetry in Heqv; simpl in *; tcsp;[]. inversion Heqw; subst; clear Heqw. apply in_app_iff in i; repndors. { unfold check_broadcast_prepare in i. dest_cases q; subst; simpl in *. destruct q; simpl in *. dest_cases p; symmetry in Heqp; simpl in *; tcsp;[|]. - inversion Heqv; subst; clear Heqv; simpl in *. dest_cases k; symmetry in Heqk; simpl in *; tcsp;[]. dest_cases r; subst; simpl in *;tcsp;[|]. + apply in_broadcast2others in i; exrepnd; subst; simpl in *. left. eexists; eexists; reflexivity. + apply in_broadcast2others in i; exrepnd; subst; simpl in *. left. eexists; eexists; reflexivity. - inversion Heqv; clear Heqv; subst; simpl in *. dest_cases k; symmetry in Heqk; simpl in *; tcsp. dest_cases r; symmetry in Heqr; simpl in *; tcsp;[|]. + apply in_broadcast2others in i; exrepnd; subst; simpl in *. left. eexists; eexists; reflexivity. + apply in_broadcast2others in i; exrepnd; subst; simpl in *. left. eexists; eexists; reflexivity. } { unfold check_broadcast_commit in i. dest_cases q; symmetry in Heqq; subst; simpl in *; tcsp;[|]. - destruct q; simpl in *. dest_cases k; symmetry in Heqk; simpl in *; tcsp;[|]. + inversion Heqv; clear Heqv; subst; simpl in *. apply in_app_iff in i; simpl in *; repndors; tcsp. * dest_cases r; symmetry in Heqr; simpl in *; tcsp;[]. dest_cases p; subst; simpl in *; tcsp;[|]. { apply in_broadcast2others in i; exrepnd; subst. right; left. eexists; eexists; reflexivity. } { apply in_broadcast2others in i; exrepnd; subst. right; left. eexists; eexists; reflexivity. } * subst; simpl in *. right; right. eexists; eexists; reflexivity. + inversion Heqv; clear Heqv; subst; simpl in *; tcsp. allrw app_nil_r. dest_cases q; symmetry in Heqq. dest_cases r; subst; simpl in *; tcsp;[|]. * apply in_broadcast2others in i; exrepnd; subst; simpl in *. right; left. eexists; eexists; reflexivity. * apply in_broadcast2others in i; exrepnd; subst; simpl in *. right; left. eexists; eexists; reflexivity. - inversion Heqv; clear Heqv; subst; simpl in *; tcsp. } * inversion Heqw; clear Heqw; subst; simpl in *. apply in_broadcast2others in i; exrepnd; subst. left. eexists; eexists; reflexivity. + eapply IHpps in Heqx;[|eauto]; auto. Qed. Lemma update_state_new_view_returns_checkpoint : forall (slf : Rep) (nv : NewView) (st1 st2 : PBFTstate) (msgs : DirectedMsgs) (m : DirectedMsg), update_state_new_view slf st1 nv = (st2, msgs) -> In m msgs -> (exists i c, m = MkDMsg i (PBFTcheckpoint c)). Proof. introv h i. unfold update_state_new_view in h. dest_cases w; symmetry in Heqw;[]. dest_cases y; symmetry in Heqy;[|]. - dest_cases z; subst; simpl in *;[|]. + dest_cases x; symmetry in Heqx. inversion h; subst; clear h. unfold broadcast_checkpoint_op in i. dest_cases q; subst; simpl in *. apply in_broadcast2others in i; exrepnd; subst; simpl in *. exists o q; auto. + inversion h; subst; clear h; simpl in *; tcsp. - inversion h; subst; clear h; simpl in *; tcsp. Qed. (* replies are sent on receipt of check_ready messages *) Lemma send_reply_iff : forall (eo : EventOrdering) (e : Event) v t c i r a, In (send_reply (mk_reply v t c i r a)) (output_system_on_event_ldata PBFTsys eo e) <-> ( exists (n : Rep) (cr : CheckReady) (st st' : PBFTstate) (sns : list SeqNum) (entry : PBFTlogEntry) (reps : list (option Reply)) (smst : PBFTsm_state) (lastr : LastReplyState) (msgs : DirectedMsgs), loc e = PBFTreplica n /\ trigger e = PBFTcheck_ready cr /\ state_sm_before_event (PBFTreplicaSM n) eo e = Some st /\ find_entry (log st) (next_to_execute st) = Some entry /\ reply2requests n (current_view st) (local_keys st) (log_entry2requests entry) (sm_state st) (last_reply_state st) = (reps, smst, lastr) /\ check_broadcast_checkpoint n (next_to_execute st) (current_view st) (local_keys st) (change_log_entry (change_last_reply_state (change_sm_state (increment_next_to_execute st) smst) lastr) (add_replies2entry entry reps)) = (st', msgs) /\ ready st = next_to_execute st :: sns /\ In (mk_reply v t c i r a) (list_option2list reps) ). Proof. introv. rewrite in_output_system_on_event_ldata. split; intro h. - unfold PBFTsys in h. remember (loc e) as n; destruct n; simpl in *; unfold MStateMachine in *; ginv; [|apply MhaltedSM_output in h; tcsp];[]. rw @loutput_sm_on_event_unroll2 in h; simpl in h. unfold PBFTreplica_update in h at 1; simpl in h. remember (trigger e) as trig; symmetry in Heqtrig. match goal with | [ H : context[option_map _ ?s] |- _ ] => remember s as sop; symmetry in Heqsop; destruct sop; simpl in *; tcsp end. destruct trig; simpl in *; tcsp. + unfold PBFThandle_request in h; simpl in h. dest_all w. repndors; tcsp; ginv. + unfold PBFThandle_pre_prepare in h; simpl in *. dest_all w;[]. apply in_app_iff in h; repndors;[|]. * unfold check_broadcast_prepare in h. dest_all x. destruct x; simpl in *. fold DirectedMsgs in *. dest_all x. * apply in_app_iff in h;repndors;[|]. { unfold check_broadcast_commit in h. dest_all x. destruct x; simpl in *. fold DirectedMsgs in *. dest_all x. } { match goal with | [ H : check_send_replies _ _ _ _ _ _ = _ |- _ ] => eapply in_check_send_replies_implies in H;[|exact h] end. exrepnd; subst; simpl in *; ginv. } + unfold PBFThandle_prepare in h; simpl in *. dest_cases x; symmetry in Heqx; simpl in *;[]. dest_cases y;[]. dest_cases y; symmetry in Heqy; simpl in *;[]. dest_cases z;[]. dest_cases z; symmetry in Heqz; simpl in *;[]. dest_cases w; symmetry in Heqw; simpl in *;[]. dest_cases u; symmetry in Hequ; simpl in *;[]. apply in_app_iff in h; repndors. { unfold check_broadcast_commit in h. destruct w0; simpl in *; tcsp;[]. destruct g; simpl in *; tcsp;[]. dest_cases d; symmetry in Heqd;[]. dest_cases q; symmetry in Heqq; ginv;[|]. { dest_cases t; simpl in *;[|]. - apply in_broadcast2others in h; exrepnd; ginv. - apply in_broadcast2others in h; exrepnd; ginv. } { dest_cases t; simpl in *;[|]. - apply in_broadcast2others in h; exrepnd; ginv. - apply in_broadcast2others in h; exrepnd; ginv. } } { eapply in_check_send_replies_implies in Hequ;[|exact h]. exrepnd; subst; simpl in *; ginv. } + unfold PBFThandle_commit in h; simpl in *. dest_cases x; symmetry in Heqx; simpl in *;[]. dest_cases y;[]. dest_cases y; symmetry in Heqy; simpl in *;[]. dest_cases z;[]. dest_cases z; symmetry in Heqz; simpl in *;[]. dest_cases w; symmetry in Heqw; simpl in *;[]. dest_cases u; symmetry in Hequ; simpl in *;[]. eapply in_check_send_replies_implies in Hequ;[|exact h]. exrepnd; subst; simpl in *; ginv. + unfold PBFThandle_checkpoint in h. dest_cases x;[]. dest_cases x; symmetry in Heqx; simpl in *;[]. dest_cases y; symmetry in Heqy; simpl in *;[]. dest_cases z; symmetry in Heqz; simpl in *;[]. dest_cases w; symmetry in Heqw; simpl in *;[]. dest_cases u; symmetry in Hequ; simpl in *;[]. repndors; tcsp; ginv. + unfold PBFThandle_check_ready in h; simpl in *. dest_cases x; symmetry in Heqx; simpl in *;[]. unfold find_and_execute_requests in Heqx. dest_cases w; symmetry in Heqw; repnd; ginv;[]. unfold execute_requests in Heqw. remember (ready p) as rd; symmetry in Heqrd. destruct rd; [inversion Heqw; subst; simpl in *; tcsp|];[]. dest_cases y; subst; simpl in *; tcsp;[|]; [|inversion Heqw; subst; simpl in *; tcsp];[]. dest_cases y; symmetry in Heqy; simpl in *; tcsp;[|]; [|inversion Heqw; subst; simpl in *; tcsp];[]. dest_cases u; symmetry in Hequ; repnd; simpl in *. dest_cases q; symmetry in Heqq. inversion Heqw; subst; clear Heqw; simpl in *. apply in_app_iff in h; simpl in *; repndors; ginv;[|]. { apply in_map_iff in h; exrepnd. inversion h1; clear h1. remember (reply2client x) as cl. subst; simpl in *; GC. exists n c0 p w1 w0 y u2 u0 u1 q1. dands; auto. } { unfold check_broadcast_checkpoint in Heqq; simpl in *. dest_cases w; symmetry in Heqw; simpl in *; tcsp;[|]. - dest_cases z; symmetry in Heqz; ginv. apply in_broadcast2others in h; exrepnd; ginv. - inversion Heqq; subst; simpl in *; tcsp. } + repndors; tcsp; ginv. + unfold PBFThandle_expired_timer in h. dest_cases x;[]. dest_cases x; symmetry in Heqx; simpl in *;[]. dest_cases y; symmetry in Heqy; simpl in *; tcsp;[|]. * repnd; simpl in *. apply in_broadcast2others in h; exrepnd; ginv. * apply in_broadcast2others in h; exrepnd; ginv. + unfold PBFThandle_view_change in h. dest_cases x; simpl in *;[]. dest_cases x; symmetry in Heqx; simpl in *;[]. dest_cases y; symmetry in Heqy; simpl in *;[]. dest_cases z; symmetry in Heqz; simpl in *;[]. dest_cases q; symmetry in Heqq; simpl in *;[]. repnd; simpl in *. dest_cases w; symmetry in Heqw; repnd; simpl in *;[]. apply in_broadcast2others in h; exrepnd; ginv. + unfold PBFThandle_new_view in h. dest_cases x;[]. dest_cases x; symmetry in Heqx; simpl in *;[]. dest_cases y; symmetry in Heqy; simpl in *;[]. dest_cases z; symmetry in Heqz; simpl in *;[]. dest_cases w; symmetry in Heqw; simpl in *;[]. dest_cases q; symmetry in Heqq; simpl in *;[]. dest_cases u; symmetry in Hequ; simpl in *;[]. dest_cases k; symmetry in Heqk; simpl in *;[]. apply in_app_iff in h; repndors. * eapply add_prepares_to_log_from_new_view_pre_prepares_returns_prep_comm_rep in Hequ;[|exact h]. repndors; exrepnd; ginv. * eapply update_state_new_view_returns_checkpoint in Heqk;[|eauto]. exrepnd; ginv. - exrepnd. unfold PBFTsys. allrw; simpl. rw @loutput_sm_on_event_unroll2; simpl. unfold PBFTreplica_update at 1; simpl. allrw. fold DirectedMsgs in *. match goal with | [ |- context[option_map _ ?s] ] => remember s as sop; symmetry in Heqsop; destruct sop; simpl in *; tcsp end;[]. ginv. unfold PBFThandle_check_ready. unfold find_and_execute_requests. unfold execute_requests. allrw; simpl. dest_cases w. allrw; simpl. apply in_app_iff; simpl. left. apply in_map_iff; eexists; dands;[reflexivity|]. auto. Qed. Definition hidden_check_broadcast_checkpoint (slf : Rep) (sn : SeqNum) (vn : View) (keys : local_key_map) (s : PBFTstate) (s' : PBFTstate) (msgs : DirectedMsgs) : Prop := check_broadcast_checkpoint slf sn vn keys s = (s', msgs). Notation "'CHECK_BROADCAST_CHECKPOINT'" := (hidden_check_broadcast_checkpoint _ _ _ _ _ _ _). Lemma hide_check_broadcast_checkpoint : forall slf sn vn keys s s' msgs, (check_broadcast_checkpoint slf sn vn keys s = (s', msgs)) = hidden_check_broadcast_checkpoint slf sn vn keys s s' msgs. Proof. auto. Qed. Definition hidden_reply2requests (slf : Rep) (view : View) (keys : local_key_map) (reqs : list Request) (state : PBFTsm_state) (lastr : LastReplyState) (reps : list (option Reply)) (state' : PBFTsm_state) (lastr' : LastReplyState) : Prop := reply2requests slf view keys reqs state lastr = (reps, state', lastr'). Notation "'REPLY2REQUESTS'" := (hidden_reply2requests _ _ _ _ _ _ _ _ _). Lemma hide_reply2requests : forall slf view keys reqs state lastr reps state' lastr', (reply2requests slf view keys reqs state lastr = (reps, state', lastr')) = hidden_reply2requests slf view keys reqs state lastr reps state' lastr'. Proof. auto. Qed. Ltac hide_hyps := repeat match goal with | [ H : check_broadcast_checkpoint _ _ _ _ _ = (_, _) |- _ ] => rewrite hide_check_broadcast_checkpoint in H | [ H : reply2requests _ _ _ _ _ _ = (_, _, _) |- _ ] => rewrite hide_reply2requests in H end. Ltac unhide_hyps := repeat match goal with | [ H : hidden_check_broadcast_checkpoint _ _ _ _ _ _ _ |- _ ] => rewrite <- hide_check_broadcast_checkpoint in H | [ H : hidden_check_broadcast_checkpoint _ _ _ _ _ _ _ _ _ |- _ ] => rewrite <- hide_reply2requests in H end. Lemma in_reply2requests : forall slf view keys reqs state lastr rep reps state' lastr', reply2requests slf view keys reqs state lastr = (reps, state', lastr') -> In rep (list_option2list reps) -> exists (req : Request) (reqs1 reqs2 : list Request) (reps1 reps2 : list (option Reply)) (state1 state2 : PBFTsm_state) (lastr1 lastr2 : LastReplyState), reqs = reqs1 ++ req :: reqs2 /\ reply2requests slf view keys reqs1 state lastr = (reps1, state1, lastr1) /\ reply2request slf view keys req state1 lastr1 = (Some rep, state2, lastr2) /\ reply2requests slf view keys reqs2 state2 lastr2 = (reps2, state', lastr'). Proof. induction reqs; introv e i; simpl in *; ginv; simpl in *; tcsp. dest_cases w; symmetry in Heqw; repnd. dest_cases y; symmetry in Heqy; repnd. ginv; simpl in *. dest_cases x; subst; simpl in *; repndors; subst; tcsp;[| |]. - exists a ([] : list Request) reqs ([] : list (option Reply)) y2 state w0 lastr w1. simpl; dands; auto. - eapply IHreqs in Heqy;[|eauto]; clear IHreqs. exrepnd; subst. exists req (a :: reqs1) reqs2 (Some x :: reps1) reps2 state1 state2 lastr1 lastr2; simpl. allrw; simpl; dands; auto. - eapply IHreqs in Heqy;[|eauto]; clear IHreqs. exrepnd; subst. exists req (a :: reqs1) reqs2 (None :: reps1) reps2 state1 state2 lastr1 lastr2; simpl. allrw; simpl; dands; auto. Qed. Lemma eq_timestamps : forall t1 t2, timestamp2nat t1 = timestamp2nat t2 -> t1 = t2. Proof. introv; destruct t1, t2; simpl in *; auto. Qed. Lemma in_reply2request : forall slf view keys req state lastr rep state' lastr', reply2request slf view keys req state lastr = (Some rep, state', lastr') -> exists opr ts c entry result, request2info req = Some (opr, ts, c) /\ find_last_reply_entry_corresponding_to_client lastr c = Some entry /\ rep = reply (bare_reply view ts c slf result) (authenticate (PBFTmsg_bare_reply (bare_reply view ts c slf result)) keys) /\ ( ( lre_timestamp entry < ts /\ PBFTsm_update c state opr = (result, state') /\ lastr' = update_last_reply_timestamp_and_result lastr c ts result ) \/ ( lre_timestamp entry = ts /\ lre_reply entry = Some result /\ lastr' = lastr /\ state' = state ) ). Proof. introv e. unfold reply2request in e. dest_all w;[|]. - exists w0 w3 w2 w w1; dands; auto. - exists w0 w3 w2 w w5; dands; tcsp. right; dands; auto; try omega. apply eq_timestamps; omega. Qed. Lemma PBFTagreement : forall (eo : EventOrdering), authenticated_messages_were_sent_or_byz_usys eo PBFTsys -> internal_messages_were_sent_usys eo PBFTsys -> forall (e1 e2 : Event) (c : Client) (t : Timestamp) (v1 v2 : View) (i1 i2 : Rep) (r1 r2 : PBFTresult) (tok1 tok2 : Tokens), isCorrect e1 -> isCorrect e2 -> In (send_reply (mk_reply v1 t c i1 r1 tok1)) (output_system_on_event_ldata PBFTsys eo e1) -> In (send_reply (mk_reply v2 t c i2 r2 tok2)) (output_system_on_event_ldata PBFTsys eo e2) -> r1 = r2. Proof. introv sentbyz sentint isCor1 isCor2 send1 send2. destruct (PBFTresdeq r1 r2) as [d|d]; auto. assert False; tcsp. (* replies are sent in response to check-ready messages *) apply send_reply_iff in send1. apply send_reply_iff in send2. exrepnd. repeat match goal with | [ H : reply2requests _ _ _ _ _ _ = _ |- _ ] => eapply in_reply2requests in H;[|eauto];[] end. exrepnd. match goal with | [ H : reply2request _ _ _ _ _ _ = _ |- _ ] => apply in_reply2request in H end. SearchAbout reply2requests. (* hide_hyps. pose proof (sentint e2) as q. match goal with | [ H1 : trigger ?e = _ , H2 : context[is_internal_message (trigger ?e)] |- _ ] => rewrite H1 in H2 end. repeat (autodimp q hyp);[]. exrepnd. *) Qed. *) End PBFTagreement.
function value = sphere_unit_monomial_nd ( n, p ) %*****************************************************************************80 % %% SPHERE_UNIT_MONOMIAL_ND integrates a monomial on a unit sphere in ND. % % Integration region: % % Points X(1:N) such that % % Sum ( X(1:N)**2 ) == 1 % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 21 May 2004 % % Author: % % John Burkardt % % Reference: % % Gerald Folland, % How to Integrate a Polynomial Over a Sphere, % American Mathematical Monthly, % Volume 108, May 2001, pages 446-448. % % Parameters: % % Input, integer N, the dimension of the space. % % Input, integer P(N), the exponents of X(1) through X(N) in the monomial. % The exponents P(N) must be nonnegative. % % Output, real SPHERE_UNIT_MONOMIAL_ND, the integral of % X1**P(1)*X2**P(2)*...*XN**P(N) over the unit sphere. % for i = 1 : n if ( mod ( p(i), 2 ) == 1 ) value = 0.0E+00; return end end temp = 0.0E+00; arg2 = 0.0E+00; for i = 1 : n arg1 = ( p(i) + 1 ) / 2.0E+00; temp = temp + gammaln ( arg1 ); arg2 = arg2 + arg1; end temp = temp - gammaln ( arg2 ); value = 2.0E+00 * exp ( temp ); return end
// for license information, see the accompanying LICENSE file #include <stdio.h> #include <stdlib.h> #include <math.h> #include <assert.h> // CBLAS, LAPACKE are f2c translated Netlib F77 reference routines. // 'cblas.h' is widely supported, and is the f2c translated Netlib F77 refernce version. // There are known issues with name mangling schemes regarding wrapped code and inter-language operability between Fortran and C. // // Netlib CBLAS / LAPACKE target // #define LISE_LA_REF // #include <lapacke.h> // #include <cblas.h> // // IBM ESSL target // #define LISE_LA_ESSL // #include <essl.h> // // Intel MKL target // #define LISE_LA_MKL // #include <mkl.h> #ifdef LISE_LA_MKL #include <mkl.h> double ddot(const int *, const double *, const int *, const double *, const int *); void daxpy(const int *, const double *, const double *, const int *, double *, const int *); void dgemv(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); void dcopy(const int *, const double *, const int *, double *, const int *); void dgemm(const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); void dgesdd(const char *, const int *, const int *, double *, const int *, double *, double *, const int *, double *, const int *, double *, const int *, int *, int *); void dger(const int *, const int *, const double *, const double *, const int *, const double *, const int *, double *, const int *); #endif #ifdef LISE_LA_ESSL #include <essl.h> double ddot(int, const double *, int, const double *,int); void daxpy(int, double, double *, int, double *, int); void dgemv(const char *, int, int, double, const void *, int, const double *, int, double, double *, int); void dcopy(int, double *, int, double *, int); void dgemm(const char *, const char *, int, int, int, double, const void *, int, const void *, int, double, void *, int); void dgesdd(const char *, int, int, void *, int, double *, void *, int, void *, int, double *, int, int *, int *); void dger(int, int, double, const double *, int, const double *, int, void *, int); // void dger1(int, int, double, const double *, int, const double *, int, void *, int); #endif #ifdef LISE_LA_REF #include <lapacke.h> #include <cblas.h> double cblas_ddot(const int N, const double *X, const int incX, const double *Y, const int incY); void cblas_daxpy(const int N, const double alpha, const double *X, const int incX, double *Y, const int incY); void cblas_dgemv(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA, const int M, const int N, const double alpha, const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY); void cblas_dcopy(const int N, const double *X, const int incX, double *Y, const int incY); void cblas_dgemm(CBLAS_LAYOUT layout, CBLAS_TRANSPOSE TransA, CBLAS_TRANSPOSE TransB, const int M, const int N, const int K, const double alpha, const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc); void cblas_dger(CBLAS_LAYOUT layout, const int M, const int N, const double alpha, const double *X, const int incX, const double *Y, const int incY, double *A, const int lda); lapack_int LAPACKE_dgesdd( int matrix_layout, char jobz, lapack_int m, lapack_int n, double* a, lapack_int lda, double* s, double* u, lapack_int ldu, double* vt, lapack_int ldvt ); #endif double ddotII( int * , double * , int * , double * , int * ) ; void daxpyII( int * , double * , double * , int * , double * , int * ) ; int broyden_minB( double * v_in , double * v_in_old , double * f_old , double * b , double * v_out , const int n , int * it_out , const double alpha ) ; int broyden_min( double * v_in , double * v_in_old , double * f_old , double * b_bra , double * b_ket , double * d , double * v_out , const int n , int * it_out , const double alpha ) ; int broydenMod_min( double * v_in , double * v_in_old , double * f_old , double * b_bra , double * b_ket , double * d , double * v_out , const int n , int * it_out , const double alpha ) ; void broyden_min_( double * v_in , double * v_in_old , double * f_old , double * b_bra , double * b_ket , double * d , double * v_out , int * n , int * it_out , double * alpha ) { broydenMod_min( v_in , v_in_old , f_old , b_bra , b_ket , d , v_out , * n , it_out , * alpha ) ; } void broyden_minb_( double * v_in , double * v_in_old , double * f_old , double * b_bra , double * v_out , int * n , int * it_out , double * alpha ) { broyden_minB( v_in , v_in_old , f_old , b_bra , v_out , * n , it_out , * alpha ) ; } int broyden_min( double * v_in , double * v_in_old , double * f_old , double * b_bra , double * b_ket , double * d , double * v_out , const int n , int * it_out , const double alpha ) { double * f , * dv , * df ; int i , ii , it1 ; int ione = 1 ; double norm , norm1 , norm2 ; int n1 , ishift ; int it ; it = * it_out ; n1 = n ; if( it == 0 ) { * it_out = 1 ; for( i = 0 ; i < n ; ++i ) { v_in_old[ i ] = v_in[ i ] ; f_old[ i ] = alpha * ( v_in[ i ] - v_out[ i ] ) ; v_in[ i ] -= f_old[ i ] ; v_out[ i ] = v_in[ i ] ; } return( 0 ) ; } assert( f = malloc( n * sizeof( double ) ) ) ; assert( df = malloc( n * sizeof( double ) ) ) ; assert( dv = malloc( n * sizeof( double ) ) ) ; it1 = it - 1 ; ishift = it1 * n ; norm = 0. ; /* || F || */ norm1 = 0. ; /* || F_old || */ for( i = 0 ; i < n ; i++ ) { f[ i ] = alpha * ( v_in[ i ] - v_out[ i ] ) ; norm += f[ i ] * f[ i ] ; norm1 += f_old[ i ] * f_old[ i ] ; dv[ i ] = v_in[ i ] - v_in_old[ i ] ; df[ i ] = f[ i ] - f_old[ i ] ; b_ket[ ishift + i ] = df[ i ] ; b_bra[ ishift + i ] = dv[ i ] ; } for( ii = 0 ; ii < it1 ; ++ii ) { #ifdef LISE_LA_MKL norm = d[ ii ] * ddot( &n1 , df , &ione , b_bra + ii * n , &ione ) ; daxpy( &n1 , &norm , b_ket + ii * n , &ione , b_ket + ishift , &ione ) ; norm = d[ ii ] * ddot( &n1 , dv , &ione , b_ket + ii * n , &ione ) ; daxpy( &n1 , &norm , b_bra + ii * n , &ione , b_bra + ishift ,&ione ) ; #endif #ifdef LISE_LA_ESSL norm = d[ ii ] * ddot( n1 , df , ione , b_bra + ii * n , ione ) ; daxpy( n1 , norm , b_ket + ii * n , ione , b_ket + ishift , ione ) ; norm = d[ ii ] * ddot( n1 , dv , ione , b_ket + ii * n , ione ) ; daxpy( n1 , norm , b_bra + ii * n , ione , b_bra + ishift ,ione ) ; #endif #ifdef LISE_LA_REF //double cblas_ddot(const int N, const double *X, const int incX, const double *Y, const int incY); //void cblas_daxpy(const int N, const double alpha, const double *X, const int incX, double *Y, const int incY); norm = d[ ii ] * cblas_ddot( n1 , df , ione , b_bra + ii * n , ione ) ; cblas_daxpy( n1 , norm , b_ket + ii * n , ione , b_ket + ishift , ione ) ; norm = d[ ii ] * cblas_ddot( n1 , dv , ione , b_ket + ii * n , ione ) ; cblas_daxpy( n1 , norm , b_bra + ii * n , ione , b_bra + ishift ,ione ) ; #endif } #ifdef LISE_LA_MKL norm = ddot( &n1 , dv , &ione , b_ket + ishift , &ione ) ; #endif #ifdef LISE_LA_ESSL norm = ddot( n1 , dv , ione , b_ket + ishift , ione ) ; #endif #ifdef LISE_LA_REF norm = cblas_ddot( n1 , dv , ione , b_ket + ishift , ione ) ; #endif printf( "<dv|B|df> =%12.6e\n", norm ) ; if( fabs( norm ) < 1.e-15 ) return( 0 ) ; for( i = 0 ; i < n ; ++i ) b_ket[ ishift + i ] = ( dv[ i ] - b_ket[ ishift + i ] ) / norm ; #ifdef LISE_LA_MKL norm1 = sqrt( ddot( &n1 , b_ket + ishift , &ione , b_ket + ishift , &ione ) ) ; norm2 = sqrt( ddot( &n1 , b_bra + ishift , &ione , b_bra + ishift , &ione ) ) ; #endif #ifdef LISE_LA_ESSL norm1 = sqrt( ddot( n1 , b_ket + ishift , ione , b_ket + ishift , ione ) ) ; norm2 = sqrt( ddot( n1 , b_bra + ishift , ione , b_bra + ishift , ione ) ) ; #endif #ifdef LISE_LA_REF norm1 = sqrt( cblas_ddot( n1 , b_ket + ishift , ione , b_ket + ishift , ione ) ) ; norm2 = sqrt( cblas_ddot( n1 , b_bra + ishift , ione , b_bra + ishift , ione ) ) ; #endif for( i = 0 ; i < n ; i++ ) { b_ket[ ishift + i ] = b_ket[ ishift + i ] / norm1 ; b_bra[ ishift + i ] = b_bra[ ishift + i ] / norm2 ; } d[ it1 ] = norm1 * norm2 ; for( i = 0 ; i < n ; i++) { v_in_old[ i ] = v_in[ i ] ; v_in[ i ] -= f[ i ] ; } for( ii = 0 ; ii < it ; ii++ ) { #ifdef LISE_LA_MKL norm = - d[ ii ] * ddot( &n1 , b_bra + ii * n , &ione , f , &ione ) ; daxpy( &n1 , &norm , b_ket + ii * n , &ione , v_in , &ione ) ; #endif #ifdef LISE_LA_ESSL norm = - d[ ii ] * ddot( n1 , b_bra + ii * n , ione , f , ione ) ; daxpy( n1 , norm , b_ket + ii * n , ione , v_in , ione ) ; #endif #ifdef LISE_LA_REF norm = - d[ ii ] * cblas_ddot( n1 , b_bra + ii * n , ione , f , ione ) ; cblas_daxpy( n1 , norm , b_ket + ii * n , ione , v_in , ione ) ; #endif } for( i = 0 ; i < n ; i++ ) { f_old[ i ] = f[ i ] ; v_out[ i ] = v_in[ i ] ; } ( * it_out ) ++ ; free( f ) ; free( dv ) ; free( df ) ; return( 0 ) ; } int broyden_minB( double * v_in , double * v_in_old , double * f_old , double * b , double * v_out , const int n , int * it_out , const double alpha ) { double * f , * dv , * df , * bdf , * bdv ; int i , ii , it1 ; int ione = 1 ; double norm , norm1 , norm2 ; int n1 , ishift ; int it , j ; double * u , * vt , * s , * work , wk_[ 2 ] ; int lwork = -1 , info , * iwork ; it = * it_out ; printf( "Starting Broyden %d \n\n" , it ) ; n1 = n ; if( it == 0 ) { * it_out = 1 ; for( i = 0 ; i < n ; ++i ) { v_in_old[ i ] = v_in[ i ] ; f_old[ i ] = alpha * ( v_in[ i ] - v_out[ i ] ) ; v_in[ i ] -= f_old[ i ] ; v_out[ i ] = v_in[ i ] ; for( j = 0 ; j < n ; j++ ) b[ i + n * j ] = 0. ; b[ i + n * i ] = 1. ; } return( 0 ) ; } assert( f = malloc( n * sizeof( double ) ) ) ; assert( df = malloc( n * sizeof( double ) ) ) ; assert( dv = malloc( n * sizeof( double ) ) ) ; assert( bdv = malloc( n * sizeof( double ) ) ) ; assert( bdf = malloc( n * sizeof( double ) ) ) ; it1 = it - 1 ; ishift = it1 * n ; for( i = 0 ; i < n ; i++ ) { f[ i ] = alpha * ( v_in[ i ] - v_out[ i ] ) ; dv[ i ] = v_in[ i ] - v_in_old[ i ] ; df[ i ] = f[ i ] - f_old[ i ] ; } norm = 0. ; for( i = 0 ; i < n ; i ++ ) { bdv[ i ] = 0. ; bdf[ i ] = dv[ i ] ; for( j = 0 ; j < n ; j++ ){ bdv[ i ] += b[ j + n * i ] * dv[ j ] ; bdf[ i ] -= b[ i + n * j ] * df[ j ] ; } norm += df[ i ] * bdv[ i ] ; } printf( "<dv|B|df> =%12.6e\n", norm ) ; norm = 1./norm ; #ifdef LISE_LA_REF cblas_dger( CBLASColMajor, n1 , n1 , norm , bdf , ione , bdv , ione , b , n1 ) ; #endif #ifdef LISE_LA_ESSL dger( n1 , n1 , norm , bdf , ione , bdv , ione , b , n1 ) ; #endif #ifdef LISE_LA_MKL // void dger(const int *, const int *, const double *, const double *, const int *, const double *, const int *, void *, const int *); dger( &n1 , &n1 , &norm , bdf , &ione , bdv , &ione , b , &n1 ) ; #endif if( it > 5 ){ /* add a SVD decomposition of matrix B */ assert( s = malloc( n * sizeof( double ) ) ) ; assert( u = malloc( n * n * sizeof( double ) ) ) ; assert( vt = malloc( n * n * sizeof( double ) ) ) ; assert( iwork = malloc( 8 * n * sizeof( double ) ) ) ; #ifdef LISE_LA_MKL dgesdd( "A", &n1 , &n1 , b , &n1 , s , u , &n1 , vt , &n1 , wk_ , &lwork , iwork , &info ) ; #endif #ifdef LISE_LA_ESSL dgesdd( "A", n1 , n1 , b , n1 , s , u , n1 , vt , n1 , wk_ , lwork , iwork , &info ) ; #endif #ifdef LISE_LA_REF info = LAPACKE_dgesdd(LAPACK_COL_MAJOR, 'A', n1 , n1 , b , n1 , s , u , n1 , vt , n1 ) ; #endif lwork = ( int ) wk_[ 0 ] ; assert( work = malloc( lwork * sizeof( double ) ) ) ; #ifdef LISE_LA_ESSL dgesdd( "A" , n1 , n1 , b , n1 , s , u , n1 , vt , n1 , work , lwork , iwork , &info ) ; #endif #ifdef LISE_LA_REF info = LAPACKE_dgesdd(LAPACK_COL_MAJOR, 'A', n1 , n1 , b , n1 , s , u , n1 , vt , n1 ) ; #endif #ifdef LISE_LA_MKL dgesdd( "A", &n1 , &n1 , b , &n1 , s , u , &n1 , vt , &n1 , work , &lwork , iwork , &info ) ; #endif free( work ) ; free( iwork ) ; for( i = 0 ; i < n ; i++ ){ if( s[ i ] < 1.e-6 ) { printf( " s[ %d ] = %g \n" , i , s[ i ] ) ; s[ i ] = 0. ; } for( j = 0 ; j < n ; j++ ) vt[ i + j * n ] *= s[ i ] ; } free( s ) ; norm = 0. ; norm1 = 1. ; #ifdef LISE_LA_ESSL dgemm( "N" , "N" , n1 , n1 , n1 , norm1 , u , n1 , vt , n1 , norm , b , n1 ) ; #endif #ifdef LISE_LA_MKL // void dgemm(const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); dgemm( "N" , "N" , &n1 , &n1 , &n1 , &norm1 , u , &n1 , vt , &n1 , &norm , b , &n1 ) ; #endif #ifdef LISE_LA_REF cblas_dgemm(CBLAS_COL_MAJOR,"N" , "N" , n1 , n1 , n1 , norm1 , u , n1 , vt , n1 , norm , b , n1); #endif free( u ) ; free( vt ) ; } #ifdef LISE_LA_ESSL dcopy( n1 , v_in , ione , v_in_old , ione ) ; #endif #ifdef LISE_LA_MKL //void dcopy(const int *, const double *, const int *, double *, const int *); dcopy( &n1 , v_in , &ione , v_in_old , &ione ) ; #endif #ifdef LISE_LA_REF cblas_dcopy( n1 , v_in , ione , v_in_old , ione ) ; #endif norm1 = -1. ; norm = 1. ; #ifdef LISE_LA_MKL //void dgemv(const char *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *); dgemv( "N" , &n1 , &n1 , &norm1 , b , &n1 , f , &ione , &norm , v_in , &ione ) ; #endif #ifdef LISE_LA_ESSL dgemv( "N" , n1 , n1 , norm1 , b , n1 , f , ione , norm , v_in , ione ) ; #endif #ifdef LISE_LA_REF cblas_dgemv(CBLAS_COL_MAJOR, "N" , n1 , n1 , norm1 , b , n1 , f , ione , norm , v_in , ione ) ; #endif for( i = 0 ; i < n ; i++ ) { f_old[ i ] = f[ i ] ; v_out[ i ] = v_in[ i ] ; } ( * it_out ) ++ ; free( f ) ; free( dv ) ; free( df ) ; free( bdf ) ; free( bdv ) ; printf( "Done with Broyden \n\n" ) ; return( 0 ) ; } int broydenMod_min( double * v_in , double * v_in_old , double * f_old , double * b_bra , double * b_ket , double * d , double * v_out , const int n , int * it_out , const double alpha ) /* Change in the formula. Use Eq. (10) in J.Chem.Phys. 134 (2011) 134109 */ { double * f , * dv , * df ; int i , ii , it1 ; int ione = 1 ; double norm , norm1 , norm2 ; int n1 , ishift ; int it ; it = * it_out ; printf( "Starting Broyden %d \n\n" , it ) ; n1 = n ; if( it == 0 ) { * it_out = 1 ; for( i = 0 ; i < n ; ++i ) { v_in_old[ i ] = v_in[ i ] ; f_old[ i ] = alpha * ( v_in[ i ] - v_out[ i ] ) ; v_in[ i ] -= f_old[ i ] ; v_out[ i ] = v_in[ i ] ; } return( 0 ) ; } assert( f = malloc( n * sizeof( double ) ) ) ; assert( df = malloc( n * sizeof( double ) ) ) ; assert( dv = malloc( n * sizeof( double ) ) ) ; it1 = it - 1 ; ishift = it1 * n ; norm = 0. ; /* || F || */ norm1 = 0. ; /* || F_old || */ for( i = 0 ; i < n ; i++ ) { f[ i ] = alpha * ( v_in[ i ] - v_out[ i ] ) ; norm += f[ i ] * f[ i ] ; norm1 += f_old[ i ] * f_old[ i ] ; dv[ i ] = v_in[ i ] - v_in_old[ i ] ; df[ i ] = f[ i ] - f_old[ i ] ; b_ket[ ishift + i ] = df[ i ] ; b_bra[ ishift + i ] = df[ i ] ; } for( ii = 0 ; ii < it1 ; ++ii ) { #ifdef LISE_LA_MKL norm = d[ ii ] * ddot( &n1 , df , &ione , b_bra + ii * n , &ione ) ; daxpy( &n1 , &norm , b_ket + ii * n , &ione , b_ket + ishift , &ione ) ; #endif #ifdef LISE_LA_ESSL norm = d[ ii ] * ddot( n1 , df , ione , b_bra + ii * n , ione ) ; daxpy( n1 , norm , b_ket + ii * n , ione , b_ket + ishift , ione ) ; #endif #ifdef LISE_LA_REF norm = d[ ii ] * cblas_ddot( n1 , df , ione , b_bra + ii * n , ione ) ; cblas_daxpy( n1 , norm , b_ket + ii * n , ione , b_ket + ishift , ione ) ; #endif } #ifdef LISE_LA_MKL norm = ddot( &n1 , df , &ione , df , &ione ) ; #endif #ifdef LISE_LA_ESSL norm = ddot( n1 , df , ione , df , ione ) ; #endif #ifdef LISE_LA_REF norm = cblas_ddot( n1 , df , ione , df , ione ) ; #endif printf( "<df|df> =%12.6e\n", norm ) ; for( i = 0 ; i < n ; ++i ) b_ket[ ishift + i ] = ( dv[ i ] - b_ket[ ishift + i ] ) / norm ; #ifdef LISE_LA_MKL norm1 = sqrt( ddot( &n1 , b_ket + ishift , &ione , b_ket + ishift , &ione ) ) ; norm2 = sqrt( ddot( &n1 , b_bra + ishift , &ione , b_bra + ishift ,&ione ) ) ; #endif #ifdef LISE_LA_ESSL norm1 = sqrt( ddot( n1 , b_ket + ishift , ione , b_ket + ishift , ione ) ) ; norm2 = sqrt( ddot( n1 , b_bra + ishift , ione , b_bra + ishift ,ione ) ) ; #endif #ifdef LISE_LA_REF norm1 = sqrt( cblas_ddot( n1 , b_ket + ishift , ione , b_ket + ishift , ione ) ) ; norm2 = sqrt( cblas_ddot( n1 , b_bra + ishift , ione , b_bra + ishift ,ione ) ) ; #endif for( i = 0 ; i < n ; i++ ) { b_ket[ ishift + i ] = b_ket[ ishift + i ] / norm1 ; b_bra[ ishift + i ] = b_bra[ ishift + i ] / norm2 ; } d[ it1 ] = norm1 * norm2 ; for( i = 0 ; i < n ; i++) { v_in_old[ i ] = v_in[ i ] ; v_in[ i ] -= f[ i ] ; } for( ii = 0 ; ii < it ; ii++ ) { #ifdef LISE_LA_MKL norm = - d[ ii ] * ddot( &n1 , b_bra + ii * n , &ione , f , &ione ) ; daxpy( &n1 , &norm , b_ket + ii * n , &ione , v_in , &ione ) ; #endif #ifdef LISE_LA_ESSL norm = - d[ ii ] * ddot( n1 , b_bra + ii * n , ione , f , ione ) ; daxpy( n1 , norm , b_ket + ii * n , ione , v_in , ione ) ; #endif #ifdef LISE_LA_REF norm = - d[ ii ] * cblas_ddot( n1 , b_bra + ii * n , ione , f , ione ) ; cblas_daxpy( n1 , norm , b_ket + ii * n , ione , v_in , ione ) ; #endif } for( i = 0 ; i < n ; i++ ) { f_old[ i ] = f[ i ] ; v_out[ i ] = v_in[ i ] ; } ( * it_out ) ++ ; free( f ) ; free( dv ) ; free( df ) ; printf( "Done with Broyden \n\n" ) ; return( 0 ) ; } double ddotII( int * n , double *v1 , int * i1 , double * v2 , int * i2 ) { double sum = 0. ; int i ; for( i = 0 ; i < * n ; i++ ) sum += v1[ i ] * v2[ i ] ; return( sum ) ; } void daxpyII( int * n , double * alpha , double * x , int * i1 , double * y , int * i2 ) { int i ; for( i = 0 ; i < * n ; i++ ) y[ i ] += *alpha * x[ i ] ; }
#include <gsl/gsl_test.h> #include <gsl/gsl_ieee_utils.h> #include <gsl/gsl_math.h> #include "gsl_cblas.h" #include "tests.h" void test_hpr (void) { const double flteps = 1e-4, dbleps = 1e-6; { int order = 101; int uplo = 121; int N = 2; float alpha = 0.1f; float Ap[] = { -0.273f, -0.499f, -0.305f, -0.277f, 0.238f, -0.369f }; float X[] = { 0.638f, -0.905f, 0.224f, 0.182f }; int incX = -1; float Ap_expected[] = { -0.26467f, 0.0f, -0.30718f, -0.245116f, 0.360607f, 0.0f }; cblas_chpr(order, uplo, N, alpha, X, incX, Ap); { int i; for (i = 0; i < 3; i++) { gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr(case 1418) real"); gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr(case 1418) imag"); }; }; }; { int order = 101; int uplo = 122; int N = 2; float alpha = 0.1f; float Ap[] = { -0.273f, -0.499f, -0.305f, -0.277f, 0.238f, -0.369f }; float X[] = { 0.638f, -0.905f, 0.224f, 0.182f }; int incX = -1; float Ap_expected[] = { -0.26467f, 0.0f, -0.30718f, -0.308884f, 0.360607f, 0.0f }; cblas_chpr(order, uplo, N, alpha, X, incX, Ap); { int i; for (i = 0; i < 3; i++) { gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr(case 1419) real"); gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr(case 1419) imag"); }; }; }; { int order = 102; int uplo = 121; int N = 2; float alpha = 0.1f; float Ap[] = { -0.273f, -0.499f, -0.305f, -0.277f, 0.238f, -0.369f }; float X[] = { 0.638f, -0.905f, 0.224f, 0.182f }; int incX = -1; float Ap_expected[] = { -0.26467f, 0.0f, -0.30718f, -0.245116f, 0.360607f, 0.0f }; cblas_chpr(order, uplo, N, alpha, X, incX, Ap); { int i; for (i = 0; i < 3; i++) { gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr(case 1420) real"); gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr(case 1420) imag"); }; }; }; { int order = 102; int uplo = 122; int N = 2; float alpha = 0.1f; float Ap[] = { -0.273f, -0.499f, -0.305f, -0.277f, 0.238f, -0.369f }; float X[] = { 0.638f, -0.905f, 0.224f, 0.182f }; int incX = -1; float Ap_expected[] = { -0.26467f, 0.0f, -0.30718f, -0.308884f, 0.360607f, 0.0f }; cblas_chpr(order, uplo, N, alpha, X, incX, Ap); { int i; for (i = 0; i < 3; i++) { gsl_test_rel(Ap[2*i], Ap_expected[2*i], flteps, "chpr(case 1421) real"); gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], flteps, "chpr(case 1421) imag"); }; }; }; { int order = 101; int uplo = 121; int N = 2; double alpha = 1; double Ap[] = { 0.265, 0.362, -0.855, 0.035, 0.136, 0.133 }; double X[] = { -0.278, -0.686, -0.736, -0.918 }; int incX = -1; double Ap_expected[] = { 1.64942, 0.0, -0.020644, -0.214692, 0.68388, 0.0 }; cblas_zhpr(order, uplo, N, alpha, X, incX, Ap); { int i; for (i = 0; i < 3; i++) { gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr(case 1422) real"); gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr(case 1422) imag"); }; }; }; { int order = 101; int uplo = 122; int N = 2; double alpha = 1; double Ap[] = { 0.265, 0.362, -0.855, 0.035, 0.136, 0.133 }; double X[] = { -0.278, -0.686, -0.736, -0.918 }; int incX = -1; double Ap_expected[] = { 1.64942, 0.0, -0.020644, 0.284692, 0.68388, 0.0 }; cblas_zhpr(order, uplo, N, alpha, X, incX, Ap); { int i; for (i = 0; i < 3; i++) { gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr(case 1423) real"); gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr(case 1423) imag"); }; }; }; { int order = 102; int uplo = 121; int N = 2; double alpha = 1; double Ap[] = { 0.265, 0.362, -0.855, 0.035, 0.136, 0.133 }; double X[] = { -0.278, -0.686, -0.736, -0.918 }; int incX = -1; double Ap_expected[] = { 1.64942, 0.0, -0.020644, -0.214692, 0.68388, 0.0 }; cblas_zhpr(order, uplo, N, alpha, X, incX, Ap); { int i; for (i = 0; i < 3; i++) { gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr(case 1424) real"); gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr(case 1424) imag"); }; }; }; { int order = 102; int uplo = 122; int N = 2; double alpha = 1; double Ap[] = { 0.265, 0.362, -0.855, 0.035, 0.136, 0.133 }; double X[] = { -0.278, -0.686, -0.736, -0.918 }; int incX = -1; double Ap_expected[] = { 1.64942, 0.0, -0.020644, 0.284692, 0.68388, 0.0 }; cblas_zhpr(order, uplo, N, alpha, X, incX, Ap); { int i; for (i = 0; i < 3; i++) { gsl_test_rel(Ap[2*i], Ap_expected[2*i], dbleps, "zhpr(case 1425) real"); gsl_test_rel(Ap[2*i+1], Ap_expected[2*i+1], dbleps, "zhpr(case 1425) imag"); }; }; }; }
{-# OPTIONS_GHC -fno-warn-missing-methods #-} {-# OPTIONS_GHC -fno-warn-incomplete-patterns #-} -- | Dense vectors and linear algebra operations. -- -- NOTE: -- This module is a prototype for what a more fully featured linear algebra module might look like. -- There are a number of efficiency related features that are missing. -- In particular, matrices will get copied more often than they need to, and only the most naive dense matrix format is currently supported. -- These limitations are due to using "hmatrix" as a backend (all operations should be at least as fast as in hmatrix). -- Future iterations will use something like "hblas" to get finer lever control. -- -- -- FIXME: -- Shouldn't expose the constructors, but they're needed for the "SubHask.Algebra.Array" types. -- -- FIXME: -- We shouldn't need to call out to the FFI in order to get SIMD instructions. module SubHask.Algebra.Vector ( SVector (..) , UVector (..) , ValidUVector , Unbox , type (+>) , SMatrix , unsafeMkSMatrix -- * Debug , safeNewByteArray ) where import qualified Prelude as P import Control.Monad.Primitive import Control.Monad import Data.Primitive hiding (sizeOf) import qualified Data.Primitive as Prim import Foreign.Ptr import Foreign.ForeignPtr import Foreign.Marshal.Utils import Test.QuickCheck.Gen (frequency) import qualified Data.Vector.Unboxed as VU import qualified Data.Vector.Storable as VS import qualified Numeric.LinearAlgebra as HM import SubHask.Algebra import SubHask.Category import SubHask.Internal.Prelude import SubHask.SubType import Data.Csv (FromRecord,FromField,parseRecord) -------------------------------------------------------------------------------- -- rewrite rules for faster static parameters -- -- FIXME: Find a better home for this. -- -- FIXME: Expand to many more naturals. {-# INLINE[2] nat2int #-} nat2int :: KnownNat n => Proxy n -> Int nat2int = fromIntegral . natVal {-# INLINE[1] nat200 #-} nat200 :: Proxy 200 -> Int nat200 _ = 200 {-# RULES "subhask/nat2int_200" nat2int = nat200 #-} -------------------------------------------------------------------------------- type Unbox = VU.Unbox -------------------------------------------------------------------------------- -- | The type of dynamic or statically sized unboxed vectors. data family UVector (n::k) r type instance Scalar (UVector n r) = Scalar r type instance Logic (UVector n r) = Logic r -- type instance UVector n r >< a = UVector n (r><a) type instance UVector m a >< b = Tensor_UVector (UVector m a) b type family Tensor_UVector a b where Tensor_UVector (UVector n r1) (UVector m r2) = UVector n r1 +> UVector m r2 Tensor_UVector (UVector n r1) r1 = UVector n r1 -- (r1><r2) type ValidUVector n r = ( (UVector n r><Scalar r)~UVector n r, Prim r) type instance Index (UVector n r) = Int type instance Elem (UVector n r) = Scalar r type instance SetElem (UVector n r) b = UVector n b -------------------------------------------------------------------------------- data instance UVector (n::Symbol) r = UVector_Dynamic {-#UNPACK#-}!ByteArray {-#UNPACK#-}!Int -- offset {-#UNPACK#-}!Int -- length instance (Show r, Monoid r, Prim r) => Show (UVector (n::Symbol) r) where show (UVector_Dynamic arr off n) = if isZero n then "zero" else show $ go (extendDimensions n-1) [] where go (-1) xs = xs go i xs = go (i-1) (x:xs) where x = indexByteArray arr (off+i) :: r instance (Arbitrary r, ValidUVector n r, FreeModule r, IsScalar r) => Arbitrary (UVector (n::Symbol) r) where arbitrary = frequency [ (1,return zero) , (9,fmap unsafeToModule $ replicateM 27 arbitrary) ] instance (Show r, Monoid r, Prim r) => CoArbitrary (UVector (n::Symbol) r) where coarbitrary = coarbitraryShow instance (NFData r, Prim r) => NFData (UVector (n::Symbol) r) where rnf (UVector_Dynamic arr _ _) = seq arr () instance (FromField r, ValidUVector n r, IsScalar r, FreeModule r) => FromRecord (UVector (n::Symbol) r) where parseRecord r = do rs :: [r] <- parseRecord r return $ unsafeToModule rs --------------------------------------- -- mutable newtype instance Mutable m (UVector (n::Symbol) r) = Mutable_UVector (PrimRef m (UVector (n::Symbol) r)) instance Prim r => IsMutable (UVector (n::Symbol) r) where freeze mv = copy mv >>= unsafeFreeze thaw v = unsafeThaw v >>= copy unsafeFreeze (Mutable_UVector ref) = readPrimRef ref unsafeThaw v = do ref <- newPrimRef v return $ Mutable_UVector ref copy (Mutable_UVector ref) = do (UVector_Dynamic arr1 off1 n) <- readPrimRef ref let b = (extendDimensions n)*Prim.sizeOf (undefined::r) if n==0 then do ref' <- newPrimRef $ UVector_Dynamic arr1 off1 n return $ Mutable_UVector ref' else unsafePrimToPrim $ do marr2 <- safeNewByteArray b 16 copyByteArray marr2 0 arr1 off1 b arr2 <- unsafeFreezeByteArray marr2 ref2 <- newPrimRef (UVector_Dynamic arr2 0 n) return $ Mutable_UVector ref2 write (Mutable_UVector ref') (UVector_Dynamic arr2 off2 n2) = do (UVector_Dynamic arr1 off1 n1) <- readPrimRef ref' unsafePrimToPrim $ if -- both ptrs null: do nothing | n1==0 && n2==0 -> return () -- only arr1 null: allocate memory then copy arr2 over | n1==0 -> do marr1' <- safeNewByteArray b 16 copyByteArray marr1' 0 arr2 off2 b arr1' <- unsafeFreezeByteArray marr1' unsafePrimToPrim $ writePrimRef ref' (UVector_Dynamic arr1' 0 n2) -- only arr2 null: make arr1 null | n2==0 -> do writePrimRef ref' (UVector_Dynamic arr2 0 n1) -- both ptrs valid: perform a normal copy | otherwise -> do marr1 <- unsafeThawByteArray arr1 copyByteArray marr1 off1 arr2 off2 b where b = (extendDimensions n2)*Prim.sizeOf (undefined::r) ---------------------------------------- -- algebra extendDimensions :: Int -> Int extendDimensions = roundUpToNearest 4 safeNewByteArray :: PrimMonad m => Int -> Int -> m (MutableByteArray (PrimState m)) safeNewByteArray b 16 = do let n=extendDimensions $ b`quot`4 marr <- newAlignedPinnedByteArray b 16 setByteArray marr 0 n (0::Float) return marr {-# INLINE binopDynUV #-} binopDynUV :: forall a n. ( Prim a , Monoid a ) => (a -> a -> a) -> UVector (n::Symbol) a -> UVector (n::Symbol) a -> UVector (n::Symbol) a binopDynUV f v1@(UVector_Dynamic arr1 off1 n1) v2@(UVector_Dynamic arr2 off2 n2) = if | isZero n1 && isZero n2 -> v1 | isZero n1 -> monopDynUV (f zero) v2 | isZero n2 -> monopDynUV (\a -> f a zero) v1 | otherwise -> unsafeInlineIO $ do let b = (extendDimensions n1)*Prim.sizeOf (undefined::a) marr3 <- safeNewByteArray b 16 go marr3 (n1-1) arr3 <- unsafeFreezeByteArray marr3 return $ UVector_Dynamic arr3 0 n1 where go _ (-1) = return () go marr3 i = do let v1' = indexByteArray arr1 (off1+i) v2' = indexByteArray arr2 (off2+i) writeByteArray marr3 i (f v1' v2') go marr3 (i-1) {-# INLINE monopDynUV #-} monopDynUV :: forall a n. ( Prim a ) => (a -> a) -> UVector (n::Symbol) a -> UVector (n::Symbol) a monopDynUV f v@(UVector_Dynamic arr1 off1 n) = if n==0 then v else unsafeInlineIO $ do let b = n*Prim.sizeOf (undefined::a) marr2 <- safeNewByteArray b 16 go marr2 (n-1) arr2 <- unsafeFreezeByteArray marr2 return $ UVector_Dynamic arr2 0 n where go _ (-1) = return () go marr2 i = do let v1 = indexByteArray arr1 (off1+i) writeByteArray marr2 i (f v1) go marr2 (i-1) instance (Monoid r, Prim r) => Semigroup (UVector (n::Symbol) r) where {-# INLINE (+) #-} ; (+) = binopDynUV (+) instance (Monoid r, Cancellative r, Prim r) => Cancellative (UVector (n::Symbol) r) where {-# INLINE (-) #-} ; (-) = binopDynUV (-) instance (Monoid r, Prim r) => Monoid (UVector (n::Symbol) r) where {-# INLINE zero #-} zero = unsafeInlineIO $ do marr <- safeNewByteArray 0 16 arr <- unsafeFreezeByteArray marr return $ UVector_Dynamic arr 0 0 instance (Group r, Prim r) => Group (UVector (n::Symbol) r) where {-# INLINE negate #-} negate v = monopDynUV negate v instance (Monoid r, Abelian r, Prim r) => Abelian (UVector (n::Symbol) r) instance (Module r, ValidUVector n r) => Module (UVector (n::Symbol) r) where {-# INLINE (.*) #-} ; (.*) v r = monopDynUV (.*r) v type instance Actor (UVector n r) = Actor r instance (Action r, Semigroup r, Prim r) => Action (UVector (n::Symbol) r) where {-# INLINE (.+) #-} (.+) v r = monopDynUV (.+r) v instance (FreeModule r, ValidUVector n r) => FreeModule (UVector (n::Symbol) r) where {-# INLINE (.*.) #-} ; (.*.) = binopDynUV (.*.) instance (VectorSpace r, ValidUVector n r) => VectorSpace (UVector (n::Symbol) r) where {-# INLINE (./) #-} ; (./) v r = monopDynUV (./r) v {-# INLINE (./.) #-} ; (./.) = binopDynUV (./.) ---------------------------------------- -- container instance (Monoid r, ValidLogic r, Prim r, IsScalar r) => IxContainer (UVector (n::Symbol) r) where {-# INLINE (!) #-} (!) (UVector_Dynamic arr off _) i = indexByteArray arr (off+i) {-# INLINABLE toIxList #-} toIxList (UVector_Dynamic arr off n) = P.zip [0..] $ go (n-1) [] where go (-1) xs = xs go i xs = go (i-1) (indexByteArray arr (off+i) : xs) instance (FreeModule r, ValidUVector n r, ValidLogic r, IsScalar r) => FiniteModule (UVector (n::Symbol) r) where {-# INLINE dim #-} dim (UVector_Dynamic _ _ n) = n {-# INLINABLE unsafeToModule #-} unsafeToModule xs = unsafeInlineIO $ do marr <- safeNewByteArray (n*Prim.sizeOf (undefined::r)) 16 go marr (P.reverse xs) (n-1) arr <- unsafeFreezeByteArray marr return $ UVector_Dynamic arr 0 n where n = length xs go _ [] (-1) = return () go marr (x:xs') i = do writeByteArray marr i x go marr xs' (i-1) ---------------------------------------- -- comparison isConst :: (Prim r, Eq_ r, ValidLogic r) => UVector (n::Symbol) r -> r -> Logic r isConst (UVector_Dynamic arr1 off1 n1) c = go (off1+n1-1) where go (-1) = true go i = indexByteArray arr1 i==c && go (i-1) instance (Eq r, Monoid r, Prim r) => Eq_ (UVector (n::Symbol) r) where {-# INLINE (==) #-} v1@(UVector_Dynamic arr1 off1 n1)==v2@(UVector_Dynamic arr2 off2 n2) = if | isZero n1 && isZero n2 -> true | isZero n1 -> isConst v2 zero | isZero n2 -> isConst v1 zero | otherwise -> go (n1-1) where go (-1) = true go i = v1'==v2' && go (i-1) where v1' = indexByteArray arr1 (off1+i) :: r v2' = indexByteArray arr2 (off2+i) :: r ---------------------------------------- -- distances instance ( Prim r , ExpField r , Normed r , Ord_ r , Logic r~Bool , IsScalar r , VectorSpace r ) => Metric (UVector (n::Symbol) r) where {-# INLINE[2] distance #-} distance v1@(UVector_Dynamic _ _ n1) v2@(UVector_Dynamic _ _ n2) = if | isZero n1 -> size v2 | isZero n2 -> size v1 | otherwise -> sqrt $ go 0 (n1-1) where go !tot !i = if i<4 then goEach tot i else go (tot+(v1!(i ) - v2!(i )) .*. (v1!(i ) - v2!(i )) +(v1!(i-1) - v2!(i-1)) .*. (v1!(i-1) - v2!(i-1)) +(v1!(i-2) - v2!(i-2)) .*. (v1!(i-2) - v2!(i-2)) +(v1!(i-3) - v2!(i-3)) .*. (v1!(i-3) - v2!(i-3)) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot + (v1!i-v2!i).*.(v1!i-v2!i)) (i-1) {-# INLINE[2] distanceUB #-} distanceUB v1@(UVector_Dynamic _ _ n1) v2@(UVector_Dynamic _ _ n2) ub = if | isZero n1 -> size v2 | isZero n2 -> size v1 | otherwise -> sqrt $ go 0 (n1-1) where ub2=ub*ub go !tot !i = if tot>ub2 then tot else if i<4 then goEach tot i else go (tot+(v1!(i ) - v2!(i )) .*. (v1!(i ) - v2!(i )) +(v1!(i-1) - v2!(i-1)) .*. (v1!(i-1) - v2!(i-1)) +(v1!(i-2) - v2!(i-2)) .*. (v1!(i-2) - v2!(i-2)) +(v1!(i-3) - v2!(i-3)) .*. (v1!(i-3) - v2!(i-3)) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot + (v1!i-v2!i).*.(v1!i-v2!i)) (i-1) instance (VectorSpace r, Prim r, IsScalar r, ExpField r) => Normed (UVector (n::Symbol) r) where {-# INLINE size #-} size v@(UVector_Dynamic _ off n) = if isZero n then 0 else sqrt $ go 0 (off+n-1) where go !tot !i = if i<4 then goEach tot i else go (tot+v!(i ).*.v!(i ) +v!(i-1).*.v!(i-1) +v!(i-2).*.v!(i-2) +v!(i-3).*.v!(i-3) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot+v!i*v!i) (i-1) instance ( VectorSpace r , ValidUVector n r , IsScalar r , ExpField r , Real r ) => Banach (UVector (n::Symbol) r) instance ( VectorSpace r , ValidUVector n r , IsScalar r , ExpField r , Real r , OrdField r , MatrixField r , P.Num (HM.Vector r) ) => Hilbert (UVector (n::Symbol) r) where {-# INLINE (<>) #-} v1@(UVector_Dynamic _ _ n)<>v2@(UVector_Dynamic _ _ _) = if isZero n then 0 else go 0 (n-1) where go !tot !i = if i<4 then goEach tot i else go (tot+(v1!(i ) * v2!(i )) +(v1!(i-1) * v2!(i-1)) +(v1!(i-2) * v2!(i-2)) +(v1!(i-3) * v2!(i-3)) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot+(v1!i * v2!i)) (i-1) instance MatrixField r => ToFromVector (UVector (n::Symbol) r) where toVector (UVector_Dynamic _ _ _) = undefined fromVector _ = UVector_Dynamic fp off n where (fp,off,n) = undefined -- VS.unsafeToForeignPtr v instance MatrixField r => Normed (UVector m r +> UVector n r) where size (Id_ r) = r size (Mat_ m) = HM.det m -- | A slightly more convenient type for linear functions between "UVector"s type UMatrix r m n = UVector m r +> UVector n r -- | Construct an "UMatrix" unsafeMkUMatrix :: ( VectorSpace (UVector m r) , VectorSpace (UVector n r) , ToFromVector (UVector m r) , ToFromVector (UVector n r) , MatrixField r , P.Num (HM.Vector r) ) => Int -> Int -> [r] -> UMatrix r m n unsafeMkUMatrix m n rs = Mat_ $ (m HM.>< n) rs instance ( FiniteModule (UVector n r) , VectorSpace (UVector n r) , MatrixField r , ToFromVector (UVector n r) , P.Num (HM.Vector r) ) => TensorAlgebra (UVector n r) where v1><v2 = unsafeMkUMatrix (dim v1) (dim v2) [ v1!i * v2!j | i <- [0..dim v1-1], j <- [0..dim v2-1] ] mXv m v = m $ v vXm v m = trans m $ v -------------------------------------------------------------------------------- -- helper functions for memory management -- | does the foreign pointer equal null? isNull :: ForeignPtr a -> Bool isNull fp = unsafeInlineIO $ withForeignPtr fp $ \p -> (return $ p P.== nullPtr) -- | allocates a ForeignPtr that is filled with n "zero"s zerofp :: forall r. (Storable r, Monoid r) => Int -> IO (ForeignPtr r) zerofp n = do fp <- mallocForeignPtrBytes b withForeignPtr fp $ \p -> go p (n-1) return fp where b = n*sizeOf (undefined::r) go _ (-1) = return () go p i = do pokeElemOff p i zero go p (i-1) -------------------------------------------------------------------------------- -- | The type of dynamic or statically sized vectors implemented using the FFI. data family SVector (n::k) r type instance Scalar (SVector n r) = Scalar r type instance Logic (SVector n r) = Logic r type instance SVector m a >< b = Tensor_SVector (SVector m a) b type family Tensor_SVector a b where Tensor_SVector (SVector n r1) (SVector m r2) = SVector n r1 +> SVector m r2 Tensor_SVector (SVector n r1) r1 = SVector n r1 -- (r1><r2) type ValidSVector n r = ( (SVector n r><Scalar r)~SVector n r, Storable r) type instance Index (SVector n r) = Int type instance Elem (SVector n r) = Scalar r type instance SetElem (SVector n r) b = SVector n b -------------------------------------------------------------------------------- data instance SVector (n::Symbol) r = SVector_Dynamic {-#UNPACK#-}!(ForeignPtr r) {-#UNPACK#-}!Int -- offset {-#UNPACK#-}!Int -- length instance (Show r, Monoid r, ValidSVector n r) => Show (SVector (n::Symbol) r) where show (SVector_Dynamic fp off n) = if isNull fp then "zero" else show $ unsafeInlineIO $ go (n-1) [] where go (-1) xs = return $ xs go i xs = withForeignPtr fp $ \p -> do x <- peekElemOff p (off+i) go (i-1) (x:xs) instance (Arbitrary r, ValidSVector n r, FreeModule r, IsScalar r) => Arbitrary (SVector (n::Symbol) r) where arbitrary = frequency [ (1,return zero) , (9,fmap unsafeToModule $ replicateM 27 arbitrary) ] instance (NFData r, ValidSVector n r) => NFData (SVector (n::Symbol) r) where rnf (SVector_Dynamic fp _ _) = seq fp () instance (FromField r, ValidSVector n r, IsScalar r, FreeModule r) => FromRecord (SVector (n::Symbol) r) where parseRecord r = do rs :: [r] <- parseRecord r return $ unsafeToModule rs --------------------------------------- -- mutable newtype instance Mutable m (SVector (n::Symbol) r) = Mutable_SVector (PrimRef m (SVector (n::Symbol) r)) instance (ValidSVector n r) => IsMutable (SVector (n::Symbol) r) where freeze mv = copy mv >>= unsafeFreeze thaw v = unsafeThaw v >>= copy unsafeFreeze (Mutable_SVector ref) = readPrimRef ref unsafeThaw v = do ref <- newPrimRef v return $ Mutable_SVector ref copy (Mutable_SVector ref) = do (SVector_Dynamic fp1 off1 n) <- readPrimRef ref let b = n*sizeOf (undefined::r) fp2 <- if isNull fp1 then return fp1 else unsafePrimToPrim $ do fp2 <- mallocForeignPtrBytes b withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> copyBytes p2 (plusPtr p1 off1) b return fp2 ref2 <- newPrimRef (SVector_Dynamic fp2 0 n) return $ Mutable_SVector ref2 write (Mutable_SVector ref) (SVector_Dynamic fp2 _ n2) = do (SVector_Dynamic fp1 _ n1) <- readPrimRef ref unsafePrimToPrim $ if -- both ptrs null: do nothing | isNull fp1 && isNull fp2 -> return () -- only fp1 null: allocate memory then copy fp2 over | isNull fp1 && not isNull fp2 -> do fp1' <- mallocForeignPtrBytes b unsafePrimToPrim $ writePrimRef ref (SVector_Dynamic fp1' 0 n2) withForeignPtr fp1' $ \p1 -> withForeignPtr fp2 $ \p2 -> copyBytes p1 p2 b -- only fp2 null: make fp1 null | not isNull fp1 && isNull fp2 -> unsafePrimToPrim $ writePrimRef ref (SVector_Dynamic fp2 0 n1) -- both ptrs valid: perform a normal copy | otherwise -> withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> copyBytes p1 p2 b where b = n2*sizeOf (undefined::r) ---------------------------------------- -- algebra {-# INLINE binopDyn #-} binopDyn :: forall a n. ( Storable a , Monoid a ) => (a -> a -> a) -> SVector (n::Symbol) a -> SVector (n::Symbol) a -> SVector (n::Symbol) a binopDyn f v1@(SVector_Dynamic fp1 off1 n1) v2@(SVector_Dynamic fp2 off2 _) = if | isNull fp1 && isNull fp2 -> v1 | isNull fp1 -> monopDyn (f zero) v2 | isNull fp2 -> monopDyn (\a -> f a zero) v1 | otherwise -> unsafeInlineIO $ do let b = n1*sizeOf (undefined::a) fp3 <- mallocForeignPtrBytes b withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> withForeignPtr fp3 $ \p3 -> go (plusPtr p1 off1) (plusPtr p2 off2) p3 (n1-1) return $ SVector_Dynamic fp3 0 n1 where go _ _ _ (-1) = return () go p1 p2 p3 i = do v1' <- peekElemOff p1 i v2' <- peekElemOff p2 i pokeElemOff p3 i (f v1' v2') go p1 p2 p3 (i-1) {-# INLINE monopDyn #-} monopDyn :: forall a n. ( Storable a ) => (a -> a) -> SVector (n::Symbol) a -> SVector (n::Symbol) a monopDyn f v@(SVector_Dynamic fp1 off1 n) = if isNull fp1 then v else unsafeInlineIO $ do let b = n*sizeOf (undefined::a) fp2 <- mallocForeignPtrBytes b withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> go (plusPtr p1 off1) p2 (n-1) return $ SVector_Dynamic fp2 0 n where go _ _ (-1) = return () go p1 p2 i = do v1 <- peekElemOff p1 i pokeElemOff p2 i (f v1) go p1 p2 (i-1) {-# INLINE binopDynM #-} binopDynM :: forall a b n m. ( PrimBase m , Storable a , Storable b , Monoid a , Monoid b ) => (a -> b -> a) -> Mutable m (SVector (n::Symbol) a) -> SVector n b -> m () binopDynM f (Mutable_SVector ref) (SVector_Dynamic fp2 off2 n2) = do (SVector_Dynamic fp1 off1 n1) <- readPrimRef ref let runop fp1' fp2' n = unsafePrimToPrim $ withForeignPtr fp1' $ \p1 -> withForeignPtr fp2' $ \p2 -> go (plusPtr p1 off1) (plusPtr p2 off2) (n-1) unsafePrimToPrim $ if -- both vectors are zero: do nothing | isNull fp1 && isNull fp2 -> return () -- only left vector is zero: allocate space and overwrite old vector -- FIXME: this algorithm requires two passes over the left vector | isNull fp1 -> do fp1' <- zerofp n2 unsafePrimToPrim $ writePrimRef ref (SVector_Dynamic fp1' 0 n2) runop fp1' fp2 n2 -- only right vector is zero: use a temporary zero vector to run like normal -- FIXME: this algorithm requires an unneeded memory allocation and memory pass | isNull fp2 -> do fp2' <- zerofp n1 runop fp1 fp2' n1 -- both vectors nonzero: run like normal | otherwise -> runop fp1 fp2 n1 where go _ _ (-1) = return () go p1 p2 i = do v1 <- peekElemOff p1 i v2 <- peekElemOff p2 i pokeElemOff p1 i (f v1 v2) go p1 p2 (i-1) {-# INLINE monopDynM #-} monopDynM :: forall a n m. ( PrimMonad m , Storable a ) => (a -> a) -> Mutable m (SVector (n::Symbol) a) -> m () monopDynM f (Mutable_SVector ref) = do (SVector_Dynamic fp1 off1 n) <- readPrimRef ref if isNull fp1 then return () else unsafePrimToPrim $ withForeignPtr fp1 $ \p1 -> go (plusPtr p1 off1) (n-1) where go _ (-1) = return () go p1 i = do v1 <- peekElemOff p1 i pokeElemOff p1 i (f v1) go p1 (i-1) ------------------- instance (Monoid r, ValidSVector n r) => Semigroup (SVector (n::Symbol) r) where {-# INLINE (+) #-} ; (+) = binopDyn (+) {-# INLINE (+=) #-} ; (+=) = binopDynM (+) instance (Monoid r, Cancellative r, ValidSVector n r) => Cancellative (SVector (n::Symbol) r) where {-# INLINE (-) #-} ; (-) = binopDyn (-) {-# INLINE (-=) #-} ; (-=) = binopDynM (-) instance (Monoid r, ValidSVector n r) => Monoid (SVector (n::Symbol) r) where {-# INLINE zero #-} zero = SVector_Dynamic (unsafeInlineIO $ newForeignPtr_ nullPtr) 0 0 instance (Group r, ValidSVector n r) => Group (SVector (n::Symbol) r) where {-# INLINE negate #-} negate v = unsafeInlineIO $ do mv <- thaw v monopDynM negate mv unsafeFreeze mv instance (Monoid r, Abelian r, ValidSVector n r) => Abelian (SVector (n::Symbol) r) instance (Module r, ValidSVector n r, IsScalar r) => Module (SVector (n::Symbol) r) where {-# INLINE (.*) #-} ; (.*) v r = monopDyn (.*r) v {-# INLINE (.*=) #-} ; (.*=) v r = monopDynM (.*r) v instance (FreeModule r, ValidSVector n r, IsScalar r) => FreeModule (SVector (n::Symbol) r) where {-# INLINE (.*.) #-} ; (.*.) = binopDyn (.*.) {-# INLINE (.*.=) #-} ; (.*.=) = binopDynM (.*.) instance (VectorSpace r, ValidSVector n r, IsScalar r) => VectorSpace (SVector (n::Symbol) r) where {-# INLINE (./) #-} ; (./) v r = monopDyn (./r) v {-# INLINE (./=) #-} ; (./=) v r = monopDynM (./r) v {-# INLINE (./.) #-} ; (./.) = binopDyn (./.) {-# INLINE (./.=) #-} ; (./.=) = binopDynM (./.) ---------------------------------------- -- container instance ( Monoid r , ValidLogic r , ValidSVector n r , IsScalar r , FreeModule r ) => IxContainer (SVector (n::Symbol) r) where {-# INLINE (!) #-} (!) (SVector_Dynamic fp off _) i = unsafeInlineIO $ withForeignPtr fp $ \p -> peekElemOff p (off+i) {-# INLINABLE toIxList #-} toIxList v = P.zip [0..] $ go (dim v-1) [] where go (-1) xs = xs go i xs = go (i-1) (v!i : xs) {-# INLINABLE imap #-} imap f v = unsafeToModule $ imap f $ values v type ValidElem (SVector n r) e = (ClassicalLogic e, IsScalar e, FiniteModule e, ValidSVector n e) instance (FreeModule r, ValidLogic r, ValidSVector n r, IsScalar r) => FiniteModule (SVector (n::Symbol) r) where {-# INLINE dim #-} dim (SVector_Dynamic _ _ n) = n {-# INLINABLE unsafeToModule #-} unsafeToModule xs = unsafeInlineIO $ do fp <- mallocForeignPtrArray n withForeignPtr fp $ \p -> go p (P.reverse xs) (n-1) return $ SVector_Dynamic fp 0 n where n = length xs go _ [] (-1) = return () go p (x:xs') i = do pokeElemOff p i x go p xs' (i-1) ---------------------------------------- -- comparison instance (Eq r, Monoid r, ValidSVector n r) => Eq_ (SVector (n::Symbol) r) where {-# INLINE (==) #-} (SVector_Dynamic fp1 off1 n1)==(SVector_Dynamic fp2 off2 n2) = unsafeInlineIO $ if | isNull fp1 && isNull fp2 -> return true | isNull fp1 -> withForeignPtr fp2 $ \p -> checkZero (plusPtr p off2) (n2-1) | isNull fp2 -> withForeignPtr fp1 $ \p -> checkZero (plusPtr p off1) (n1-1) | otherwise -> withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> outer (plusPtr p1 off1) (plusPtr p2 off2) (n1-1) where checkZero :: Ptr r -> Int -> IO Bool checkZero _ (-1) = return true checkZero p i = do x <- peekElemOff p i if isZero x then checkZero p (-1) else return false outer :: Ptr r -> Ptr r -> Int -> IO Bool outer p1 p2 = go where go (-1) = return true go i = do v1 <- peekElemOff p1 i v2 <- peekElemOff p2 i next <- go (i-1) return $ v1==v2 && next ---------------------------------------- -- distances instance ( ValidSVector n r , ExpField r , Normed r , Ord_ r , Logic r~Bool , IsScalar r , VectorSpace r ) => Metric (SVector (n::Symbol) r) where {-# INLINE[2] distance #-} distance v1@(SVector_Dynamic fp1 _ n) v2@(SVector_Dynamic fp2 _ _) = if | isNull fp1 -> size v2 | isNull fp2 -> size v1 | otherwise -> sqrt $ go 0 (n-1) where go !tot !i = if i<4 then goEach tot i else go (tot+(v1!(i ) - v2!(i )) .*. (v1!(i ) - v2!(i )) +(v1!(i-1) - v2!(i-1)) .*. (v1!(i-1) - v2!(i-1)) +(v1!(i-2) - v2!(i-2)) .*. (v1!(i-2) - v2!(i-2)) +(v1!(i-3) - v2!(i-3)) .*. (v1!(i-3) - v2!(i-3)) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot+(v1!i - v2!i) * (v1!i - v2!i)) (i-1) {-# INLINE[2] distanceUB #-} distanceUB v1@(SVector_Dynamic fp1 _ n) v2@(SVector_Dynamic fp2 _ _) ub = if | isNull fp1 -> size v2 | isNull fp2 -> size v1 | otherwise -> sqrt $ go 0 (n-1) where ub2=ub*ub go !tot !i = if tot>ub2 then tot else if i<4 then goEach tot i else go (tot+(v1!(i ) - v2!(i )) .*. (v1!(i ) - v2!(i )) +(v1!(i-1) - v2!(i-1)) .*. (v1!(i-1) - v2!(i-1)) +(v1!(i-2) - v2!(i-2)) .*. (v1!(i-2) - v2!(i-2)) +(v1!(i-3) - v2!(i-3)) .*. (v1!(i-3) - v2!(i-3)) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot+(v1!i - v2!i) * (v1!i - v2!i)) (i-1) instance (VectorSpace r, ValidSVector n r, IsScalar r, ExpField r) => Normed (SVector (n::Symbol) r) where {-# INLINE size #-} size v@(SVector_Dynamic fp _ n) = if isNull fp then 0 else sqrt $ go 0 (n-1) where go !tot !i = if i<4 then goEach tot i else go (tot+v!(i ).*.v!(i ) +v!(i-1).*.v!(i-1) +v!(i-2).*.v!(i-2) +v!(i-3).*.v!(i-3) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot+v!i*v!i) (i-1) instance ( VectorSpace r , ValidSVector n r , IsScalar r , ExpField r , Real r ) => Banach (SVector (n::Symbol) r) instance ( VectorSpace r , ValidSVector n r , IsScalar r , ExpField r , Real r , OrdField r , MatrixField r , P.Num (HM.Vector r) ) => Hilbert (SVector (n::Symbol) r) where {-# INLINE (<>) #-} v1@(SVector_Dynamic fp1 _ _)<>v2@(SVector_Dynamic fp2 _ n) = if isNull fp1 || isNull fp2 then 0 else go 0 (n-1) where go !tot !i = if i<4 then goEach tot i else go (tot+(v1!(i ) * v2!(i )) +(v1!(i-1) * v2!(i-1)) +(v1!(i-2) * v2!(i-2)) +(v1!(i-3) * v2!(i-3)) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot+(v1!i * v2!i)) (i-1) -------------------------------------------------------------------------------- newtype instance SVector (n::Nat) r = SVector_Nat (ForeignPtr r) instance (Show r, ValidSVector n r, KnownNat n) => Show (SVector n r) where show v = show (vec2list v) where n = nat2int (Proxy::Proxy n) vec2list (SVector_Nat fp) = unsafeInlineIO $ go (n-1) [] where go (-1) xs = return $ xs go i xs = withForeignPtr fp $ \p -> do x <- peekElemOff p i go (i-1) (x:xs) instance ( KnownNat n , Arbitrary r , ValidSVector n r , FreeModule r , IsScalar r ) => Arbitrary (SVector (n::Nat) r) where arbitrary = do xs <- replicateM n arbitrary return $ unsafeToModule xs where n = nat2int (Proxy::Proxy n) instance (NFData r, ValidSVector n r) => NFData (SVector (n::Nat) r) where rnf (SVector_Nat fp) = seq fp () static2dynamic :: forall n m r. KnownNat n => SVector (n::Nat) r -> SVector (m::Symbol) r static2dynamic (SVector_Nat fp) = SVector_Dynamic fp 0 $ nat2int (Proxy::Proxy n) newtype instance Mutable m (SVector (n::Nat) r) = Mutable_SVector_Nat (ForeignPtr r) instance (KnownNat n, ValidSVector n r) => IsMutable (SVector (n::Nat) r) where freeze mv = copy mv >>= unsafeFreeze thaw v = unsafeThaw v >>= copy unsafeFreeze (Mutable_SVector_Nat fp) = return $ SVector_Nat fp unsafeThaw (SVector_Nat fp) = return $ Mutable_SVector_Nat fp copy (Mutable_SVector_Nat fp1) = unsafePrimToPrim $ do fp2 <- mallocForeignPtrBytes b withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> copyBytes p2 p1 b return (Mutable_SVector_Nat fp2) where n = nat2int (Proxy::Proxy n) b = n*sizeOf (undefined::r) write (Mutable_SVector_Nat fp1) (SVector_Nat fp2) = unsafePrimToPrim $ withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> copyBytes p1 p2 b where n = nat2int (Proxy::Proxy n) b = n*sizeOf (undefined::r) ---------------------------------------- -- algebra {-# INLINE binopStatic #-} binopStatic :: forall a n. ( Storable a , KnownNat n ) => (a -> a -> a) -> SVector n a -> SVector n a -> SVector n a binopStatic f (SVector_Nat fp1) (SVector_Nat fp2) = unsafeInlineIO $ do fp3 <- mallocForeignPtrBytes b withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> withForeignPtr fp3 $ \p3 -> go p1 p2 p3 (n-1) return $ SVector_Nat fp3 where n = nat2int (Proxy::Proxy n) b = n*sizeOf (undefined::a) go _ _ _ (-1) = return () go p1 p2 p3 i = do x0 <- peekElemOff p1 i y0 <- peekElemOff p2 i pokeElemOff p3 i (f x0 y0) go p1 p2 p3 (i-1) {-# INLINE monopStatic #-} monopStatic :: forall a n. ( Storable a , KnownNat n ) => (a -> a) -> SVector n a -> SVector n a monopStatic f (SVector_Nat fp1) = unsafeInlineIO $ do fp2 <- mallocForeignPtrBytes b withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> go p1 p2 (n-1) return $ SVector_Nat fp2 where n = nat2int (Proxy::Proxy n) b = n*sizeOf (undefined::a) go _ _ (-1) = return () go p1 p2 i = do v1 <- peekElemOff p1 i pokeElemOff p2 i (f v1) go p1 p2 (i-1) {-# INLINE binopStaticM #-} binopStaticM :: forall a b n m. ( PrimMonad m , Storable a , Storable b , KnownNat n ) => (a -> b -> a) -> Mutable m (SVector n a) -> SVector n b -> m () binopStaticM f (Mutable_SVector_Nat fp1) (SVector_Nat fp2) = unsafePrimToPrim $ withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> go p1 p2 (n-1) where n = nat2int (Proxy::Proxy n) go _ _ (-1) = return () go p1 p2 i = do v1 <- peekElemOff p1 i v2 <- peekElemOff p2 i pokeElemOff p1 i (f v1 v2) go p1 p2 (i-1) {-# INLINE monopStaticM #-} monopStaticM :: forall a n m. ( PrimMonad m , Storable a , KnownNat n ) => (a -> a) -> Mutable m (SVector n a) -> m () monopStaticM f (Mutable_SVector_Nat fp1) = unsafePrimToPrim $ withForeignPtr fp1 $ \p1 -> go p1 (n-1) where n = nat2int (Proxy::Proxy n) go _ (-1) = return () go p1 i = do v1 <- peekElemOff p1 i pokeElemOff p1 i (f v1) go p1 (i-1) instance (KnownNat n, Semigroup r, ValidSVector n r) => Semigroup (SVector (n::Nat) r) where {-# INLINE (+) #-} ; (+) = binopStatic (+) {-# INLINE (+=) #-} ; (+=) = binopStaticM (+) instance (KnownNat n, Cancellative r, ValidSVector n r) => Cancellative (SVector (n::Nat) r) where {-# INLINE (-) #-} ; (-) = binopStatic (-) {-# INLINE (-=) #-} ; (-=) = binopStaticM (-) instance (KnownNat n, Monoid r, ValidSVector n r) => Monoid (SVector (n::Nat) r) where {-# INLINE zero #-} zero = unsafeInlineIO $ do mv <- fmap (\fp -> Mutable_SVector_Nat fp) $ mallocForeignPtrArray n monopStaticM (const zero) mv unsafeFreeze mv where n = nat2int (Proxy::Proxy n) instance (KnownNat n, Group r, ValidSVector n r) => Group (SVector (n::Nat) r) where {-# INLINE negate #-} negate v = unsafeInlineIO $ do mv <- thaw v monopStaticM negate mv unsafeFreeze mv instance (KnownNat n, Abelian r, ValidSVector n r) => Abelian (SVector (n::Nat) r) instance (KnownNat n, Module r, ValidSVector n r, IsScalar r) => Module (SVector (n::Nat) r) where {-# INLINE (.*) #-} ; (.*) v r = monopStatic (.*r) v {-# INLINE (.*=) #-} ; (.*=) v r = monopStaticM (.*r) v instance (KnownNat n, FreeModule r, ValidSVector n r, IsScalar r) => FreeModule (SVector (n::Nat) r) where {-# INLINE (.*.) #-} ; (.*.) = binopStatic (.*.) {-# INLINE (.*.=) #-} ; (.*.=) = binopStaticM (.*.) instance (KnownNat n, VectorSpace r, ValidSVector n r, IsScalar r) => VectorSpace (SVector (n::Nat) r) where {-# INLINE (./) #-} ; (./) v r = monopStatic (./r) v {-# INLINE (./=) #-} ; (./=) v r = monopStaticM (./r) v {-# INLINE (./.) #-} ; (./.) = binopStatic (./.) {-# INLINE (./.=) #-} ; (./.=) = binopStaticM (./.) ---------------------------------------- -- "container" instance ( KnownNat n , Monoid r , ValidLogic r , ValidSVector n r , IsScalar r , FreeModule r ) => IxContainer (SVector (n::Nat) r) where {-# INLINE (!) #-} (!) (SVector_Nat fp) i = unsafeInlineIO $ withForeignPtr fp $ \p -> peekElemOff p i {-# INLINABLE toIxList #-} toIxList v = P.zip [0..] $ go (dim v-1) [] where go (-1) xs = xs go i xs = go (i-1) (v!i : xs) {-# INLINABLE imap #-} imap f v = unsafeToModule $ imap f $ values v type ValidElem (SVector n r) e = (ClassicalLogic e, IsScalar e, FiniteModule e, ValidSVector n e) instance ( KnownNat n , FreeModule r , ValidLogic r , ValidSVector n r , IsScalar r ) => FiniteModule (SVector (n::Nat) r) where {-# INLINE dim #-} dim _ = nat2int (Proxy::Proxy n) {-# INLINABLE unsafeToModule #-} unsafeToModule xs = if n /= length xs then error "unsafeToModule size mismatch" else unsafeInlineIO $ do fp <- mallocForeignPtrArray n withForeignPtr fp $ \p -> go p (P.reverse xs) (n-1) return $ SVector_Nat fp where n = nat2int (Proxy::Proxy n) go _ [] (-1) = return () go p (x:xs') i = do pokeElemOff p i x go p xs' (i-1) ---------------------------------------- -- comparison instance (KnownNat n, Eq_ r, ValidLogic r, ValidSVector n r) => Eq_ (SVector (n::Nat) r) where {-# INLINE (==) #-} (SVector_Nat fp1)==(SVector_Nat fp2) = unsafeInlineIO $ withForeignPtr fp1 $ \p1 -> withForeignPtr fp2 $ \p2 -> outer p1 p2 (n-1) where n = nat2int (Proxy::Proxy n) outer p1 p2 = go where go (-1) = return true go i = do v1 <- peekElemOff p1 i v2 <- peekElemOff p2 i next <- go (i-1) return $ v1==v2 && next ---------------------------------------- -- distances instance ( KnownNat n , ValidSVector n r , ExpField r , Normed r , Ord_ r , Logic r~Bool , IsScalar r , VectorSpace r , ValidSVector "dyn" r ) => Metric (SVector (n::Nat) r) where -- For some reason, using the dynamic vector is a little faster than a straight implementation {-# INLINE[2] distance #-} distance v1 v2 = distance (static2dynamic v1) (static2dynamic v2 :: SVector "dyn" r) {-# INLINE[2] distanceUB #-} distanceUB v1 v2 ub = sqrt $ go 0 (n-1) where n = nat2int (Proxy::Proxy n) ub2 = ub*ub go !tot !i = if tot>ub2 then tot else if i<4 then goEach tot i else go (tot+(v1!(i ) - v2!(i )) .*. (v1!(i ) - v2!(i )) +(v1!(i-1) - v2!(i-1)) .*. (v1!(i-1) - v2!(i-1)) +(v1!(i-2) - v2!(i-2)) .*. (v1!(i-2) - v2!(i-2)) +(v1!(i-3) - v2!(i-3)) .*. (v1!(i-3) - v2!(i-3)) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot+(v1!i - v2!i) * (v1!i - v2!i)) (i-1) instance ( KnownNat n , VectorSpace r , ValidSVector n r , IsScalar r , ExpField r ) => Normed (SVector (n::Nat) r) where {-# INLINE size #-} size v = sqrt $ go 0 (n-1) where n = nat2int (Proxy::Proxy n) go !tot !i = if i<4 then goEach tot i else go (tot+v!(i ) .*. v!(i ) +v!(i-1) .*. v!(i-1) +v!(i-2) .*. v!(i-2) +v!(i-3) .*. v!(i-3) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot+v!i*v!i) (i-1) instance ( KnownNat n , VectorSpace r , ValidSVector n r , IsScalar r , ExpField r , Real r , ValidSVector "dyn" r ) => Banach (SVector (n::Nat) r) instance ( KnownNat n , VectorSpace r , IsScalar r , ExpField r , Real r , OrdField r , MatrixField r , ValidSVector n r , ValidSVector "dyn" r , P.Num (HM.Vector r) ) => Hilbert (SVector (n::Nat) r) where {-# INLINE (<>) #-} v1<>v2 = go 0 (n-1) where n = nat2int (Proxy::Proxy n) go !tot !i = if i<4 then goEach tot i else go (tot+(v1!(i ) * v2!(i )) +(v1!(i-1) * v2!(i-1)) +(v1!(i-2) * v2!(i-2)) +(v1!(i-3) * v2!(i-3)) ) (i-4) goEach !tot !i = if i<0 then tot else goEach (tot+(v1!i * v2!i)) (i-1) -------------------------------------------------------------------------------- type MatrixField r = ( IsScalar r , VectorSpace r , Field r , HM.Field r , HM.Container HM.Vector r , HM.Product r ) class ToFromVector a where toVector :: a -> VS.Vector (Scalar a) fromVector :: VS.Vector (Scalar a) -> a instance ToFromVector Double where toVector x = VS.fromList [x] fromVector v = VS.head v instance MatrixField r => ToFromVector (SVector (n::Symbol) r) where toVector (SVector_Dynamic fp off n) = VS.unsafeFromForeignPtr fp off n fromVector v = SVector_Dynamic fp off n where (fp,off,n) = VS.unsafeToForeignPtr v instance (KnownNat n, MatrixField r) => ToFromVector (SVector (n::Nat) r) where toVector (SVector_Nat fp) = VS.unsafeFromForeignPtr fp 0 n where n = nat2int (Proxy::Proxy n) fromVector v = SVector_Nat fp where (fp,_,_) = VS.unsafeToForeignPtr v apMat_ :: ( Scalar a~Scalar b , Scalar b ~ Scalar (Scalar b) , MatrixField (Scalar a) , ToFromVector a , ToFromVector b ) => HM.Matrix (Scalar a) -> a -> b apMat_ m a = fromVector $ HM.flatten $ m HM.<> HM.asColumn (toVector a) data a +> b where Zero :: ( Module a , Module b ) => a +> b Id_ :: ( VectorSpace b ) => !(Scalar b) -> b +> b Mat_ :: ( MatrixField (Scalar b) , Scalar a~Scalar b , Scalar b~Scalar (Scalar b) , VectorSpace a , VectorSpace b , ToFromVector a , ToFromVector b , P.Num (HM.Vector (Scalar a)) ) => {-#UNPACK#-}!(HM.Matrix (Scalar b)) -> a +> b type instance Scalar (a +> b) = Scalar b type instance Logic (a +> b) = Bool type instance (a +> b) >< c = Tensor_Linear (a +> b) c type family Tensor_Linear a b where Tensor_Linear (a +> b) c = a +> b mkMutable [t| forall a b. a +> b |] -- | A slightly more convenient type for linear functions between "SVector"s type SMatrix r m n = SVector m r +> SVector n r -- | Construct an "SMatrix" unsafeMkSMatrix :: ( VectorSpace (SVector m r) , VectorSpace (SVector n r) , ToFromVector (SVector m r) , ToFromVector (SVector n r) , MatrixField r , P.Num (HM.Vector r) ) => Int -> Int -> [r] -> SMatrix r m n unsafeMkSMatrix m n rs = Mat_ $ (m HM.>< n) rs -------------------------------------------------------------------------------- -- instances deriving instance ( MatrixField (Scalar b), Show (Scalar b) ) => Show (a +> b) ---------------------------------------- -- category instance Category (+>) where type ValidCategory (+>) a = MatrixField a id = Id_ 1 Zero . Zero = Zero Zero . (Id_ _ ) = Zero Zero . (Mat_ _ ) = Zero (Id_ _ ) . Zero = Zero (Id_ r1) . (Id_ r2) = Id_ (r1*r2) (Id_ r ) . (Mat_ m ) = Mat_ $ HM.scale r m (Mat_ _) . Zero = Zero (Mat_ m ) . (Id_ r ) = Mat_ $ HM.scale r m (Mat_ m1) . (Mat_ m2) = Mat_ $ m1 HM.<> m2 instance Sup (+>) (->) (->) instance Sup (->) (+>) (->) instance (+>) <: (->) where embedType_ = Embed2 (embedType2 go) where go :: a +> b -> a -> b go Zero = zero go (Id_ r) = (r*.) go (Mat_ m) = apMat_ m instance Dagger (+>) where trans Zero = Zero trans (Id_ r) = Id_ r trans (Mat_ m) = Mat_ $ HM.tr' m instance Groupoid (+>) where inverse Zero = undefined inverse (Id_ r) = Id_ $ reciprocal r inverse (Mat_ m) = Mat_ $ HM.inv m ---------------------------------------- -- size -- FIXME: what's the norm of a tensor? instance MatrixField r => Normed (SVector m r +> SVector n r) where size Zero = zero size (Id_ r) = r size (Mat_ m) = HM.det m ---------------------------------------- -- algebra instance Semigroup (a +> b) where Zero + a = a a + Zero = a (Id_ r1) + (Id_ r2) = Id_ (r1+r2) (Id_ r ) + (Mat_ m ) = Mat_ $ HM.scale r (HM.ident (HM.rows m)) P.+ m (Mat_ m ) + (Id_ r ) = Mat_ $ m P.+ HM.scale r (HM.ident (HM.rows m)) (Mat_ m1) + (Mat_ m2) = Mat_ $ m1 P.+ m2 instance (VectorSpace a, VectorSpace b) => Monoid (a +> b) where zero = Zero instance (VectorSpace a, VectorSpace b) => Cancellative (a +> b) where a - Zero = a Zero - a = negate a (Id_ r1) - (Id_ r2) = Id_ (r1-r2) (Id_ r ) - (Mat_ m ) = Mat_ $ HM.scale r (HM.ident (HM.rows m)) P.- m (Mat_ m ) - (Id_ r ) = Mat_ $ m P.- HM.scale r (HM.ident (HM.rows m)) (Mat_ m1) - (Mat_ m2) = Mat_ $ m1 P.- m2 instance (VectorSpace a, VectorSpace b) => Group (a +> b) where negate Zero = Zero negate (Id_ r) = Id_ $ negate r negate (Mat_ m) = Mat_ $ HM.scale (-1) m instance Abelian (a +> b) ------------------- -- modules instance (VectorSpace a, VectorSpace b) => Module (a +> b) where Zero .* _ = Zero (Id_ r1) .* r2 = Id_ $ r1*r2 (Mat_ m) .* r2 = Mat_ $ HM.scale r2 m instance (VectorSpace a, VectorSpace b) => FreeModule (a +> b) where Zero .*. _ = Zero _ .*. Zero = Zero (Id_ r1) .*. (Id_ r2) = Id_ $ r1*r2 (Id_ r ) .*. (Mat_ m ) = Mat_ $ HM.scale r (HM.ident (HM.rows m)) P.* m (Mat_ m ) .*. (Id_ r ) = Mat_ $ m P.* HM.scale r (HM.ident (HM.rows m)) (Mat_ m1) .*. (Mat_ m2) = Mat_ $ m1 P.* m2 instance (VectorSpace a, VectorSpace b) => VectorSpace (a +> b) where Zero ./. _ = Zero (Id_ _) ./. Zero = undefined (Mat_ _) ./. Zero = undefined (Id_ r1) ./. (Id_ r2) = Id_ $ r1/r2 (Id_ r ) ./. (Mat_ m ) = Mat_ $ (HM.scale r (HM.ident (HM.rows m))) P./ m (Mat_ m ) ./. (Id_ r ) = Mat_ $ m P./ HM.scale r (HM.ident (HM.rows m)) (Mat_ m1) ./. (Mat_ m2) = Mat_ $ m1 P./ m2 ------------------- -- rings -- -- NOTE: matrices are only a ring when their dimensions are equal instance VectorSpace a => Rg (a +> a) where (*) = (>>>) instance VectorSpace a => Rig (a +> a) where one = Id_ one instance VectorSpace a => Ring (a +> a) where fromInteger i = Id_ $ fromInteger i instance VectorSpace a => Field (a +> a) where fromRational r = Id_ $ fromRational r reciprocal Zero = undefined reciprocal (Id_ r ) = Id_ $ reciprocal r reciprocal (Mat_ m) = Mat_ $ HM.inv m instance ( FiniteModule (SVector n r) , VectorSpace (SVector n r) , MatrixField r , ToFromVector (SVector n r) , P.Num (HM.Vector r) ) => TensorAlgebra (SVector n r) where v1><v2 = unsafeMkSMatrix (dim v1) (dim v2) [ v1!i * v2!j | i <- [0..dim v1-1], j <- [0..dim v2-1] ] mXv m v = m $ v vXm v m = trans m $ v
[STATEMENT] lemma rel_\<I>I [intro?]: "\<lbrakk> rel_set C (outs_\<I> \<I>1) (outs_\<I> \<I>2); \<And>x y. C x y \<Longrightarrow> rel_set R (responses_\<I> \<I>1 x) (responses_\<I> \<I>2 y) \<rbrakk> \<Longrightarrow> rel_\<I> C R \<I>1 \<I>2" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>rel_set C (outs_\<I> \<I>1) (outs_\<I> \<I>2); \<And>x y. C x y \<Longrightarrow> rel_set R (responses_\<I> \<I>1 x) (responses_\<I> \<I>2 y)\<rbrakk> \<Longrightarrow> rel_\<I> C R \<I>1 \<I>2 [PROOF STEP] by transfer(auto simp add: rel_fun_def)
State Before: α β : Type u c : Cardinal f : α → β hf : ∀ (b : β), (#↑(f ⁻¹' {b})) ≤ c ⊢ (#α) ≤ (#β) * c State After: no goals Tactic: simpa only [← mk_congr (@Equiv.sigmaFiberEquiv α β f), mk_sigma, ← sum_const'] using sum_le_sum _ _ hf
function [A,varargout] = selectMaxbyColumn(A,varargin) % find maximum in each row % find maximum values ind = A == repmat(max(A,[],1),size(A,1),1); % select only the first maximum ind = ind & ind == cumsum(ind,1); % return results A = A(ind); for i = 1:nargout-1 varargout{i} = varargin{i}(ind); end
lemma order_pderiv: "order a p = Suc (order a (pderiv p))" if "pderiv p \<noteq> 0" "order a p \<noteq> 0" for p :: "'a::field_char_0 poly"
-- vim: ts=2 sw=0 sts=-1 et ai tw=70 import .lt namespace hidden namespace mynat def divides (m n: mynat) := ∃ k: mynat, n = k * m instance: has_dvd mynat := ⟨divides⟩ -- gosh, how do you define gcd? -- you should be able to define it using Euclid's algorithm and total -- ordering of ≤ /- def gcd: mynat → mynat → mynat | m 0 := m | m n := if m ≤ n then gcd m (n - m) -/ variables {m n k p: mynat} @[trans] theorem dvd_trans: m ∣ n → n ∣ k → m ∣ k := begin assume hmn hnk, cases hmn with a ha, cases hnk with b hb, existsi a * b, rw [hb, ha, ←mul_assoc, mul_comm b a], end theorem dvd_zero: m ∣ 0 := begin existsi (0: mynat), rw zero_mul, end theorem zero_dvd: 0 ∣ m → m=0 := begin assume h, cases h with k hk, rw mul_zero at hk, from hk, end theorem one_dvd: 1 ∣ m := begin existsi m, refl, end -- Allows resolving goals of form m ∣ m by writing refl @[refl] theorem dvd_refl: m ∣ m := begin existsi (1: mynat), rw one_mul, end -- basically just a massive case bash to show that m and n can't be 0 or succ -- succ of something theorem one_unit: m * n = 1 → m = 1 := begin cases m, repeat {rw zz}, rw zero_mul, assume h01, from h01, cases n, repeat {rw zz}, rw [succ_mul, mul_zero, add_zero], assume h01, cases h01, cases m, repeat {rw zz}, rw [mul_succ, succ_mul, zero_mul, zero_add], assume _, refl, cases n, repeat {rw zz}, rw [mul_succ, succ_mul, succ_mul, mul_zero], repeat {rw add_zero}, assume hssm, from hssm, -- this is the most contradictory thing I've ever seen in my life. surely -- there's a less overkill way repeat {rw succ_mul}, repeat {rw mul_succ}, repeat {rw add_succ}, rw ←one_eq_succ_zero, assume hssssssss, exfalso, from succ_ne_zero (succ_inj hssssssss), end theorem dvd_antisymm: m ∣ n → n ∣ m → m = n := begin assume hmn hnm, cases hmn with a ha, cases hnm with b hb, cases n, rw hb, refl, have hab1: a * b = 1, rw hb at ha, rw ←mul_assoc at ha, -- arghh rw ←mul_one (succ n) at ha, rw mul_comm (a * b) _ at ha, rw mul_assoc at ha, have hab := mul_cancel succ_ne_zero ha, rw one_mul at hab, symmetry, assumption, have ha1 := one_unit hab1, rw [ha, ha1, one_mul], end theorem dvd_mul (n: mynat): k ∣ m → k ∣ m * n := begin assume hkm, cases hkm with a ha, existsi a * n, rw ha, repeat {rw mul_assoc}, rw mul_comm k n, end theorem dvd_multiple: k ∣ n * k := begin rw mul_comm, apply dvd_mul, refl, end theorem dvd_add: k ∣ m → k ∣ m + k := begin assume hkm, cases hkm with n hn, rw hn, existsi n + 1, simp, end theorem dvd_cancel: k ∣ m + k → k ∣ m := begin assume hkmk, cases hkmk with n hn, cases n, cases k, rw zz at *, simp at hn, rw hn, rw zz at *, rw [zero_mul, add_comm] at hn, exfalso, from succ_ne_zero (add_integral hn), existsi n, rw succ_mul at hn, repeat {rw add_comm _ k at hn}, from add_cancel hn, end theorem dvd_add_lots: k ∣ m → k ∣ m + k * n := begin induction n with n_n n_ih, simp, cc, simp, assume hkm, rw [add_comm k _, ←add_assoc], apply dvd_add _, from n_ih hkm, end theorem dvd_cancel_lots: k ∣ m + k * n → k ∣ m := begin induction n with n_n n_ih, simp, cc, simp, rw [add_comm k _, ←add_assoc], assume hkmksn, apply n_ih, from dvd_cancel hkmksn, end theorem dvd_sum: k ∣ m → k ∣ n → k ∣ m + n := begin assume hm hn, cases hn with a ha, rw [ha, mul_comm], apply dvd_add_lots, assumption, end theorem lt_ndvd: m ≠ 0 → m < n → ¬n ∣ m := begin assume hmnz hmn hndm, cases (le_total_order m n), cases h with d hd, cases d, rw [zz, add_zero] at hd, rw hd at hmn, from hmn le_refl, rw hd at hndm, cases hndm with a ha, cases a, simp at ha, from hmnz ha, rw succ_mul at ha, rw (by ac_refl : a * (m + d.succ) + (m + d.succ) = m + (d.succ + a * (m + d.succ))) at ha, have hs0 := add_cancel_to_zero ha, rw succ_add at hs0, from succ_ne_zero hs0, cases h with d hd, cases d, simp at hd, rw hd at hmn, from hmn le_refl, rw hd at hmn, simp at hmn, have hcontr: n ≤ succ (n + d), existsi succ d, simp, from hmn hcontr, end theorem dvd_le: n ≠ 0 → m ∣ n → m ≤ n := begin assume hnn0 hmdvdn, cases (le_total_order m n), assumption, cases hmdvdn with k hk, cases h with a ha, rw ha at hk, cases a, existsi (0: mynat), simp [ha], simp at hk, cases k, simp at hk, contradiction, rw succ_mul at hk, rw (by ac_refl : k.succ + (k * n + n + k.succ * a) = n + (k.succ + (k * n + k.succ * a))) at hk, rw succ_add at hk, exfalso, from succ_ne_zero (add_cancel_to_zero hk), end theorem dvd_one: m ∣ 1 → m = 1 := begin assume hm1, from dvd_antisymm hm1 one_dvd, end -- Reorder variables -- have decided not to make implicit because it's too much of a headache theorem dvd_remainder (m k n j : mynat): j ∣ m → j ∣ n → m + k = n → j ∣ k := begin assume hjm hjn hmkn, rw ←hmkn at hjn, cases hjm with a ha, rw ha at hjn, rw add_comm at hjn, rw mul_comm at hjn, from dvd_cancel_lots hjn, end -- Useful for e.g. infinitude of primes theorem dvd_succ_too: k ∣ m → k ∣ succ m → k=1 := begin assume hm hsucc, cases hm with a ha, cases hsucc with b hb, rw [←add_one_succ, ha] at hb, rw mul_comm a at hb, rw mul_comm b at hb, suffices : k ∣ 1, exact dvd_one this, apply dvd_remainder (k * a) 1 (k * b) k, apply dvd_mul a, refl, apply dvd_mul b, refl, assumption, end theorem dvd_succ: m ∣ succ m → m=1 := begin assume h, have : m ∣ m, refl, apply dvd_succ_too, refl, assumption, end end mynat end hidden
import numpy as np import numpy.random as npr import matplotlib.pyplot as plt from pybasicbayes.util.text import progprint_xrange from pylds.models import DefaultLDS npr.seed(0) # Set parameters D_obs = 1 D_latent = 2 D_input = 1 T = 2000 # Simulate from one LDS truemodel = DefaultLDS(D_obs, D_latent, D_input) inputs = np.random.randn(T, D_input) data, stateseq = truemodel.generate(T, inputs=inputs) # Fit with another LDS input_model = DefaultLDS(D_obs, D_latent, D_input) input_model.add_data(data, inputs=inputs) # Fit a separate model without the inputs noinput_model = DefaultLDS(D_obs, D_latent, D_input=0) noinput_model.add_data(data) # Run the Gibbs sampler def update(model): model.resample_model() return model.log_likelihood() input_lls = [update(input_model) for _ in progprint_xrange(100)] noinput_lls = [update(noinput_model) for _ in progprint_xrange(100)] # Plot the log likelihoods plt.figure() plt.plot(input_lls, label="with inputs") plt.plot(noinput_lls, label="wo inputs") plt.xlabel('iteration') plt.ylabel('training likelihood') plt.legend() # Predict forward in time T_given = 1800 T_predict = 200 given_data= data[:T_given] given_inputs = inputs[:T_given] preds = \ input_model.sample_predictions( given_data, inputs=given_inputs, Tpred=T_predict, inputs_pred=inputs[T_given:T_given + T_predict]) # Plot the predictions plt.figure() plt.plot(np.arange(T), data, 'b-', label="true") plt.plot(T_given + np.arange(T_predict), preds, 'r--', label="prediction") ylim = plt.ylim() plt.plot([T_given, T_given], ylim, '-k') plt.xlabel('time index') plt.xlim(max(0, T_given - 200), T) plt.ylabel('prediction') plt.ylim(ylim) plt.legend() # Smooth the data input_ys = input_model.smooth(data, inputs) noinput_ys = noinput_model.smooth(data) plt.figure() plt.plot(data, 'b-', label="true") plt.plot(input_ys, 'r-', lw=2, label="with input") plt.xlabel("Time") plt.xlim(max(0, T_given-200), T) plt.ylabel("Smoothed Data") plt.legend() plt.show()
# Lab 4: Solving ODE ```python # IMPORTS import numpy as np import matplotlib.pyplot as plt ``` ## Exercise 1 ### Part 1 Write a function for Euler methods. ```python ``` ### Part 2 Write a test for your Euler function ```python ``` ## Exercise 2 ### Part 1 Write a function for Runge Kutta 4 methods. ```python ``` ### Part 2 Write a test for your Runge Kutta 4 function ```python ``` ## Exercise 3 Use Euler/RK4's method to approximate/plot the solutions for each of the following initial-value problems. (Plot your solution for all the values of t) 1. $y'=e^{t-y}$, $0\leq t \leq 1$, $y(0)=1$, with $h=0.5$ 2. $y'=\frac{1+t}{1+y}$, $1\leq t \leq 2$, $y(1)=2$, with $h=0.5$ 3. $y' = t^{-2}(\sin2t - 2ty)$, $1 \leq t \leq 2$, $y(l) = 2$, with $h = 0.25 $ 4. $ y' = 1+\frac{y}{t},\; 1 < t < 2, \; y(1) = 2$, with $h=0.25$ ```python ``` ## Exercise 4 Use Euler/RK4's method to approximate/plot the solutions for each of the following initial-value problem. $$ y'= \frac{2-2ty}{t^2+1}, ~~~~ 1\leq t \leq 2, ~~~~ y(1)=2, ~~~~ h=0.25$$ The actual solutions to die initial-value is given here. Compute/plot the actual error of your approximation and bound the error. $$y(t)=\frac{2t+2}{t^2+1}$$ ```python ``` ## Exercise 5 Given the initial-value problem $$y'=-y+t+1, \; 0 \leq t \leq 5, \; y(0)=1$$ The exact solution is $y(t)=e^{-t}+t$. Approximate y(6) using Euler/RK4's method with h = 0.2, h =0.1, and h = 0.05. ```python ``` ### Exericse 6 Lokta-Volterra Equations: $$\begin{cases} & \displaystyle{\frac{dx}{dt} = \alpha x - \beta xy } \\ & \displaystyle{\frac{dy}{dt} = \delta xy - \gamma y} \end{cases}$$ where * x is the number of prey * y is the number of some predator * $\alpha$, $\beta$, $\gamma$, $delta$ are positive real parameters describing the interaction of the two species. * The prey are assumed to have an unlimited food supply and to reproduce exponentially, unless subject to predation; this exponential growth is represented in the equation above by the term $\alpha x$. * The rate of predation upon the prey is represented above by $\beta xy$. If either x or y is zero, then there can be no predation. * $\delta xy$ represents the growth of the predator population. * $\gamma y$ represents the loss rate of the predators due to either natural death or emigration, it leads to an exponential decay in the absence of prey 1. Solve the Lokta-Volterra equations with the 4 different methods, with $\alpha= 2/3$, $\beta = 4/3$, $\gamma = 1 = \delta$ 2. Try another cool set of value and solve it. ```python ``` ## Exercise 7 Competitive Lotka–Volterra equations. 4 species competing for the same resource: $$\frac{dx_i}{dt}=r_ix_i\left(1-\sum_{j=1}^4 \alpha_{ij}x_j\right) \mbox{ for } i=1,2,3,4 $$ * $r_{i}$ is the rate at which the species $i$ reproduce. * $\alpha_{ij}$ represents the effect species j has on the population of species i. 1. Solve the Competitive Lokta-Volterrra equations with $$r = \begin{bmatrix} 1\\0.72\\1.53\\1.27 \end{bmatrix}, \enspace \alpha=\begin{bmatrix} 1 & 1.09 & 1.52 & 0\\ 0& 1 & 0.44 & 1.36 \\ 2.33 & 0 & 1 & 0.47 \\ 1.21 & 0.51 & 0.35 & 1\\ \end{bmatrix}$$ 2. Solve another cool one. ```python ``` ## Exercise 8(COVID) Pick the data from a state or country on [John Hopkins's Github](https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data), [John Hopkins dashboard](https://coronavirus.jhu.edu/map.html), [New York Time](https://www.nytimes.com/interactive/2021/us/covid-cases.html), [WHP](https://covid19.who.int/), and solve the SIRD model. * $S(t)$: the number of individuals susceptible of contracting the infection at time $t$, * $I(t)$: the number of individuals that are alive and infected at time t; * $R(t)$: the cumulative number of individuals that recovered from the disease up to time t; * $D(t)$: the cumulative number of individuals that deceased due to the disease, up to time t. In addition, $N$ is the total number of people in the area at time $t$ with $N = S(t) + I(t) + R(t)$. The SIRD model is given by the following expressions \cite{bai75}: \begin{equation} \begin{split} \dfrac{dS}{dt} &= -\frac{\beta I S}{N}, \\ \dfrac{dI}{dt} &= \frac{\beta I S}{N} - \gamma I - \mu I,\\ \dfrac{dR}{dt} &= \gamma I,\\ \dfrac{dD}{dt} &= \mu I, \end{split} \end{equation} Pick $\beta$ between $0$ and $1$, $\gamma=1/14$, $\mu$ between $0$ and $0.05$. ```python ```
module STLC.Examples where -- This file contains a few example programs for the definitional -- interpreter for STLC in Section 2. open import Data.Maybe.Base open import Data.List.Base open import Data.List.Relation.Unary.Any open import Data.List.Relation.Unary.All open import Data.List.Membership.Propositional open import Data.Integer hiding (suc) open import Relation.Binary.PropositionalEquality -- for de Bruijn numerals open import STLC.Semantics -- The identity function: λ x . x -- -- Variables are represented as de Bruijn indices, assumed to have -- been elaborated from a surface language with names to the nameless -- representation used in the abstract syntax in `STLC.Semantics`. idexpr : Expr [] (unit ⇒ unit) idexpr = ƛ (var (here refl)) -- id () = () test-idexpr : eval 2 (idexpr · unit) [] ≡ just unit test-idexpr = refl -- curried addition: λ x . λ y . y + x curry+ : Expr [] (int ⇒ (int ⇒ int)) curry+ = ƛ (ƛ (iop _+_ (var (here refl)) (var (there (here refl))))) -- 1 + 1 = 2 test-curry+ : eval 3 ((curry+ · (num (+ 1))) · (num (+ 1))) [] ≡ just (num (+ 2)) test-curry+ = refl
library(animation) x <- c(1,2,3,5,6,9) ani.options(interval = 1,ani.height = 1000,ani.width = 1000) saveGIF({ for(i in 1:length(x)){ plot(x,rep(0,length(x)), pch = 20,cex = 3, axes = FALSE, xlab = "", ylab = "") abline(h = 0) text(x = x, y = rep(0.1,length(x)), c(expression(x[1]),expression(x[2]),expression(x[3]), expression(x[4]),expression(x[5]),expression(x[6])), cex = 2) text(x = x, y = rep(-0.1,length(x)),x,cex = 2) arrows(mean(x),-0.75,mean(x),0,length = 0.2,lwd = 2) text(mean(x),-0.85,expression(paste(mu[x], "(central value)")),cex = 1.5) text(mean(x),-0.95,paste("=",bquote(.(round(mean(x),2)))),cex = 1.5) arrows(7,0.75,x[4:6],0.2,length = 0.2,lwd = 2,lty = c(2,1,1)) text(7,0.9,"Possible values of X",cex = 1.5) ##legend("topleft",bty = "n", legend = expression(paste("Var(X) = E[(X -",mu[X],")",""^2,"]")),cex = 1.3) arrows(mean(x),-0.25,x[i],-0.25,length = 0.1,code = 3,lwd = 2) text(mean(c(x[i],mean(x))),-0.3,bquote(x[.(i)] - mu[X]),cex = 2) text(mean(c(x[i],mean(x))),-0.4, paste("=",bquote(.(round(x[i] - mean(x),2)))),cex = 1.5) text(1.5,0.6,bquote((x[.(i)] - mu[X])^2),cex = 2) text(2.5,0.6, paste("=",bquote(.(round((x[i] - mean(x))^2,2)))),cex = 2) }}, movie.name = "var.gif" )
module SizedIO.IOGraphicsLib where {-# FOREIGN GHC import qualified Graphics.SOE #-} {-# FOREIGN GHC import qualified Graphics.Rendering.OpenGL #-} {-# FOREIGN GHC import qualified GHC.Int #-} {-# FOREIGN GHC import qualified Foreign.C.Types #-} open import Data.Bool.Base open import Data.Char.Base open import Data.Nat.Base hiding (_+_) open import Data.List.Base as L open import Data.Integer.Base open import Data.Product open import Data.Maybe.Base open import Size renaming (Size to AgdaSize) open import SizedIO.Base open import NativeIO open import NativeInt AgdaPoint = (ℤ × ℤ) postulate Window : Set -- {-# COMPILED_TYPE Window Graphics.SOE.Window #-} postulate Size : Set -- {-# COMPILED_TYPE Size Graphics.SOE.Size #-} postulate size : ℤ → ℤ → Size -- {-# COMPILED size (\ x y -> ( (fromInteger x) :: Int, (fromInteger y) :: Int) :: Graphics.SOE.Size) #-} postulate Point : Set -- {-# COMPILED_TYPE Point Graphics.SOE.Point #-} postulate nativePoint : ℤ → ℤ → Point -- {-# COMPILED nativePoint (\ x y -> (fromInteger x, fromInteger y)::Graphics.SOE.Point) #-} postulate nativeProj1Point : Point → ℤ postulate nativeProj2Point : Point → ℤ -- {-# COMPILED nativeProj1Point (\(x, y) -> toInteger x) #-} -- {-# COMPILED nativeProj2Point (\(x, y) -> toInteger y) #-} {- toNativePoint : Point → NativePoint toNativePoint (x , y) = nativePoint x y -} data Event : Set where Key : Char → Bool → Event Button : Point → Bool → Bool → Event MouseMove : Point → Event Resize : Event Closed : Event -- {-# COMPILED_DATA Event Graphics.SOE.Event Graphics.SOE.Key Graphics.SOE.Button Graphics.SOE.MouseMove Graphics.SOE.Resize Graphics.SOE.Closed #-} postulate nativeMaybeGetWindowEvent : Window → NativeIO (Maybe Event) -- {-# COMPILED nativeMaybeGetWindowEvent Graphics.SOE.maybeGetWindowEvent #-} postulate nativeGetWindowEvent : Window → NativeIO (Event) -- {-# COMPILED nativeGetWindowEvent Graphics.SOE.getWindowEvent #-} postulate Graphic : Set -- {-# COMPILED_TYPE Graphic Graphics.SOE.Graphic #-} postulate nativeDrawInWindow : Window → Graphic → NativeIO Unit -- {-# COMPILED nativeDrawInWindow Graphics.SOE.drawInWindow #-} postulate Word32 : Set -- {-# COMPILED_TYPE Word32 Graphics.SOE.Word32 #-} postulate text : Point → String → Graphic -- {-# COMPILED text (\ p s -> Graphics.SOE.text p (Data.Text.unpack s)) #-} data RedrawMode : Set where -- (removed from lib where: DoubleBuffered : RedrawMode, Unbuffered : RedrawMode) -- {-# COMPILED_DATA RedrawMode Graphics.SOE.RedrawMode #-} postulate nativeDrawGraphic : RedrawMode -- {-# COMPILED nativeDrawGraphic Graphics.SOE.drawGraphic #-} postulate nativeDrawBufferedGraphic : RedrawMode -- {-# COMPILED nativeDrawBufferedGraphic Graphics.SOE.drawBufferedGraphic #-} postulate nativeOpenWindow : String → Size → NativeIO Window -- {-# COMPILED nativeOpenWindow (\ s -> Graphics.SOE.openWindow (Data.Text.unpack s)) #-} postulate nativeOpenWindowEx : String → (Maybe Point) → (Maybe Size) → RedrawMode → (Maybe Word32) → NativeIO Window -- {-# COMPILED nativeOpenWindowEx (\s -> Graphics.SOE.openWindowEx (Data.Text.unpack s)) #-} nativeOpenWindowExNat : String → (Maybe Point) → ℕ → ℕ → RedrawMode → (Maybe Word32) → NativeIO Window nativeOpenWindowExNat s p n1 n2 a b = nativeOpenWindowEx s p (just (size (+ n1) (+ n2))) a b postulate nativeCloseWindow : Window → NativeIO Unit -- {-# COMPILED nativeCloseWindow Graphics.SOE.closeWindow #-} postulate nativeRunGraphics : NativeIO Unit → NativeIO Unit -- {-# COMPILED nativeRunGraphics Graphics.SOE.runGraphics #-} postulate word32ToInteger : Word32 → ℤ -- {-# COMPILED word32ToInteger (\w -> toInteger (Graphics.SOE.word32ToInt w)) #-} postulate nativeTimeGetTime : NativeIO Word32 -- {-# COMPILED nativeTimeGetTime Graphics.SOE.timeGetTime #-} data Color : Set where black : Color blue : Color green : Color cyan : Color red : Color magenta : Color yellow : Color white : Color -- {-# COMPILED_DATA Color Graphics.SOE.Color Graphics.SOE.Black Graphics.SOE.Blue Graphics.SOE.Green Graphics.SOE.Cyan Graphics.SOE.Red Graphics.SOE.Magenta Graphics.SOE.Yellow Graphics.SOE.White #-} postulate withColor : Color → Graphic → Graphic -- {-# COMPILED withColor Graphics.SOE.withColor #-} postulate polygon : List Point → Graphic -- {-# COMPILED polygon Graphics.SOE.polygon #-} {- polygon : List Point → Graphic polygon l = nativePolygon (L.map toNativePoint l) -} data GraphicsCommands : Set where closeWindow : Window → GraphicsCommands maybeGetWindowEvent : Window → GraphicsCommands getWindowEvent : Window → GraphicsCommands openWindowNotEx : String → Size → GraphicsCommands openWindow : String → (Maybe Point) → ℕ → ℕ → RedrawMode → (Maybe Word32) → GraphicsCommands timeGetTime : GraphicsCommands drawInWindow : Window → Graphic → GraphicsCommands print : String → GraphicsCommands GraphicsResponses : GraphicsCommands → Set GraphicsResponses (maybeGetWindowEvent w) = Maybe Event GraphicsResponses (getWindowEvent w) = Event GraphicsResponses (closeWindow w) = Unit GraphicsResponses (openWindowNotEx s s') = Window GraphicsResponses (openWindow s n1 n2 s' r w) = Window GraphicsResponses timeGetTime = Word32 GraphicsResponses _ = Unit GraphicsInterface : IOInterface Command GraphicsInterface = GraphicsCommands Response GraphicsInterface = GraphicsResponses IOGraphics : AgdaSize → Set → Set IOGraphics i = IO GraphicsInterface i IOGraphics+ : AgdaSize → Set → Set IOGraphics+ i = IO+ GraphicsInterface i translateIOGraphicsLocal : (c : GraphicsCommands) → NativeIO (GraphicsResponses c) translateIOGraphicsLocal (maybeGetWindowEvent w) = nativeMaybeGetWindowEvent w translateIOGraphicsLocal (getWindowEvent w) = nativeGetWindowEvent w translateIOGraphicsLocal (closeWindow w) = nativeCloseWindow w translateIOGraphicsLocal (openWindowNotEx str size) = nativeOpenWindow str size translateIOGraphicsLocal (openWindow str point n1 n2 mode word) = nativeOpenWindowExNat str point n1 n2 mode word translateIOGraphicsLocal timeGetTime = nativeTimeGetTime translateIOGraphicsLocal (drawInWindow w g) = nativeDrawInWindow w g translateIOGraphicsLocal (print s) = nativePutStrLn s translateIOGraphics : {A : Set} → IOGraphics ∞ A → NativeIO A translateIOGraphics = translateIO translateIOGraphicsLocal
# pylint: disable=invalid-name """ Configuration for experiment 1q_XY - 1-qubit, Control on X and Y -Axes, No Noise """ from numpy import array from ..utilities.constants import pauli_operators dimension = 2 evolution_time = 1 num_time_steps = 1024 omega = 12 dynamic_operators = [0.5*pauli_operators[1], 0.5*pauli_operators[2]] static_operators = [0.5*pauli_operators[3]*omega] noise_operators = [0.5*pauli_operators[1], 0.5*pauli_operators[3]] initial_states = [ array([[0.5, 0.5], [0.5, 0.5]]), array([[0.5, -0.5], [-0.5, 0.5]]), array([[0.5, -0.5j], [0.5j, 0.5]]), array([[0.5, 0.5j], [-0.5j, 0.5]]), array([[1, 0], [0, 0]]), array([[0, 0], [0, 1]]) ] measurement_operators = pauli_operators[1:] num_pulses = 5 noise_profile = ['Type 0', 'Type 0']
State Before: x✝ y✝ z x : ℝ hx : x ≠ 0 y : ℝ n : ℕ ⊢ x ^ (y - ↑n) = x ^ y / x ^ n State After: no goals Tactic: simpa using rpow_add_int hx y (-n)
lemma (in algebra) smallest_ccdi_sets_Int: assumes b: "b \<in> smallest_ccdi_sets \<Omega> M" shows "a \<in> smallest_ccdi_sets \<Omega> M \<Longrightarrow> a \<inter> b \<in> smallest_ccdi_sets \<Omega> M"
The UC Davis School of Law teaches law. From its founding class in 1966 whose students were actively involved in legal, political and social debates of the late sixties to its current student body, King Hall has been actively focused on public interest issues and is today recognized for that heritage. King Hall has moved to the forefront of legal education in the United States, establishing accreditation from the American Bar Association, membership in the Association of American Law Schools, and recognition from the Order of Coif, the national honor society for lawyers. It is one of the highest ranked small public law schools in the United States and is regarded as the best law school established in the last fifty years, consistently ranked by U.S. News & World Report in the firsttier of law schools since the inception of the national rankings. The schools diverse student body sits among the top ten small public law schools in the US when it comes to diversity. Generally, California law schools are amongst the finest in the nation and towards the top of this list are the four renowned UC System University of California law schools: the School of Law at UC Davis (King Hall), Boalt Hall School of Law at UC Berkeley, UCLA School of Law, wiki:sf:Hastings College of Law, and UC Irvine School of Law, which opened in fall of 2009. Of the five UC law schools, UC Davis is generally regarded as the third most prestigious school, closely following Berkeley and UCLA. Despite the notoriously difficult California State Bar Exam, King Hall boasts one of the nations highest bar average passage rates over the last twenty years. In fact, it took Governor Jerry Brown (Yale) two attempts while former Governor Pete Wilson (Boalt) had to try four times! Mayor Antonio R. Villaraigosa (Peoples College of Law, unaccredited) of Los Angeles never managed to pass after failing four times. Areas in which King Hall excels include International Law, Environmental Law, Business Law, Intellectual Property Law, Human Rights & Social Justice Law, Public Interest Law and Immigration & Civil Rights Law. King Hall FAQ http://faqs.netesq.com/kinghall/part1.html The King Hall FAQ was last updated in 1996 and is an interesting time capsule of what life at King Hall was like during the mid 1990s. Its author also published the thenuseful (but nowamusing) UCDavis Usenet FAQ at the same time. US News Rankings These rankings are extremely controversial. For one, their methodologies arent very strict, subject to all sorts of variations, and essentially boil down to a nonstatisticallyvalid measure of reputation rather than quality or rigor of education. However, for better or for worse, they influence perceptions of law schools among potential applicants and potential employers. Over the last 15 years, Davis has performed fairly comparably to Hastings. Legend: Black Diamond UC Davis School of Law | Grey Square UC Hastings College of Law Also note that the other Top 100 (according to US News) California Law Schools are typically ranked as follows: Stanford ~2, Berkeley ~9, UCLA & USC ~16, Loyola ~60, U. San Diego ~65, Pepperdine ~77, Santa Clara ~77, McGeorge ~90. The chart above reflects the fact that the numerically ranked schools only included the top 25 until 1994, and the top 50 until 2003, and has since ranked 100 schools. UC Davis jumped to #35 (from #44 in 2008) in http://gradschools.usnews.rankingsandreviews.com/bestgraduateschools/toplawschools/rankings the most recent rankings, published April 23, 2009. In 2010, it continued its dramatic upward trend, hitting number 28! It is the youngest law school to make the top 30. In a separate review performed by a University of Chicago law professor looking at law faculty scholarly influence, King Hall ranked in at 23rd in the nation. Continuing its upward surge, King Hall was http://gradschools.usnews.rankingsandreviews.com/bestgraduateschools/toplawschools/schooloflaw03017 ranked 23 in the nation in 2011 by US News. Publications Listed by order of first publication: UC Davis Law Review Official law review of U.C. Davis King Hall Advocate Law Student Newspaper Environs Journal of Environmental Law and Policy Journal of International Law and Policy Journal of Juvenile Law and Policy Business Law Journal 2000 Centers California International Law Center Clinics Students get a chance to have handson experience with the law by working with clinic staff on cases. Prison Law Clinic Immigration Law Clinic Family Protection and Legal Assistance Clinic Civil Rights Clinic Student Groups Law Students Association the umbrella group for all other student organizations, similar to ASUCD but with better behavior. Feminist Forum International Law Society UC Davis Moot Court Moot Court Program also known as Appellate Advocacy. LAMBDA BLSA Black Law Students Association APALSA ACLU Students See Law Students. Annual Events Cardozarama King Hall Legal Foundation Auction Where the KHLF Rubber Band Ball gets a new custodian every year Law Review Symposium http://students.law.ucdavis.edu/mootcourt/Neumiller_Competition.html Irving L. Neumiller Memorial Moot Court Competition http://students.law.ucdavis.edu/mootcourt/Asylum_About.html Asylum & Refugee Law National Moot Court Competition http://www.law.ucdavis.edu/news/events/fenwickwest/index.html TESLaw Lecture Series on law and technology Notable Alumni Ray Allen 02 (General Counsel, Burning Man) Tani CantilSakauye 84 (Third District Court of Appeals; nominated in July 2010 by Arnold Schwarzenegger as Chief Justice, California Supreme Court) Dario Frommer (State Assemblyman) Frederick L. Jones 96 (Chief Spokesman, White House National Security Council) Robert Mendez 80 (Senior Vice President, Diversity, DisneyABC Television Group) George Miller (U.S. House of Representatives) Pedro Nava (State Assemblyman) Darrell Steinberg (State Senator) Sen. Art Torres (Chairman, California Democratic Party) Honorable Judge David Rosenberg Dave Rosenberg (Presiding Judge, Yolo Superior Court, former Mayor of Davis, etc, etc) Sarah Granda 09 (paralyzed, she sued and won to get bar exam accommodations) Phil Satre (retired CEO, Harrahs Entertainment) Daniel Watts 2011 (ran for Davis City Council in 2010, California governor in 2003) Notable Faculty Vikram D. Amar, Professor Leading expert on Constitutional Law and Civil Procedure Edward Imwinkelried, Professor Leading expert on Evidence and Scientific Evidence Kevin Johnson, Professor and Dean Leading expert on immigration law and civil rights, senior immigration advisor to Barack Obama during 2008 Campaign Miguel A. Méndez, Professor Leading expert on Evidence Cruz Reynoso, Professor Emeritus Former Supreme Court Justice of the California Supreme Court, 2000 Presidential Medal of Freedom Recipient Bar Exam Rate Discussion Despite King Halls very high overall bar pass rate, there was a dip in passage rates at one point. In 2009 it was back to 90%. Still, it is usually among the topperforming schools in the country. In the 1980s and early 1990s, the bar pass rate was consistently above the 90% mark, earning UC Davis a commendation of the California State Senate (which is framed in one of the hallways at King Hall). However, for a while around 2005 the pass rate slipped to the http://calbar.ca.gov/calbar/pdfs/admissions/Statistics/JULY2005STATS.pdf mid 70s, something that Users/JaimeRaba one alumnus believes is rooted in the lowering of academic standards which culminated in the altering of the forced curve. The old curve is discussed in the antiquated http://faqs.netesq.com/kinghall/part1.html King Hall FAQ, and because a passing examination answer was supposedly correlated closely to a passing bar examination answer, there could be some relationship. The examination vs. bar examination difficulty correlation likely disappeared prior to the forced curved being altered, but this change, something perhaps emblematic of this shift in grade policy. Users/JaimeRaba The bar passage rate for King Hall graduates taking the July 2005 exam (as first time takers) was 76%. Users/SamanthaGrant For July 2009, we had 89% for the California bar exam (first time takers), 90% overall (meaning other states). Really fantastic! Users/TomGarberson Directors of Clinics Millard A. Murphy, supervising attorney for the Prison Law Clinic since 1987; awarded Distinguished Teaching Award in 2005 (see: http://www.californiaaggie.com/media/storage/paper981/news/2005/04/11/FrontPage/HeadOf.Ucd.Prison.Law.Clinic.Receives.Reward1320102.shtml Head of UCD Prison Law Clinic Receives Award, The California Aggie)
%% CONTRAST_BATCH_LOCAL uses the BATCH command to run the CONTRAST code locally. % % Licensing: % % This code is distributed under the GNU LGPL license. % % Modified: % % 01 April 2010 % % Author: % % John Burkardt % clear fprintf ( 1, '\n' ); fprintf ( 1, 'CONTRAST_BATCH_LOCAL\n' ); fprintf ( 1, ' Run CONTRAST_SCRIPT locally.\n' ); % % Read a black and white image and filter it locally. % x = imread ( 'surfsup.tif' ); xf = nlfilter ( x, [3,3], @contrast_enhance ); xf = uint8 ( xf ); % % Set the number of workers. % n = 4; % % BATCH sends the script for execution. % job = batch ( 'contrast_script', ... 'Configuration', 'local', ... 'CaptureDiary', true, ... 'FileDependencies', { 'contrast_fun', 'contrast_enhance', 'surfsup.tif' }, ... 'matlabpool', n ); % % WAIT pauses the MATLAB session til the job completes. % wait ( job ); % % DIARY displays any messages printed during execution. % diary ( job ); % % LOAD makes the script's workspace available. % % y = output #1. % load ( job ); % % DESTROY cleans up data about the job we no longer need. % destroy ( job ); % % Display the original, single filtered, and SPMD filtered versions. % figure ( 1 ); subplot ( 1, 3, 1 ); imshow ( x ); title ( 'Original image' ); subplot ( 1, 3, 2 ); imshow( xf ); title( 'Filtered on Client' ); subplot ( 1, 3, 3 ); imshow ( y ); title ( 'Filtered on 4 SPMD Workers' ); fprintf ( 1, '\n' ); fprintf ( 1, 'CONTRAST_BATCH_LOCAL\n' ); fprintf ( 1, ' Normal end of execution.\n' );
module Web.Raw.Css import JS import Web.Internal.CssPrim import Web.Internal.Types -------------------------------------------------------------------------------- -- Interfaces -------------------------------------------------------------------------------- namespace CSSGroupingRule export cssRules : (0 _ : JSType t1) => {auto 0 _ : Elem CSSGroupingRule (Types t1)} -> (obj : t1) -> JSIO CSSRuleList cssRules a = primJS $ CSSGroupingRule.prim__cssRules (up a) export deleteRule : (0 _ : JSType t1) => {auto 0 _ : Elem CSSGroupingRule (Types t1)} -> (obj : t1) -> (index : Bits32) -> JSIO () deleteRule a b = primJS $ CSSGroupingRule.prim__deleteRule (up a) b export insertRule : (0 _ : JSType t1) => {auto 0 _ : Elem CSSGroupingRule (Types t1)} -> (obj : t1) -> (rule : String) -> (index : Optional Bits32) -> JSIO Bits32 insertRule a b c = primJS $ CSSGroupingRule.prim__insertRule (up a) b (toFFI c) export insertRule' : (0 _ : JSType t1) => {auto 0 _ : Elem CSSGroupingRule (Types t1)} -> (obj : t1) -> (rule : String) -> JSIO Bits32 insertRule' a b = primJS $ CSSGroupingRule.prim__insertRule (up a) b undef namespace CSSImportRule export href : (obj : CSSImportRule) -> JSIO String href a = primJS $ CSSImportRule.prim__href a export media : (obj : CSSImportRule) -> JSIO MediaList media a = primJS $ CSSImportRule.prim__media a export styleSheet : (obj : CSSImportRule) -> JSIO CSSStyleSheet styleSheet a = primJS $ CSSImportRule.prim__styleSheet a namespace CSSMarginRule export name : (obj : CSSMarginRule) -> JSIO String name a = primJS $ CSSMarginRule.prim__name a export style : (obj : CSSMarginRule) -> JSIO CSSStyleDeclaration style a = primJS $ CSSMarginRule.prim__style a namespace CSSNamespaceRule export namespaceURI : (obj : CSSNamespaceRule) -> JSIO String namespaceURI a = primJS $ CSSNamespaceRule.prim__namespaceURI a export prefix_ : (obj : CSSNamespaceRule) -> JSIO String prefix_ a = primJS $ CSSNamespaceRule.prim__prefix a namespace CSSPageRule export selectorText : CSSPageRule -> Attribute True I String selectorText v = fromPrim "CSSPageRule.getselectorText" prim__selectorText prim__setSelectorText v export style : (obj : CSSPageRule) -> JSIO CSSStyleDeclaration style a = primJS $ CSSPageRule.prim__style a namespace CSSPseudoElement export element : (obj : CSSPseudoElement) -> JSIO Element element a = primJS $ CSSPseudoElement.prim__element a export type : (obj : CSSPseudoElement) -> JSIO String type a = primJS $ CSSPseudoElement.prim__type a namespace CSSRule public export CHARSET_RULE : Bits16 CHARSET_RULE = 2 public export FONT_FACE_RULE : Bits16 FONT_FACE_RULE = 5 public export IMPORT_RULE : Bits16 IMPORT_RULE = 3 public export MARGIN_RULE : Bits16 MARGIN_RULE = 9 public export MEDIA_RULE : Bits16 MEDIA_RULE = 4 public export NAMESPACE_RULE : Bits16 NAMESPACE_RULE = 10 public export PAGE_RULE : Bits16 PAGE_RULE = 6 public export STYLE_RULE : Bits16 STYLE_RULE = 1 export cssText : (0 _ : JSType t) => {auto 0 _ : Elem CSSRule (Types t)} -> t -> Attribute True I String cssText v = fromPrim "CSSRule.getcssText" prim__cssText prim__setCssText (v :> CSSRule) export parentRule : (0 _ : JSType t1) => {auto 0 _ : Elem CSSRule (Types t1)} -> (obj : t1) -> JSIO (Maybe CSSRule) parentRule a = tryJS "CSSRule.parentRule" $ CSSRule.prim__parentRule (up a) export parentStyleSheet : (0 _ : JSType t1) => {auto 0 _ : Elem CSSRule (Types t1)} -> (obj : t1) -> JSIO (Maybe CSSStyleSheet) parentStyleSheet a = tryJS "CSSRule.parentStyleSheet" $ CSSRule.prim__parentStyleSheet (up a) export type : (0 _ : JSType t1) => {auto 0 _ : Elem CSSRule (Types t1)} -> (obj : t1) -> JSIO Bits16 type a = primJS $ CSSRule.prim__type (up a) namespace CSSRuleList export length : (obj : CSSRuleList) -> JSIO Bits32 length a = primJS $ CSSRuleList.prim__length a export item : (obj : CSSRuleList) -> (index : Bits32) -> JSIO (Maybe CSSRule) item a b = tryJS "CSSRuleList.item" $ CSSRuleList.prim__item a b namespace CSSStyleDeclaration export cssFloat : CSSStyleDeclaration -> Attribute True I String cssFloat v = fromPrim "CSSStyleDeclaration.getcssFloat" prim__cssFloat prim__setCssFloat v export cssText : CSSStyleDeclaration -> Attribute True I String cssText v = fromPrim "CSSStyleDeclaration.getcssText" prim__cssText prim__setCssText v export length : (obj : CSSStyleDeclaration) -> JSIO Bits32 length a = primJS $ CSSStyleDeclaration.prim__length a export parentRule : (obj : CSSStyleDeclaration) -> JSIO (Maybe CSSRule) parentRule a = tryJS "CSSStyleDeclaration.parentRule" $ CSSStyleDeclaration.prim__parentRule a export getPropertyPriority : (obj : CSSStyleDeclaration) -> (property : String) -> JSIO String getPropertyPriority a b = primJS $ CSSStyleDeclaration.prim__getPropertyPriority a b export getPropertyValue : (obj : CSSStyleDeclaration) -> (property : String) -> JSIO String getPropertyValue a b = primJS $ CSSStyleDeclaration.prim__getPropertyValue a b export item : (obj : CSSStyleDeclaration) -> (index : Bits32) -> JSIO String item a b = primJS $ CSSStyleDeclaration.prim__item a b export removeProperty : (obj : CSSStyleDeclaration) -> (property : String) -> JSIO String removeProperty a b = primJS $ CSSStyleDeclaration.prim__removeProperty a b export setProperty : (obj : CSSStyleDeclaration) -> (property : String) -> (value : String) -> (priority : Optional String) -> JSIO () setProperty a b c d = primJS $ CSSStyleDeclaration.prim__setProperty a b c (toFFI d) export setProperty' : (obj : CSSStyleDeclaration) -> (property : String) -> (value : String) -> JSIO () setProperty' a b c = primJS $ CSSStyleDeclaration.prim__setProperty a b c undef namespace CSSStyleRule export selectorText : CSSStyleRule -> Attribute True I String selectorText v = fromPrim "CSSStyleRule.getselectorText" prim__selectorText prim__setSelectorText v export style : (obj : CSSStyleRule) -> JSIO CSSStyleDeclaration style a = primJS $ CSSStyleRule.prim__style a namespace CSSStyleSheet export cssRules : (obj : CSSStyleSheet) -> JSIO CSSRuleList cssRules a = primJS $ CSSStyleSheet.prim__cssRules a export ownerRule : (obj : CSSStyleSheet) -> JSIO (Maybe CSSRule) ownerRule a = tryJS "CSSStyleSheet.ownerRule" $ CSSStyleSheet.prim__ownerRule a export rules : (obj : CSSStyleSheet) -> JSIO CSSRuleList rules a = primJS $ CSSStyleSheet.prim__rules a export addRule : (obj : CSSStyleSheet) -> (selector : Optional String) -> (style : Optional String) -> (index : Optional Bits32) -> JSIO Int32 addRule a b c d = primJS $ CSSStyleSheet.prim__addRule a (toFFI b) (toFFI c) (toFFI d) export addRule' : (obj : CSSStyleSheet) -> JSIO Int32 addRule' a = primJS $ CSSStyleSheet.prim__addRule a undef undef undef export deleteRule : (obj : CSSStyleSheet) -> (index : Bits32) -> JSIO () deleteRule a b = primJS $ CSSStyleSheet.prim__deleteRule a b export insertRule : (obj : CSSStyleSheet) -> (rule : String) -> (index : Optional Bits32) -> JSIO Bits32 insertRule a b c = primJS $ CSSStyleSheet.prim__insertRule a b (toFFI c) export insertRule' : (obj : CSSStyleSheet) -> (rule : String) -> JSIO Bits32 insertRule' a b = primJS $ CSSStyleSheet.prim__insertRule a b undef export removeRule : (obj : CSSStyleSheet) -> (index : Optional Bits32) -> JSIO () removeRule a b = primJS $ CSSStyleSheet.prim__removeRule a (toFFI b) export removeRule' : (obj : CSSStyleSheet) -> JSIO () removeRule' a = primJS $ CSSStyleSheet.prim__removeRule a undef namespace MediaList export length : (obj : MediaList) -> JSIO Bits32 length a = primJS $ MediaList.prim__length a export mediaText : MediaList -> Attribute True I String mediaText v = fromPrim "MediaList.getmediaText" prim__mediaText prim__setMediaText v export appendMedium : (obj : MediaList) -> (medium : String) -> JSIO () appendMedium a b = primJS $ MediaList.prim__appendMedium a b export deleteMedium : (obj : MediaList) -> (medium : String) -> JSIO () deleteMedium a b = primJS $ MediaList.prim__deleteMedium a b export item : (obj : MediaList) -> (index : Bits32) -> JSIO (Maybe String) item a b = tryJS "MediaList.item" $ MediaList.prim__item a b namespace StyleSheet export disabled : (0 _ : JSType t) => {auto 0 _ : Elem StyleSheet (Types t)} -> t -> Attribute True I Bool disabled v = fromPrim "StyleSheet.getdisabled" prim__disabled prim__setDisabled (v :> StyleSheet) export href : (0 _ : JSType t1) => {auto 0 _ : Elem StyleSheet (Types t1)} -> (obj : t1) -> JSIO (Maybe String) href a = tryJS "StyleSheet.href" $ StyleSheet.prim__href (up a) export media : (0 _ : JSType t1) => {auto 0 _ : Elem StyleSheet (Types t1)} -> (obj : t1) -> JSIO MediaList media a = primJS $ StyleSheet.prim__media (up a) export ownerNode : (0 _ : JSType t1) => {auto 0 _ : Elem StyleSheet (Types t1)} -> (obj : t1) -> JSIO (Maybe (NS I [ Element , ProcessingInstruction ])) ownerNode a = tryJS "StyleSheet.ownerNode" $ StyleSheet.prim__ownerNode (up a) export parentStyleSheet : (0 _ : JSType t1) => {auto 0 _ : Elem StyleSheet (Types t1)} -> (obj : t1) -> JSIO (Maybe CSSStyleSheet) parentStyleSheet a = tryJS "StyleSheet.parentStyleSheet" $ StyleSheet.prim__parentStyleSheet (up a) export title : (0 _ : JSType t1) => {auto 0 _ : Elem StyleSheet (Types t1)} -> (obj : t1) -> JSIO (Maybe String) title a = tryJS "StyleSheet.title" $ StyleSheet.prim__title (up a) export type : (0 _ : JSType t1) => {auto 0 _ : Elem StyleSheet (Types t1)} -> (obj : t1) -> JSIO String type a = primJS $ StyleSheet.prim__type (up a) namespace StyleSheetList export length : (obj : StyleSheetList) -> JSIO Bits32 length a = primJS $ StyleSheetList.prim__length a export item : (obj : StyleSheetList) -> (index : Bits32) -> JSIO (Maybe CSSStyleSheet) item a b = tryJS "StyleSheetList.item" $ StyleSheetList.prim__item a b -------------------------------------------------------------------------------- -- Mixins -------------------------------------------------------------------------------- namespace ElementCSSInlineStyle export style : (0 _ : JSType t1) => {auto 0 _ : Elem ElementCSSInlineStyle (Types t1)} -> (obj : t1) -> JSIO CSSStyleDeclaration style a = primJS $ ElementCSSInlineStyle.prim__style (up a) namespace LinkStyle export sheet : (0 _ : JSType t1) => {auto 0 _ : Elem LinkStyle (Types t1)} -> (obj : t1) -> JSIO (Maybe CSSStyleSheet) sheet a = tryJS "LinkStyle.sheet" $ LinkStyle.prim__sheet (up a)
subroutine add_unity(fac,ssign,mel_out,iblkout,orb_info,str_info) *----------------------------------------------------------------------* * * Add (antisymmetrised) unit operator * ssign = 1: include sign flips for hole lines * = 0: total Ms value as additional factor (for Sz operator) * =-1: only spacial part is diagonal (for S+, S- operators) * *----------------------------------------------------------------------* implicit none include 'stdunit.h' include 'opdim.h' include 'def_graph.h' include 'def_strinf.h' include 'def_filinf.h' include 'def_operator.h' include 'def_orbinf.h' include 'def_me_list.h' include 'ifc_memman.h' include 'hpvxseq.h' include 'multd2h.h' integer, parameter :: & ntest = 00 real(8), intent(in):: & fac type(me_list), intent(inout) :: & mel_out type(strinf), intent(in), target :: & str_info type(orbinf), intent(in) :: & orb_info integer, intent(in) :: & iblkout, ssign logical :: & bufout,closeit, first, ms_fix, fix_success integer :: & ifree, nbuff, njoined, join_off, iblk, & idxmsa, msmax, msa, msc, igama, igamc, & idxc, ngam, len_blk, ioff_blk, idisc_off, & lenc, lena, icmp, & ihpv, ica, ncblk, nablk, ioff_1, idx1, istr, idxdis_1, & iocc(ngastp,2), idx_graph(ngastp,2), ms_sym_sign integer, pointer :: & hpvx_csub(:),hpvx_asub(:), & occ_csub(:), occ_asub(:), & graph_csub(:), graph_asub(:), & msdis_c(:), msdis_a(:), & idxmsdis_c(:), idxmsdis_a(:), & gamdis_c(:), gamdis_a(:), & len_str(:), istr_csub(:), & ldim_op_c(:), ldim_op_a(:), & mapca(:), diag_idx(:), diag_ca(:) real(8) :: & xsign, totsign type(graph), pointer :: & graphs(:) real(8), pointer :: & buffer_in(:), buffer_out(:) type(filinf), pointer :: & ffout type(operator), pointer :: & opout logical, external :: & occ_is_diag_blk, next_msgamdist2, & nondia_blk, nondia_distr integer, external :: & msa2idxms4op, ielprd, idx_str_blk3 ffout => mel_out%fhand opout => mel_out%op ms_sym_sign = ssign if (ssign.eq.0) ms_sym_sign = 1 if (ntest.ge.100) then write(lulog,*) '==========================' write(lulog,*) ' add_unity messing around' write(lulog,*) '==========================' write(lulog,*) ' mode = ',ssign write(lulog,*) ' fac = ',fac write(lulog,*) ' list = ',trim(mel_out%label) write(lulog,*) ' ffout: ',trim(ffout%name), & ' rec: ',ffout%current_record write(lulog,*) ' opout: ',opout%name(1:len_trim(opout%name)), & ' block: ',iblkout end if closeit = .false. njoined = opout%njoined join_off=(iblkout-1)*njoined ms_fix = mel_out%fix_vertex_ms if (ngastp.ne.4) call quit(1,'add_unity','only for ngastp=4') ! handle njoined>1 operator only if occ can be merged to njoined=1 iocc = 0 idx_graph = 0 do iblk = 1, njoined do ihpv = 1, ngastp do ica = 1, 2 if (opout%ihpvca_occ(ihpv,ica,join_off+iblk).ne.0) then if (iocc(ihpv,ica).ne.0) & call quit(1,'add_unity','cannot handle this operator') iocc(ihpv,ica) = opout%ihpvca_occ(ihpv,ica,join_off+iblk) idx_graph(ihpv,ica) = mel_out%idx_graph(ihpv,ica, & join_off+iblk) end if end do end do end do ! check whether the out operator is a diagonal block: graphs => str_info%g if (.not. & occ_is_diag_blk(iocc(1:ngastp,1:2),1)) & return ! else we just tacitly return bufout = .false. if(ffout%buffered) bufout = ffout%incore(iblkout).ge.0 ifree = mem_setmark('add_unity') ngam = orb_info%nsym ! Find total block length. idisc_off = ffout%length_of_record*(ffout%current_record-1) ioff_blk = mel_out%off_op_occ(iblkout) len_blk = mel_out%len_op_occ(iblkout) if(len_blk.gt.ifree) & call quit(1,'add_unity','insufficient space') ! Allocations made to maximum block length to save time. ! \TODO check if the buffered version works if there are different records if(.not.bufout)then nbuff=len_blk ifree= mem_alloc_real(buffer_out,nbuff,'buffer_out') else if(ntest.ge.100) & write(lulog,*)'Add_unity: Not incore' buffer_out => ffout%buffer(ioff_blk+1:) endif if(.not.bufout)then if(ffout%unit.le.0)then call file_open(ffout) closeit = .true. endif call get_vec(ffout,buffer_out,ioff_blk+1+idisc_off, & ioff_blk+len_blk+idisc_off) endif ! due to normal ordering, hole lines introduce sign flips: ! (for ssign.ne.1: maybe we will have to think about this again) if (njoined.eq.1) then xsign = dble(1-2*mod(iocc(1,1),2)) if (ssign.ne.1) xsign = 1d0 ! maybe we will have to rethink this else if (.not.all(iocc(1:ngastp,1:2).eq.0)) then ! here we have to think again ... have a look at dia_from_blk! c ! I think we know what we want for the H,;,H case (occ. density) c if (njoined.eq.2.and.all(iocc(2:ngastp,1:2).eq.0)) then c xsign=1d0 c else call quit(1,'add_unity','for njoined>1, think about the sign') c end if else xsign = 1d0 end if totsign = xsign call get_num_subblk(ncblk,nablk,iocc(1,1),1) allocate(hpvx_csub(ncblk),hpvx_asub(nablk), & occ_csub(ncblk), occ_asub(nablk), & graph_csub(ncblk), graph_asub(nablk), & msdis_c(ncblk), msdis_a(nablk), & idxmsdis_c(ncblk), idxmsdis_a(nablk), & gamdis_c(ncblk), gamdis_a(nablk), & len_str(ncblk+nablk), & istr_csub(ncblk), & ldim_op_c(ncblk),ldim_op_a(nablk)) ! set HPVX and OCC info call condense_occ(occ_csub, occ_asub, & hpvx_csub,hpvx_asub, & iocc(1,1),1,hpvxblkseq) ! do the same for the graph info call condense_occ(graph_csub, graph_asub, & hpvx_csub,hpvx_asub, & idx_graph(1,1),1,hpvxblkseq) if (mel_out%diag_type.ne.0) then allocate(mapca(ncblk),diag_idx(ncblk),diag_ca(ncblk)) if (nondia_blk(mapca,diag_idx,diag_ca, & iocc(1,1),1,ncblk, & nablk,mel_out%diag_type)) & call quit(1,'add_unity','non-diagonal block!') end if ! Loop over Ms of annihilator string. idxmsa = 0 c msmax = 2 msmax = opout%ica_occ(2,iblkout) if (msmax.ne.opout%ica_occ(1,iblkout)) call quit(1,'add_unity', & 'number of creators and annihilators must be the same') if (ssign.eq.-1.and.msmax.ne.1) call quit(1,'add_unity', & 'mode=-1 for one-particle operators only') msa_loop : do msa = msmax, -msmax, -2 cmh idxmsa = idxmsa+1 msc = msa + mel_out%mst idxmsa = msa2idxms4op(msa,mel_out%mst,msmax,msmax) ! Usually have mst=0 operators => Ms(c)=Ms(a) ! Loop over Irrep of annihilator string. igama_loop: do igama =1, ngam igamc = multd2h(igama,mel_out%gamt) if (mel_out%len_op_gmo(iblkout)% & gam_ms(igama,idxmsa).le.0) cycle ! loop over distributions of output operator first = .true. idxdis_1 = 0 distr_loop: do if (.not.next_msgamdist2(first, & msdis_c,msdis_a,gamdis_c,gamdis_a, & ncblk, nablk, & occ_csub,occ_asub, & msc,msa,igamc,igama,ngam, & ms_fix,fix_success)) exit first = .false. if(ms_fix.and..not.fix_success)cycle distr_loop if (mel_out%diag_type.ne.0) then ! skip non-diagonal distributions ... if (nondia_distr(mapca,diag_idx,diag_ca, & msdis_c,msdis_a,gamdis_c,gamdis_a, & ncblk,mel_out%msdiag, & mel_out%gamdiag)) cycle distr_loop end if call ms2idxms(idxmsdis_c,msdis_c,occ_csub,ncblk) call ms2idxms(idxmsdis_a,msdis_a,occ_asub,nablk) call set_len_str(len_str,ncblk,nablk, & graphs, & graph_csub,idxmsdis_c,gamdis_c,hpvx_csub, & graph_asub,idxmsdis_a,gamdis_a,hpvx_asub, & hpvxseq,.false.) c dbg c print *,'ncblk,nablk:',ncblk,nablk c write(lulog,'(a,10i4)') 'len_str:',len_str(1:ncblk+nablk) c write(lulog,'(a,10i4)') 'graph_csub:',graph_csub(1:ncblk) c write(lulog,'(a,10i4)') 'idxmsdis_c:',idxmsdis_c(1:ncblk) c write(lulog,'(a,10i4)') 'gamdis_c:',gamdis_c(1:ncblk) c write(lulog,'(a,10i4)') 'hpvx_csub:',hpvx_csub(1:ncblk) c write(lulog,'(a,10i4)') 'graph_asub:',graph_asub(1:nablk) c write(lulog,'(a,10i4)') 'idxmsdis_a:',idxmsdis_a(1:nablk) c write(lulog,'(a,10i4)') 'gamdis_a:',gamdis_a(1:nablk) c write(lulog,'(a,10i4)') 'hpvx_asub:',hpvx_asub(1:nablk) c dbgend lenc = ielprd(len_str,ncblk) lena = ielprd(len_str(ncblk+1),nablk) if (lenc.eq.0.or.lena.eq.0) cycle idxdis_1 = idxdis_1+1 ! ms-dst and gamma-dst should also be diagonal: if (nablk.ne.ncblk) cycle distr_loop if (.not.all(msdis_c(1:ncblk) & -ms_sym_sign*msdis_a(1:ncblk).eq.0).or. & .not.all(gamdis_c(1:ncblk)-gamdis_a(1:ncblk).eq.0)) & cycle distr_loop if (lenc.ne.lena) call quit(1,'add_unity','inconsistency') if (ssign.eq.0) & totsign = xsign*0.5d0*dble(sum(msdis_c(1:ncblk))) if (ntest.ge.100) then write(lulog,*) 'msc,msa,igamc,igama: ', & msc,msa,igamc,igama write(lulog,*) 'idxdis: ',idxdis_1 end if ioff_1 = mel_out%off_op_gmox(iblkout)% & d_gam_ms(idxdis_1,igama,idxmsa) - ioff_blk call set_op_ldim_c(ldim_op_c,ldim_op_a, & hpvx_csub,hpvx_asub, & len_str,ncblk,nablk,.false.) ! loop over diagonal me-list elements idxc_loop: do idxc = 1, lenc istr = idxc-1 do icmp = 1, ncblk istr_csub(icmp) = mod(istr,len_str(icmp)) !+1 istr = istr/len_str(icmp) end do idx1 = ioff_1 + idx_str_blk3(istr_csub,istr_csub, & ldim_op_c,ldim_op_a, & ncblk,nablk) buffer_out(idx1)=totsign*fac + buffer_out(idx1) end do idxc_loop end do distr_loop enddo igama_loop enddo msa_loop if (mel_out%diag_type.ne.0) deallocate(mapca,diag_idx,diag_ca) deallocate(hpvx_csub,hpvx_asub, & occ_csub, occ_asub, & graph_csub, graph_asub, & msdis_c, msdis_a, & idxmsdis_c, idxmsdis_a, & gamdis_c, gamdis_a, & len_str, istr_csub, & ldim_op_c,ldim_op_a) if(.not.bufout)then call put_vec(ffout,buffer_out,ioff_blk+1+idisc_off, & ioff_blk+len_blk+idisc_off) endif call touch_file_rec(ffout) if(closeit) & call file_close_keep(ffout) ifree = mem_flushmark('add_unity') return end
The sound-blocking feature is planned for a gradual rollout, so many users may not see it for a while yet. For those who do, look out for a new icon appearing in the increasingly cluttered Site Information section of the Address bar. Clicking this reveals a new 'Autoplay sound' feature, which can be toggled on or off for that specific site. The feature can be enabled/disabled at the user’s discretion via Options > Privacy & Security under Permissions -- click untick 'Block websites from automatically playing' to disable it. Click the Exceptions… button to whitelist individual sites and edit existing preferences. Elsewhere Firefox 66 unveils an improved search experience, with a new 'Search Tabs' option (found on the tabs overflow menu under the ˅ button. The new Private Window tab has also been redesigned to provide users with the ability to easily search using their default search engine. A new scroll anchor has been introduced to eliminate the annoying jumping of content as images and ads load further up the page. Extensions now store their settings in a central Firefox database rather than individual JSON files, which should speed up website browsing. Users also benefit from more easily being able to assign keyboard shortcuts to specific extensions via the about:addons panel (click the tools icon and choose 'Manage Extension Shortcuts'). Certificate error pages have been redesigned to provide more information and help resolve issues. Platform-specific changes include basic support for Touch Bar on supported MacBooks. Windows 10 users gain support for Windows Hello, allowing face, fingerprint or external security keys to authenticate websites. Fixes include one that resolves freezing issues when downloading files on Firefox for Linux. The Dark and Light Firefox themes now override system settings in Windows 10 too. Android users gain the sound-blocking feature and scroll anchoring support, plus users can now open files from external SD cards and other storage. Firefox Quantum 66.0 and Firefox for Android 66.0 are both available now as a free, open-source download for supported versions of Windows, Mac, Linux and Android.
! ! Sensor_Planck_Utility_Example ! ! Example program to show usage of the Sensor_Planck_Utility library. ! ! CREATION HISTORY: ! Written by: Paul van Delst, 16-Feb-2012 ! [email protected] ! PROGRAM Sensor_Planck_Utility_Example ! ------------------ ! Environment set up ! ------------------ ! Module usage USE Sensor_Planck_Utility, ONLY: & ! ...Utility stuff fp , & ! The floating point kind type (double) SUCCESS , & ! Error status parameters ! ...SpcCoeff entities SpcCoeff_type , & ! The spectral coefficient (SpcCoeff) type definition SpcCoeff_Associated , & ! The SpcCoeff object lifecycle checker SpcCoeff_Destroy , & ! The SpcCoeff object destructor SpcCoeff_Binary_ReadFile , & ! The SpcCoeff file reader ! ...Sensor Planck entities Sensor_Planck_Version , & ! Outputs the module information Sensor_Planck_Radiance , & ! The... Sensor_Planck_Temperature, & ! actual... Sensor_Planck_dBdT , & ! sensor... Sensor_Planck_dTdB ! procedures. ! Disable implicit typing IMPLICIT NONE ! ---------- ! Parameters ! ---------- CHARACTER(*), PARAMETER :: PROGRAM_NAME = 'Sensor_Planck_Utility_Example' CHARACTER(*), PARAMETER :: PROGRAM_VERSION_ID = & ! --------- ! Variables ! --------- CHARACTER(512) :: id CHARACTER(512) :: spccoeff_filename INTEGER :: err_stat INTEGER :: sensor_channel TYPE(SpcCoeff_type) :: spccoeff REAL(fp) :: temperature REAL(fp) :: radiance, brightness_temperature, dbdt, dtdb ! Version output CALL Sensor_Planck_Version(id) WRITE( *,'(/,a,/)' ) TRIM(id) ! Read an SpcCoeff datafile spccoeff_filename = 'abi_gr.SpcCoeff.bin' err_stat = SpcCoeff_Binary_ReadFile( spccoeff_filename, spccoeff ) IF ( err_stat /= SUCCESS ) THEN WRITE( *,'("Error reading SpcCoeff file ",a)' ) TRIM(spccoeff_filename) STOP END IF ! ...Output the list of channels WRITE( *,'(/7x,a," channel list:")' )TRIM(spccoeff%Sensor_id) WRITE( *,'(10i5,/)' ) spccoeff%sensor_channel ! Open loop over user temperature input Temperature_Loop: DO WRITE( *,FMT='(/5x,"Enter a temperature in Kelvin (-ve to quit): ")', ADVANCE='NO' ) READ( *,* ) temperature IF ( temperature < 0.0_fp ) EXIT Temperature_Loop ! Open loop over user sensor channel input Channel_Loop: DO WRITE( *,FMT='(/5x,"Enter a sensor channel (-ve to quit): ")', ADVANCE='NO' ) READ( *,* ) sensor_channel IF ( sensor_channel < 0 ) EXIT Channel_Loop ! ...Valid channel? IF ( ALL(spccoeff%sensor_channel /= sensor_channel) ) THEN WRITE( *,'("Channel ",i0," is not a valid channel for ",a,". Try again...")' ) sensor_channel, TRIM(spccoeff%Sensor_Id) CYCLE Channel_Loop END IF ! Compute the sensor radiance, brightness temperature, dBdT, and dTdB CALL Sensor_Planck_Radiance( spccoeff , & ! The SpcCoeff object sensor_channel, & ! The sensor channel. NOT the channel index; the actual channel number. temperature , & ! The temperature at which you want the radiance radiance ) ! The resulting radiance. CALL Sensor_Planck_Temperature( spccoeff, sensor_channel, radiance, brightness_temperature ) CALL Sensor_Planck_dBdT( spccoeff, sensor_channel, temperature, dbdt ) CALL Sensor_Planck_dTdB( spccoeff, sensor_channel, radiance, dtdb ) ! Output the result WRITE( *,'(/7x,a," channel ",i0,"; T=",f10.3,"K",& &/9x,"R = ",f10.3,& &/9x,"Tb = ",f10.3,& &/9x,"dB/dT = ",f10.3,& &/9x,"dT/dB = ",f10.3,/)' ) & TRIM(spccoeff%Sensor_id), sensor_channel, temperature, & radiance, brightness_temperature, dbdt, dtdb END DO Channel_Loop END DO Temperature_Loop ! Clean up CALL SpcCoeff_Destroy(spccoeff) IF ( SpcCoeff_Associated(spccoeff) ) THEN WRITE( *,'("Error destroying SpcCoeff object")' ) STOP END IF END PROGRAM Sensor_Planck_Utility_Example
------------------------------------------------------------------------------ -- Example using distributive laws on a binary operation via Agsy ------------------------------------------------------------------------------ {-# OPTIONS --allow-unsolved-metas #-} {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} -- Tested with the development version of the Agda standard library on -- 17 May 2012. module Agsy.DistributiveLaws.TaskB-TopDown where open import Relation.Binary.PropositionalEquality open ≡-Reasoning infixl 7 _·_ ------------------------------------------------------------------------------ -- Distributive laws axioms postulate D : Set -- The universe _·_ : D → D → D -- The binary operation. leftDistributive : ∀ x y z → x · (y · z) ≡ (x · y) · (x · z) rightDistributive : ∀ x y z → (x · y) · z ≡ (x · z) · (y · z) -- We test Agsy with the longest chains of equalities from -- DistributiveLaws.TaskB-TopDownATP. taskB : ∀ u x y z → (x · y · (z · u)) · ((x · y · ( z · u)) · (x · z · (y · u))) ≡ x · z · (y · u) taskB u x y z = -- The numbering of the proof step justifications are associated with -- the numbers used in DistributiveLaws.TaskB-I. begin xy·zu · (xy·zu · xz·yu) ≡⟨ j₁₋₅ ⟩ xy·zu · (xz · xu·yu · (y·zu · xz·yu)) ≡⟨ j₅₋₉ ⟩ xy·zu · (xz · xyu · (yxz · yu)) ≡⟨ j₉₋₁₄ ⟩ xz · xyu · (yz · xyu) · (xz · xyu · (y·xu · z·yu)) ≡⟨ j₁₄₋₂₀ ⟩ xz · xyu · (y·xu · (y·yu · z·yu) · (z · xu·yu · (y·xu · z·yu))) ≡⟨ j₂₀₋₂₃ ⟩ xz · xyu · (y · xu·zu · (z · xu·yu · (y·xu · z·yu))) ≡⟨ j₂₃₋₂₅ ⟩ (xz · xyu) · (y · xu·zu · (z·xu · y·xu · z·yu)) ≡⟨ j₂₅₋₃₀ ⟩ xz · xyu · (y·zy · xzu) ≡⟨ j₃₀₋₃₅ ⟩ xz·yu ∎ where -- Two variables abbreviations xz = x · z yu = y · u yz = y · z -- Three variables abbreviations xyu = x · y · u xyz = x · y · z xzu = x · z · u yxz = y · x · z y·xu = y · (x · u) y·yu = y · (y · u) y·zu = y · (z · u) y·zy = y · (z · y) z·xu = z · (x · u) z·yu = z · (y · u) -- Four variables abbreviations xu·yu = x · u · (y · u) xu·zu = x · u · (z · u) xy·zu = x · y · (z · u) xz·yu = x · z · (y · u) -- Steps justifications j₁₋₅ : xy·zu · (xy·zu · xz·yu) ≡ xy·zu · (xz · xu·yu · (y·zu · xz·yu)) j₁₋₅ = {!-t 20 -m !} -- Agsy fails j₅₋₉ : xy·zu · (xz · xu·yu · (y·zu · xz·yu)) ≡ xy·zu · (xz · xyu · (yxz · yu)) j₅₋₉ = {!-t 20 -m !} -- Agsy fails j₉₋₁₄ : xy·zu · (xz · xyu · (yxz · yu)) ≡ xz · xyu · (yz · xyu) · (xz · xyu · (y·xu · z·yu)) j₉₋₁₄ = {!-t 20 -m!} -- Agsy fails j₁₄₋₂₀ : xz · xyu · (yz · xyu) · (xz · xyu · (y·xu · z·yu)) ≡ xz · xyu · (y·xu · (y·yu · z·yu) · (z · xu·yu · (y·xu · z·yu))) j₁₄₋₂₀ = {!-t 20 -m!} -- Agsy fails j₂₀₋₂₃ : xz · xyu · (y·xu · (y·yu · z·yu) · (z · xu·yu · (y·xu · z·yu))) ≡ xz · xyu · (y · xu·zu · (z · xu·yu · (y·xu · z·yu))) j₂₀₋₂₃ = {!-t 20 -m!} -- Agsy fails j₂₃₋₂₅ : xz · xyu · (y · xu·zu · (z · xu·yu · (y·xu · z·yu))) ≡ (xz · xyu) · (y · xu·zu · (z·xu · y·xu · z·yu)) j₂₃₋₂₅ = {!-t 20 -m!} -- Agsy fails j₂₅₋₃₀ : (xz · xyu) · (y · xu·zu · (z·xu · y·xu · z·yu)) ≡ xz · xyu · (y·zy · xzu) j₂₅₋₃₀ = {!-t 20 -m!} -- Agsy fails j₃₀₋₃₅ : xz · xyu · (y·zy · xzu) ≡ xz·yu j₃₀₋₃₅ = {!-t 20 -m!} -- Agsy fails
#!/usr/bin/env python # vim: set fileencoding=<utf-8> : # Copyright 2018 John Lees and Nick Croucher import pickle import sys, os import numpy as np import argparse import dendropy # command line parsing def get_options(): parser = argparse.ArgumentParser(description='Extract tab-separated file of distances from pkl and npy files', prog='extract_distances') # input options parser.add_argument('--distances', required=True, help='Prefix of input pickle and numpy file of pre-calculated distances (required)') parser.add_argument('--tree', required=False, help='Newick file containing phylogeny of isolates', default = None) parser.add_argument('--output', required=True, help='Name of output file') return parser.parse_args() def iterDistRows(refSeqs, querySeqs, self=True): """Gets the ref and query ID for each row of the distance matrix Returns an iterable with ref and query ID pairs by row. Args: refSeqs (list) List of reference sequence names. querySeqs (list) List of query sequence names. self (bool) Whether a self-comparison, used when constructing a database. Requires refSeqs == querySeqs Default is True Returns: ref, query (str, str) Iterable of tuples with ref and query names for each distMat row. """ if self: assert refSeqs == querySeqs for i, ref in enumerate(refSeqs): for j in range(i + 1, len(refSeqs)): yield(refSeqs[j], ref) else: for query in querySeqs: for ref in refSeqs: yield(ref, query) def isolateNameToLabel(names): """Function to process isolate names to labels appropriate for visualisation. Args: names (list) List of isolate names. Returns: labels (list) List of isolate labels. """ # useful to have as a function in case we # want to remove certain characters labels = [os.path.splitext(os.path.basename(name))[0] for name in names] return labels # main code if __name__ == "__main__": # Check input ok args = get_options() # open stored distances with open(args.distances + ".pkl", 'rb') as pickle_file: rlist, qlist, self = pickle.load(pickle_file) X = np.load(args.distances + ".npy") # get names order r_names = isolateNameToLabel(rlist) q_names = isolateNameToLabel(qlist) # parse distances from tree, if supplied if args.tree is not None: # only calculate if all v all assert r_names == q_names, 'Using a phylogeny requires an all-v-all distance matrix' # load tree tree = dendropy.Tree.get(path = args.tree, schema = 'newick') # calculate distance matrix pdc = tree.phylogenetic_distance_matrix() # dict for identifying nodes from names tip_index = {} for t in tree.taxon_namespace: taxon_name = t.label.replace(' ','_') tip_index[r_names.index(taxon_name)] = t # open output file with open(args.output, 'w') as oFile: oFile.write("\t".join(['Query', 'Reference', 'Core', 'Accessory'])) if args.tree is not None: oFile.write("\t" + 'Patristic') oFile.write("\n") for i, (r_index, q_index) in enumerate(iterDistRows(r_names, q_names, r_names == q_names)): oFile.write("\t".join([q_names[q_index], r_names[r_index], str(X[i,0]), str(X[i,1])])) if args.tree is not None: oFile.write("\t" + str(pdc(tip_index[r_index], tip_index[q_index]))) oFile.write("\n")
lemma emeasure_lborel_singleton[simp]: "emeasure lborel {x} = 0"
(************************************************************************** * TLC: A library for Coq * * Sets * **************************************************************************) Set Implicit Arguments. Generalizable Variables A B. Require Import Coq.Classes.Morphisms. (* for [Proper] instances *) Require Import LibTactics LibLogic LibReflect LibList LibOperation LibStruct LibInt LibNat LibEpsilon LibRelation LibMin. Require Export LibBag. (* ********************************************************************** *) (** * Construction of sets as predicates *) (* ---------------------------------------------------------------------- *) (** ** Basic definitions *) Definition set (A : Type) := A -> Prop. Section Operations. Variables (A B : Type). Implicit Types x : A. Implicit Types E F G : set A. Definition set_st (P:A->Prop) : set A := P. Definition empty_impl : set A := (fun _ => False). Definition full_impl : set A := (fun _ => True). Definition single_impl x := (= x). Definition in_impl x E := E x. Definition compl_impl : set A -> set A := @pred_not A. (* todo: as typeclass? *) Definition union_impl : set A -> set A -> set A := @pred_or A. Definition inter_impl : set A -> set A -> set A := @pred_and A. Definition remove_impl : set A -> set A -> set A := fun E F x => E x /\ ~ F x. Definition incl_impl : set A -> set A -> Prop := @pred_le A. Definition disjoint_impl : set A -> set A -> Prop := fun E F : set A => inter_impl E F = empty_impl. Definition list_repr_impl (E:set A) (l:list A) := No_duplicates l /\ forall x, Mem x l <-> E x. Definition to_list (E:set A) := epsilon (list_repr_impl E). Definition to_set (xs : list A) : set A := set_st (fun x => Mem x xs). Definition list_covers_impl (E:set A) L := forall x, E x -> Mem x L. Definition finite (E:set A) := exists L, list_covers_impl E L. Definition card_impl (E:set A) : nat := mmin le (fun n => exists L, list_covers_impl E L /\ n = length L). Definition fold_impl (m:monoid_def B) (f:A->B) (E:set A) := LibList.fold_right (fun x acc => monoid_oper m (f x) acc) (monoid_neutral m) (to_list E). End Operations. (* ---------------------------------------------------------------------- *) (** ** Inhabited *) Instance set_inhab : forall A, Inhab (set A). Proof using. intros. apply (prove_Inhab (@empty_impl A)). Qed. (* ---------------------------------------------------------------------- *) (** ** Notation through typeclasses *) Lemma in_inst : forall A, BagIn A (set A). Proof using. constructor. exact (@in_impl A). Defined. Hint Extern 1 (BagIn _ (set _)) => apply in_inst : typeclass_instances. (* TODO: why is this not an instance like others ? *) Instance empty_inst : forall A, BagEmpty (set A). constructor. apply (@empty_impl A). Defined. Instance single_inst : forall A, BagSingle A (set A). constructor. rapply (@single_impl A). Defined. Instance union_inst : forall A, BagUnion (set A). constructor. rapply (@union_impl A). Defined. Instance inter_inst : forall A, BagInter (set A). constructor. rapply (@inter_impl A). Defined. Instance remove_inst : forall A, BagRemove (set A) (set A). constructor. rapply (@remove_impl A). Defined. Instance incl_inst : forall A, BagIncl (set A). constructor. rapply (@incl_impl A). Defined. Instance disjoint_inst : forall A, BagDisjoint (set A). constructor. rapply (@disjoint_impl A). Defined. Instance fold_inst : forall A B, BagFold B (A->B) (set A). constructor. rapply (@fold_impl A B). Defined. Instance card_inst : forall A, BagCard (set A). constructor. rapply (@card_impl A). Defined. Global Opaque set finite in_inst empty_inst single_inst union_inst inter_inst remove_inst incl_inst disjoint_inst card_inst fold_inst. (* ---------------------------------------------------------------------- *) (** Exposed definitions for list coverage *) (* definitions *) Definition list_repr A (E:set A) L := No_duplicates L /\ forall x, Mem x L <-> x \in E. Definition list_covers A (E:set A) L := forall x, x \in E -> Mem x L. (* ---------------------------------------------------------------------- *) (** ** Notations for building sets *) Notation "\set{ x | P }" := (@set_st _ (fun x => P)) (at level 0, x ident, P at level 200) : set_scope. Notation "\set{ x : A | P }" := (@set_st A (fun x => P)) (at level 0, x ident, P at level 200) : set_scope. Notation "\set{ x '\in' E | P }" := (@set_st _ (fun x => x \in E /\ P)) (at level 0, x ident, P at level 200) : set_scope. Notation "\set{= e | x '\in' E }" := (@set_st _ (fun a => exists_ x \in E, a = e )) (at level 0, x ident, E at level 200) : set_scope. Notation "\set{= e | x '\in' E , y ''\in' F }" := (@set_st _ (fun a => exists_ x \in E, exists_ y \in F, a = e )) (at level 0, x ident, F at level 200) : set_scope. Notation "\set{= e | x y '\in' E }" := (@set_st _ (fun a => exists_ x y \in E, a = e )) (at level 0, x ident, y ident, E at level 200) : set_scope. (* ---------------------------------------------------------------------- *) (** Additional definitions *) (* TODO map f E = \set{= f x | x in E } bij E F f g = forall x \in E, f x \in F forall y \in F, g x \in E forall x \in E, g (f x) = x forall y \in F, f (g y) = y F m i E = fold m j F when bij E F f g and forall x \in E, i x = j (f x) or forall y \in E, j y = i (g y) *) (* ********************************************************************** *) (** * Properties of sets *) Section Instances. Variables (A:Type). Transparent set finite empty_inst single_inst single_impl in_inst incl_inst inter_inst union_inst card_inst fold_inst remove_inst disjoint_inst. Hint Constructors Mem. Ltac set_unf := unfold finite, card_inst, card_impl, card, to_list, disjoint_impl, disjoint_inst, disjoint, incl_inst, incl_impl, empty_inst, empty_impl, empty, single_inst, single_impl, single, in_inst, in_impl, is_in, incl_inst, incl_impl, incl, compl_impl, pred_not, inter_inst, inter_impl, inter, pred_and, union_inst, union_impl, union, pred_or, remove_inst, remove_impl, remove, fold_inst, fold_impl, fold in *. (* ---------------------------------------------------------------------- *) (** Reformulation *) Lemma disjoint_def : forall (E F : set A), E \# F = (E \n F = \{}). Proof using. auto. Qed. (* ---------------------------------------------------------------------- *) (** set_st and double inclusion *) Lemma in_set_st_eq : forall (P:A->Prop) x, x \in set_st P = P x. Proof using. intros. apply* prop_ext. Qed. Lemma set_ext_eq : forall (E F : set A), (E = F) = (forall (x:A), x \in E <-> x \in F). Proof using. intros. apply prop_ext. iff H. subst*. apply* prop_ext_1. Qed. Lemma set_ext : forall (E F : set A), (forall (x:A), x \in E <-> x \in F) -> E = F. Proof using. intros. rewrite~ set_ext_eq. Qed. Lemma set_st_eq : forall A (P Q : A -> Prop), (forall (x:A), P x <-> Q x) -> set_st P = set_st Q. Proof using. intros. asserts_rewrite~ (P = Q). extens~. Qed. (* ---------------------------------------------------------------------- *) (** set_in, incl *) Global Instance in_extens_inst : In_extens (A:=A) (T:=set A). Proof using. constructor. intros. rewrite* set_ext_eq. Qed. Global Instance in_empty_eq_inst : In_empty_eq (A:=A) (T:=set A). Proof using. constructor. intros. apply* prop_ext. Qed. Global Instance in_single_eq_inst : In_single_eq (A:=A) (T:=set A). Proof using. constructor. intros. apply* prop_ext. Qed. Global Instance in_union_eq_inst : In_union_eq (A:=A) (T:=set A). Proof using. constructor. intros. set_unf. simpl. apply* prop_ext. Qed. Global Instance in_inter_eq_inst : In_inter_eq (A:=A) (T:=set A). Proof using. constructor. intros. set_unf. apply* prop_ext. Qed. Global Instance in_remove_eq_inst : In_remove_eq (A:=A) (T:=set A). Proof using. constructor. intros. set_unf. applys* prop_ext. Qed. Global Instance incl_in_eq_inst : Incl_in_eq (A:=A) (T:=set A). Proof using. constructor. intros. set_unf. autos*. Qed. Global Instance disjoint_eq_inst : Disjoint_eq (T:=set A). Proof using. constructor. intros. rewrite disjoint_def. set_unf. applys prop_ext. iff M. intros x. rewrite* <- (@func_same_1 _ _ x _ _ M). applys* prop_ext_1. Qed. Lemma set_isolate : forall A (E : set A) x, x \in E -> E = \{x} \u (E \- \{x}). Proof using. introv H. set_unf. apply prop_ext_1. intros y. iff M. simpls. tests*: (y = x). destruct M. subst*. autos*. Qed. Lemma set_add_remove : forall A (E : set A) x, x \notin E -> E = (E \u \{x}) \- \{x}. Proof using. introv Hx. set_unf. apply prop_ext_1. iff. { split. eauto. intro. subst*. } { tauto. } Qed. (* ---------------------------------------------------------------------- *) (** repr and covers *) Lemma list_repr_covers : forall (E:set A) L, list_repr E L -> list_covers E L. Proof using. introv (ND&EQ). introv Hx. rewrite~ EQ. Qed. Lemma list_repr_disjoint_union : forall (E F : set A) LE LF, E \# F -> list_repr E LE -> list_repr F LF -> list_repr (E \u F) (LE ++ LF). Proof using. introv D (HE&QE) (HF&QF). split. applys~ No_duplicates_app. intros x ? ?. applys* @disjoint_inv x. typeclass. rewrite~ <- QE. rewrite~ <- QF. intros x. rewrite Mem_app_or_eq. rewrite in_union_eq. rewrite <- QE. rewrite* <- QF. Qed. Lemma list_repr_no_duplicates: forall (E : set A) xs, list_repr E xs -> No_duplicates xs. Proof using. unfold list_repr. tauto. Qed. (* see also [list_repr_nil] further on *) (* ---------------------------------------------------------------------- *) (** to_list *) Lemma list_covers_impl_to_list_repr_impl : forall A (E:set A), ex (list_covers_impl E) -> ex (list_repr_impl E). Proof using. (* TODO: factorize this wiht later proofs *) introv (L&M). sets_eq L1 EQL1: (Remove_duplicates L). forwards~ (HN&HM&_): Remove_duplicates_spec EQL1. sets L2: (Filter (fun x => x \in E) L1). exists L2. split. applys* No_duplicates_Filter. intros x. specializes M x. rewrite <- HM in M. set_unf. iff N. subst L2. forwards*: Filter_Mem_inv N. applys* Filter_Mem. Qed. Lemma finite_list_repr : forall A (E:set A), finite E -> list_repr E (to_list E). Proof using. introv FE. unfolds to_list, finite, list_repr_impl. spec_epsilon~ as L' (HL'&EL'). applys~ list_covers_impl_to_list_repr_impl. splits~. Qed. Lemma to_list_spec : forall (E:set A) L, L = to_list E -> finite E -> list_repr E L. Proof. introv EQ HE. unfolds. subst. forwards* (?&?): finite_list_repr HE. Qed. Lemma Mem_to_list: forall (xs : set A), finite xs -> forall x, Mem x (to_list xs) <-> x \in xs. Proof. intros. forwards [ ? ? ]: to_list_spec xs; eauto. Qed. Lemma to_list_empty : to_list (\{}:set A) = nil. Proof using. set_unf. spec_epsilon as l. exists (@nil A). split. constructor. iff; false_invert. inverts Hl. simpls. destruct~ l. false. rewrite <- H0. simple~. Qed. Lemma to_list_single : forall (x:A), to_list (\{x}) = x::nil. Proof using. intros. unfold to_list. spec_epsilon as l. exists (x::nil). split. constructor*. introv M. inverts M. unfold single_inst, single_impl. simple~. iff H. inverts* H. inverts* H1. inverts* H. unfolds single_inst, single_impl. simpls~. inverts Hl as H H0. destruct (H0 x). specializes~ H2. destruct l. inverts H2. tests E: (x = a). fequals. destruct l. auto. forwards~: (proj1 (H0 a0)). subst. inverts H as M1 M2. false* M1. inverts H2. false. forwards~: (proj1 (H0 a)). false. Qed. (* ---------------------------------------------------------------------- *) (** finite *) (* introduction *) Lemma finite_prove_covers : forall (E:set A) L, list_covers E L -> finite E. Proof using. introv H. exists* L. Qed. Lemma finite_prove_repr : forall (E:set A) L, list_repr E L -> finite E. Proof using. introv (ND&EQ). exists~ L. introv Hx. rewrite~ EQ. Qed. Lemma finite_prove_exists : forall (E:set A), ex (list_covers E) -> finite E. Proof using. introv (L&H). applys* finite_prove_covers. Qed. (* elimination *) Definition finite_covers : forall (E:set A), finite E -> exists L, list_covers E L /\ card E = length L. Proof. introv (L&H). sets m: (card E). forwards* (R&P): mmin_spec_nat m. Qed. Lemma finite_covers_basic : forall (E:set A), finite E -> exists L, list_covers E L. Proof using. introv (L&HN). exists L. intros. applys* HN. Qed. (* operations *) Lemma finite_empty : finite (\{} : set A). Proof using. intros. apply finite_prove_exists. set_unf. exists (@nil A). introv M. inverts M. Qed. Lemma finite_single : forall (a : A), finite \{a}. Proof using. intros. apply finite_prove_exists. set_unf. exists (a::nil). introv M. hnf in M. subst*. Qed. Lemma finite_union : forall (E F : set A), finite E -> finite F -> finite (E \u F). Proof using. introv H1 H2. apply finite_prove_exists. lets (L1&E1): finite_covers_basic H1. lets (L2&E2): finite_covers_basic H2. exists (L1++L2). unfolds list_covers. introv M. rewrite @in_union_eq in M; try typeclass. rewrite* Mem_app_or_eq. Qed. Lemma finite_inter : forall (E F : set A), finite E \/ finite F -> finite (E \n F). Proof using. introv H. apply finite_prove_exists. destruct H. lets (L&EQ): finite_covers_basic H. exists L. unfold list_covers. set_unf. autos*. lets (L&EQ): finite_covers_basic H. exists L. unfold list_covers. set_unf. autos*. Qed. Lemma finite_incl : forall (E F : set A), E \c F -> finite F -> finite E. Proof using. introv HI HF. apply finite_prove_exists. lets (L&EQ): finite_covers_basic HF. unfold list_covers. set_unf. exists* L. introv Ex. applys EQ. applys~ HI. Qed. Lemma finite_remove : forall (E F : set A), finite E -> finite (E \- F). Proof using. introv HE. apply finite_prove_exists. lets (L&EQ): finite_covers_basic HE. unfold list_covers. set_unf. exists* L. Qed. Section One. Lemma finite_remove_inv : forall (E F : set A), finite (E \- F) -> finite F -> finite E. Proof using. Local Opaque remove_inst single_inst. introv H1 H2. lets (L1&R1): finite_covers_basic H1. lets (L2&R2): finite_covers_basic H2. applys finite_prove_covers (L1 ++ L2). intros y Hy. rewrite~ Mem_app_or_eq. tests: (y \in F). autos~. forwards~ M: R1 y. rewrite~ @in_remove_eq. typeclass. Qed. End One. Lemma finite_remove_one_inv : forall (E : set A) x, finite (E \-- x) -> finite E. Proof using. introv H. applys finite_remove_inv H. applys finite_single. Qed. (* LATER : finite_remove_inv finite (E \- F) -> finite F -> finite E *) (* The following lemma pushed here due to dependencies. *) Lemma list_repr_nil: list_repr \{} (@nil A). Proof using. rewrite <- to_list_empty. eapply to_list_spec; eauto using finite_empty. Qed. (* ---------------------------------------------------------------------- *) (** card *) (* introduction of properties on card *) Definition card_prove_le : forall (E:set A) L, list_covers E L -> (card E <= length L)%nat. Proof using. introv H. sets m: (card E). set_unf. forwards* (R&P): mmin_spec_nat m. simpls. applys P. exists L. splits~. Qed. Definition finite_repr_length : forall (E:set A), finite E -> exists L, list_repr E L /\ card E = length L. Proof. introv H. forwards (L1&HL1&EL1): finite_covers H. sets L2: (Remove_duplicates L1). forwards~ (ND&EQ&LE): Remove_duplicates_spec L1 L2. sets L3: (Filter (fun x => x \in E) L2). asserts: (length L3 <= length L2)%nat. applys Filter_length_le. asserts R3: (list_repr E L3). split. applys~ No_duplicates_Filter. intros x. iff M. unfold L3 in M. lets~ (_&?): Filter_Mem_inv M. applys~ Filter_Mem. rewrite~ EQ. forwards C3: list_repr_covers R3. exists L3. splits*. forwards: card_prove_le C3. math. Qed. Lemma list_repr_card : forall (E:set A) (L:list A), list_repr E L -> card E = length L. Proof using. introv HR. lets (ND&EQ): HR. forwards~ (L'&(ND'&HR')&EQ'): finite_repr_length E. applys* finite_prove_repr. unfold card. simpl. rewrite EQ'. applys~ No_duplicates_length_eq. intros x. rewrite EQ. rewrite* HR'. Qed. Definition card_prove_ge : forall (E:set A) n, finite E -> (forall L, list_covers E L -> (length L >= n)%nat) -> (card E >= n)%nat. Proof using. introv H. sets m: (card E). forwards* (R&P): mmin_spec_nat m. lets (L&EL): finite_covers_basic H. exists~ (length L) L. simpls. introv HL. destruct R as (L&CR&ER). forwards~: HL L. math. Qed. Definition card_prove_eq : forall (E:set A) L, list_covers E L -> (forall L', list_covers E L' -> (length L' >= length L)%nat) -> card E = length L. Proof using. introv HC HG. forwards~: card_prove_le HC. forwards~: card_prove_ge HG. applys* finite_prove_covers. math. Qed. Lemma card_is_length_to_list : forall (E:set A), finite E -> card E = length (to_list E). Proof using. introv FE. applys list_repr_card. applys~ to_list_spec. Qed. (* operations *) Global Instance card_empty_inst : Card_empty (T:=set A). Proof using. constructor. rewrite card_is_length_to_list. lets E: to_list_empty. set_unf. rewrite E. rew_list~. applys finite_empty. Qed. Global Instance card_single_inst : Card_single (T:=set A). Proof using. constructor. intros a. rewrite card_is_length_to_list. lets E: to_list_single a. set_unf. rewrite E. rew_list~. applys finite_single. Qed. End Instances. Hint Resolve finite_empty finite_single finite_union finite_inter finite_incl finite_remove : finite. (* ---------------------------------------------------------------------- *) (* ---------------------------------------------------------------------- *) (* ** Tactics for proving set equalities and set inclusions *) (* lemmas *) Section Autorewrite. Variables (A : Type). Implicit Types x y : A. Implicit Types E F : set A. Lemma set_in_empty_eq : forall x, x \in (\{}:set A) = False. Proof using. apply in_empty_eq. Qed. Lemma set_in_single_eq : forall x y, x \in (\{y}:set A) = (x = y). Proof using. apply in_single_eq. Qed. Lemma set_in_inter_eq : forall x E F, x \in (E \n F) = (x \in E /\ x \in F). Proof using. apply in_inter_eq. Qed. Lemma set_in_union_eq : forall x E F, x \in (E \u F) = (x \in E \/ x \in F). Proof using. apply in_union_eq. Qed. Lemma set_in_remove_eq : forall x E F, x \in (E \- F) = (x \in E /\ ~ x \in F). Proof using. apply in_remove_eq. Qed. Lemma set_in_extens_eq : forall E F, (E = F) = (forall x, x \in E <-> x \in F). Proof using. extens. iff M. subst*. applys @in_extens_eq. typeclass. intros. extens*. Qed. Lemma set_incl_in_eq : forall E F, (E \c F) = (forall x, x \in E -> x \in F). Proof using. apply incl_in_eq. Qed. Lemma set_disjoint_eq : forall E F, (E \# F) = (forall x, x \in E -> x \in F -> False). Proof using. apply disjoint_eq. Qed. End Autorewrite. Hint Rewrite in_set_st_eq set_in_empty_eq set_in_single_eq set_in_inter_eq set_in_union_eq set_in_remove_eq set_in_extens_eq set_incl_in_eq set_disjoint_eq : set_norm. (* tactics *) Ltac set_norm := autorewrite_in_star_patch ltac:(fun tt => autorewrite with set_norm). Ltac set_specialize_hyps A x := repeat match goal with H: forall _:?A, _ |- _ => specializes H x end. Ltac set_specialize_classic x := repeat match goal with E: set _ |- _ => match goal with | H: x \in E \/ ~ x \in E |- _ => fail 1 | _ => lets: (classic (x \in E)) end end. Ltac set_specialize use_classic := match goal with |- forall _:?A, _ => let x := fresh "x" in intros x; set_specialize_hyps A x; match use_classic with | true => set_specialize_classic x | false => idtac end end. Ltac set_prove_setup use_classic := intros; set_norm; try set_specialize use_classic; set_norm. Ltac set_prove_conclude := solve [ intros; subst; tauto ]. Ltac set_prove := set_prove_setup false; set_prove_conclude. Ltac set_prove_classic := set_prove_setup true; set_prove_conclude. (* demos *) Lemma inter_union_disjoint_right: forall A (E F G : set A), F \# G -> (E \u F) \n G = (E \n G). Proof using. set_prove. (* intros. set_norm. set_specialize. set_norm. tauto. *) Qed. (* demo *) Lemma inter_union_subset_right: forall A (E F G : set A), F \c G -> (E \u F) \n G = (E \n G) \u F. Proof using. set_prove. Qed. (* demo *) Lemma inter_covariant: forall A (E E' F F' : set A), E \c E' -> F \c F' -> (E \n F) \c (E' \n F'). Proof using. set_prove. Qed. (* demo *) Lemma set_decompose_inter_right : forall A (E F : set A), E = (E \n F) \u (E \- F). Proof using. set_prove_classic. Qed. (* demo *) Lemma set_decompose_union_right : forall A (E F : set A), (E \u F) = E \u (F \- E). Proof using. set_prove_classic. Qed. (* demo *) (* ---------------------------------------------------------------------- *) (** card *) Lemma card_incl_le : forall A (E F:set A), finite F -> E \c F -> (card E <= card F)%nat. Proof using. introv FF CF. lets FE: finite_incl CF FF. lets (LF&RF&QF): finite_covers FF. rewrite QF. applys card_prove_le. introv Ex. applys RF. applys* @incl_inv. typeclass. Qed. Lemma card_union_le : forall A (E F:set A), finite E -> finite F -> card (E \u F) <= (card E + card F)%nat. Proof using. introv FE FF. lets (LE&RE&QE): finite_covers FE. lets (LF&RF&QF): finite_covers FF. lets H: card_prove_le (E \u F) (LE++LF) __. unfolds list_covers. intros. apply Mem_app_or. rewrite in_union_eq in H. autos*. rew_length in H. math. Qed. Lemma card_disjoint_union : forall A (E F : set A), finite E -> finite F -> E \# F -> card (E \u F) = (card E + card F)%nat. Proof using. introv FE FF EF. forwards: card_union_le FE FF. cuts: (card (E \u F) >= (card E + card F)%nat). math. clear H. forwards (L&LC&LL): finite_covers (E \u F). applys~ finite_union. rewrite LL. clear LL. sets PE: (fun x => x \in E). sets LE: (Filter PE L). sets PF: (fun x => x \in F). sets LF: (Filter PF L). forwards: card_prove_le E LE. unfold LE, PE. introv Ex. forwards: LC x. set_prove. applys~ Filter_Mem. forwards: card_prove_le F LF. unfold LF, PF. introv Fx. forwards: LC x. set_prove. applys~ Filter_Mem. forwards LEF: Filter_disjoint_predicates_length PE PF L. introv _ HEx HFx. unfolds PE, PF. applys* @disjoint_inv. typeclass. subst LE LF. math. Qed. Lemma card_inter_left : forall A (E F : set A), finite E -> card (E \n F) <= card E. Proof using. intros. applys~ card_incl_le. set_prove. Qed. Lemma card_inter_right : forall A (E F : set A), finite F -> card (E \n F) <= card F. Proof using. intros. rewrite inter_comm. apply~ card_inter_left. Qed. Lemma card_nonempty : forall A (E : set A) x, x \in E -> finite E -> 1 <= card E. Proof using. intros. rewrite <- (card_single x). applys~ card_incl_le. set_prove. Qed. Lemma card_disjoint_union_single : forall A (E : set A) x, finite E -> x \notin E -> (card (E \u \{x}) = card E + 1)%nat. Proof using. intros. replace 1 with (card \{x}) by eauto using card_single. applys~ card_disjoint_union. applys finite_single. rewrite disjoint_single_r_eq. auto. Qed. Lemma card_diff_single: forall A (E : set A) x, finite E -> x \in E -> (card (E \-- x) = card E - 1)%nat. Proof using. intros. assert (h1: (E \-- x) \u \{x} = E). { rewrite union_comm. erewrite set_isolate by eauto. reflexivity. } forwards h2: card_disjoint_union_single (E \-- x) x. { eauto with finite. } { unfold notin. rewrite set_in_remove_eq. rew_logic. right. eapply in_single_self. } rewrite h1 in h2. math. Qed. (* ---------------------------------------------------------------------- *) (** fold *) Lemma fold_def : forall A B (m:monoid_def B) (f:A->B) (E: set A), fold m f E = LibList.fold m f (to_list E). Proof using. reflexivity. Qed. Lemma fold_eq : forall A B (m:monoid_def B) (f:A->B) (E: set A) L, Monoid_commutative m -> list_repr E L -> fold m f E = LibList.fold m f L. Proof using. introv HM EL. rewrite fold_def. forwards~ (N&EQ2): to_list_spec E. applys* finite_prove_repr. destruct EL as (ND&EQ1). applys~ LibList.fold_equiv. intros. rewrite EQ2. rewrite* EQ1. Qed. Lemma fold_induction: forall A B (m : monoid_def B) (f : A -> B) (P : B -> Prop), Monoid_commutative m -> P (monoid_neutral m) -> (forall x a, P x -> P (monoid_oper m (f a) x)) -> forall E, finite E -> P (fold m f E). Proof using. introv ? Hbase Hstep Hfinite. assert (forall xs, P (LibList.fold m f xs)). { induction xs; unfold LibList.fold; simpl; eauto. } forwards: finite_list_repr Hfinite. erewrite fold_eq by eauto. eauto. Qed. Lemma fold_congruence : forall A B (m : monoid_def B) (f g : A -> B) (E : set A), Monoid_commutative m -> finite E -> (forall x, x \in E -> f x = g x) -> fold m f E = fold m g E. Proof using. introv ? ? h. do 2 rewrite fold_def. eapply LibList.fold_congruence. intros. eapply h. eapply Mem_to_list; eauto. Qed. Lemma fold_empty : forall A B (m:monoid_def B) (f:A->B), fold m f (\{}:set A) = monoid_neutral m. Proof using. intros. rewrite fold_def. rewrite to_list_empty. rewrite~ LibList.fold_nil. Qed. Lemma fold_single : forall A B (m:monoid_def B) (f:A->B) (x:A), Monoid m -> fold m f \{x} = f x. Proof using. intros. rewrite fold_def. rewrite to_list_single. rewrite~ fold_cons. rewrite fold_nil. rewrite~ monoid_neutral_r. Qed. Lemma fold_union : forall A B (m:monoid_def B) (f:A->B) (E F : set A), Monoid_commutative m -> finite E -> finite F -> E \# F -> fold m f (E \u F) = monoid_oper m (fold m f E) (fold m f F). Proof using. introv HM HE HF HD. rewrites (>> fold_def E). rewrites (>> fold_def F). hint finite_list_repr. forwards~ HR: list_repr_disjoint_union HD. rewrites~ (>> fold_eq HR). rewrite~ LibList.fold_app. typeclass. Qed. Lemma fold_isolate : forall A (E : set A) x, finite E -> x \in E -> forall B (m : monoid_def B), Monoid_commutative m -> forall (f : A -> B), fold m f E = monoid_oper m (f x) (fold m f (E \- \{x})). Proof using. intros. (* Separate [E] into the singleton [\{x}] union the rest. *) rewrite (set_isolate E x) at 1 by eauto. (* Note that [f x] is the result of folding [f] over the singleton [\{x}]. *) erewrite <- (fold_single f x) by typeclass. (* Conclude. *) eapply fold_union; eauto using remove_disjoint with finite. Qed. Lemma fold_pointwise: forall B (m : monoid_def B) (leB : B -> B -> Prop), Monoid m -> refl leB -> Proper (leB ++> leB ++> leB) (monoid_oper m) -> forall A (E : set A), finite E -> forall (f f' : A -> B), (forall x, x \in E -> leB (f x) (f' x)) -> leB (fold m f E) (fold m f' E). Proof using. intros. do 2 rewrite fold_def. applys~ LibList.fold_pointwise. intros x. forwards~ (_&EQ): finite_list_repr E. rewrite (EQ x). auto. Qed. (* ---------------------------------------------------------------------- *) (** [to_set] *) Lemma list_repr_to_set: forall A (xs : list A), No_duplicates xs -> list_repr (to_set xs) xs. Proof using. unfold list_repr, to_set. induction 1; split. { econstructor. } { tauto. } { econstructor; eauto. } { tauto. } Qed. Lemma list_repr_to_set_inverse: forall A (E : set A) (xs : list A), list_repr E xs -> E = to_set xs. Proof using. unfold list_repr, to_set. introv (_ & ?). generalize dependent E. generalize dependent xs. induction xs; introv H; rewrite set_ext_eq; intros x; rewrite in_set_st_eq; rewrite H; tauto. Qed. Lemma to_set_nil: forall A, to_set (@nil A) = \{}. Proof using. intros. erewrite <- list_repr_to_set_inverse by eapply list_repr_nil. eauto. Qed. Lemma prefix_to_set: forall A (xs ys : list A), prefix xs ys -> to_set xs \c to_set ys. Proof using. unfold to_set. introv (zs&?). subst. rewrite set_incl_in_eq. intros. rewrite in_set_st_eq in *. rewrite Mem_app_or_eq. tauto. Qed. (* ---------------------------------------------------------------------- *) (** ** Structural properties *) (** Rewriting tactics *) Hint Rewrite in_set_st_eq : rew_set. Tactic Notation "rew_set" := autorewrite with rew_set. Tactic Notation "rew_set" "in" hyp(H) := autorewrite with rew_set in H. Tactic Notation "rew_set" "in" "*" := autorewrite with rew_set in *. (* ********************************************************************** *) (** * Additional predicates on sets *) (* ---------------------------------------------------------------------- *) (** ** Foreach *) (** TODO: derive these lemmas as typeclasses in a generic way in LibBag *) Section ForeachProp. Variables (A : Type). Implicit Types P Q : A -> Prop. Implicit Types E F : set A. Lemma foreach_empty : forall P, @foreach A (set A) _ P \{}. Proof using. intros_all. false. Qed. (* TODO: false* @in_empty. typeclass. *) Lemma foreach_single : forall P X, P X -> @foreach A (set A) _ P (\{ X }). Proof using. intros_all. rewrite in_single_eq in H0. subst*. Qed. Lemma foreach_union : forall P E F, foreach P E -> foreach P F -> foreach P (E \u F). Proof using. intros_all. destruct~ (in_union_inv H1). Qed. Lemma foreach_union_inv : forall P E F, foreach P (E \u F) -> foreach P E /\ foreach P F. Proof using. introv H. split; introv K. apply H. rewrite~ @in_union_eq. typeclass. apply H. rewrite~ @in_union_eq. typeclass. Qed. Lemma foreach_union_eq : forall P E F, foreach P (E \u F) = (foreach P E /\ foreach P F). Proof using. intros. extens. iff. apply~ foreach_union_inv. intuition eauto using foreach_union. Qed. Lemma foreach_single_eq : forall P X, foreach P (\{X}:set A) = P X. Proof using. intros. extens. iff. apply H. apply in_single_self. apply~ foreach_single. Qed. Lemma foreach_weaken : forall P Q E, foreach P E -> pred_le P Q -> foreach Q E. Proof using. introv H L K. apply~ L. Qed. Lemma foreach_remove_simple : forall P E F, foreach P E -> foreach P (E \- F). Proof using. introv M H. applys M. rewrite in_remove_eq in H. autos*. Qed. Lemma foreach_remove : forall P Q E F, foreach P E -> pred_le P (fun (x:A) => x \notin F -> Q x) -> foreach Q (E \- F). Proof using. introv M H Px. rewrite in_remove_eq in Px. applys* H. Qed. Lemma foreach_notin_prove : forall P x E, foreach P E -> ~ P x -> x \notin E. Proof using. introv M N I. applys N. applys~ M. Qed. End ForeachProp. Hint Resolve foreach_empty foreach_single foreach_union. Hint Rewrite foreach_union_eq foreach_single_eq : rew_foreach. Tactic Notation "rew_foreach" := autorewrite with rew_foreach. Tactic Notation "rew_foreach" "in" hyp(H) := autorewrite with rew_foreach in H. Tactic Notation "rew_foreach" "in" "*" := autorewrite_in_star_patch ltac:(fun tt => autorewrite with rew_foreach). (* autorewrite with rew_foreach in *. *) Tactic Notation "rew_foreach" "~" := rew_foreach; auto_tilde. Tactic Notation "rew_foreach" "*" := rew_foreach; auto_star. Tactic Notation "rew_foreach" "~" "in" constr(H) := rew_foreach in H; auto_tilde. Tactic Notation "rew_foreach" "*" "in" constr(H) := rew_foreach in H; auto_star. Tactic Notation "rew_foreach" "~" "in" "*" := rew_foreach in *; auto_tilde. Tactic Notation "rew_foreach" "*" "in" "*" := rew_foreach in *; auto_star. (* ********************************************************************** *) (** * Tactics *) (* DEPRECATED, use "set_prove" when possible *) (* ---------------------------------------------------------------------- *) (** ** Tactics to prove equalities on unions *) (* Documentation appears further on *) Lemma for_set_union_assoc : forall A, assoc (union (T:=set A)). Proof using. intros. apply union_assoc. Qed. Lemma for_set_union_comm : forall A, comm (union (T:=set A)). Proof using. intros. apply union_comm. Qed. Lemma for_set_union_empty_l : forall A (E:set A), \{} \u E = E. Proof using. intros. apply union_empty_l. Qed. Lemma for_set_union_empty_r : forall A (E:set A), E \u \{} = E. Proof using. intros. apply union_empty_r. Qed. Hint Rewrite <- for_set_union_assoc : rew_permut_simpl. Hint Rewrite for_set_union_empty_l for_set_union_empty_r : rew_permut_simpl. Ltac rew_permut_simpl := autorewrite with rew_permut_simpl; try typeclass. Ltac rews_permut_simpl := autorewrite with rew_permut_simpl in *; try typeclass. Section PermutationTactic. Context (A:Type). Implicit Types l : set A. Lemma permut_get_1 : forall l1 l2, (l1 \u l2) = (l1 \u l2). Proof using. intros. auto. Qed. Lemma permut_get_2 : forall l1 l2 l3, (l1 \u l2 \u l3) = (l2 \u l1 \u l3). Proof using. intros. apply union_comm_assoc. Qed. Lemma permut_get_3 : forall l1 l2 l3 l4, (l1 \u l2 \u l3 \u l4) = (l2 \u l3 \u l1 \u l4). Proof using. intros. do 2 rewrite (union_assoc l2). apply permut_get_2. Qed. Lemma permut_get_4 : forall l1 l2 l3 l4 l5, (l1 \u l2 \u l3 \u l4 \u l5) = (l2 \u l3 \u l4 \u l1 \u l5). Proof using. intros. do 2 rewrite (union_assoc l2). apply permut_get_3. Qed. Lemma permut_get_5 : forall l1 l2 l3 l4 l5 l6, (l1 \u l2 \u l3 \u l4 \u l5 \u l6) = (l2 \u l3 \u l4 \u l5 \u l1 \u l6). Proof using. intros. do 2 rewrite (union_assoc l2). apply permut_get_4. Qed. Lemma permut_get_6 : forall l1 l2 l3 l4 l5 l6 l7, (l1 \u l2 \u l3 \u l4 \u l5 \u l6 \u l7) = (l2 \u l3 \u l4 \u l5 \u l6 \u l1 \u l7). Proof using. intros. do 2 rewrite (union_assoc l2). apply permut_get_5. Qed. Lemma permut_get_7 : forall l1 l2 l3 l4 l5 l6 l7 l8, (l1 \u l2 \u l3 \u l4 \u l5 \u l6 \u l7 \u l8) = (l2 \u l3 \u l4 \u l5 \u l6 \u l7 \u l1 \u l8). Proof using. intros. do 2 rewrite (union_assoc l2). apply permut_get_6. Qed. Lemma permut_get_8 : forall l1 l2 l3 l4 l5 l6 l7 l8 l9, (l1 \u l2 \u l3 \u l4 \u l5 \u l6 \u l7 \u l8 \u l9) = (l2 \u l3 \u l4 \u l5 \u l6 \u l7 \u l8 \u l1 \u l9). Proof using. intros. do 2 rewrite (union_assoc l2). apply permut_get_7. Qed. Lemma permut_cancel_1 : forall l1 l2, (l1 \u l1 \u l2) = l1 \u l2. Proof using. intros. rewrite union_assoc. rewrite union_self. auto. Qed. Lemma permut_cancel_2 : forall l1 l2 l3, (l1 \u l2 \u l1 \u l3) = (l1 \u l2 \u l3). Proof using. intros. rewrite <- (@permut_get_2 l1). apply permut_cancel_1. Qed. Lemma permut_cancel_3 : forall l1 l2 l3 l4, (l1 \u l2 \u l3 \u l1 \u l4) = (l1 \u l2 \u l3 \u l4). Proof using. intros. rewrite <- (@permut_get_3 l1). apply permut_cancel_1. Qed. Lemma permut_cancel_4 : forall l1 l2 l3 l4 l5, (l1 \u l2 \u l3 \u l4 \u l1 \u l5) = (l1 \u l2 \u l3 \u l4 \u l5). Proof using. intros. rewrite <- (@permut_get_4 l1). apply permut_cancel_1. Qed. Lemma permut_cancel_5 : forall l1 l2 l3 l4 l5 l6, (l1 \u l2 \u l3 \u l4 \u l5 \u l1 \u l6) = (l1 \u l2 \u l3 \u l4 \u l5 \u l6). Proof using. intros. rewrite <- (@permut_get_5 l1). apply permut_cancel_1. Qed. Lemma permut_tactic_setup : forall l1 l2, (\{} \u l1 \u \{}) = (l2 \u \{}) -> l1 = l2. Proof using. intros. rews_permut_simpl. Qed. Lemma permut_tactic_keep : forall l1 l2 l3 l4, ((l1 \u l2) \u l3) = l4 -> (l1 \u (l2 \u l3)) = l4. Proof using. intros. rews_permut_simpl. Qed. Lemma permut_tactic_simpl : forall l1 l2 l3 l4, (l1 \u l3) = l4 -> (l1 \u (l2 \u l3)) = (l2 \u l4). Proof using. intros. subst. apply permut_get_2. Qed. Lemma permut_tactic_trans : forall l1 l2 l3, l3 = l2 -> l1 = l3 -> l1 = l2. Proof using. intros. subst~. Qed. End PermutationTactic. (** [permut_lemma_get n] returns the lemma [permut_get_n] for the given value of [n] *) Ltac permut_lemma_get n := match nat_from_number n with | 1%nat => constr:(permut_get_1) | 2%nat => constr:(permut_get_2) | 3%nat => constr:(permut_get_3) | 4%nat => constr:(permut_get_4) | 5%nat => constr:(permut_get_5) end. (** [permut_prepare] applies to a goal of the form [permut l l'] and sets [l] and [l'] in the form [l1 \u l2 \u .. \u \{}], (some of the lists [li] are put in the form [x::\{}]). *) Ltac permut_simpl_prepare := rew_permut_simpl; apply permut_tactic_setup; repeat rewrite <- union_assoc. (* todo : doc *) Ltac cancel_all_dup l := repeat first [ rewrite (permut_cancel_1 l) | rewrite (permut_cancel_2 l) | rewrite (permut_cancel_3 l) | rewrite (permut_cancel_4 l) | rewrite (permut_cancel_5 l) ]. Ltac permut_index_of l lcontainer := match constr:(lcontainer) with | l \u _ => constr:(1) | _ \u l \u _ => constr:(2) | _ \u _ \u l \u _ => constr:(3) | _ \u _ \u _ \u l \u _ => constr:(4) | _ \u _ \u _ \u _ \u l \u _ => constr:(5) | _ \u _ \u _ \u _ \u _ \u l \u _ => constr:(6) | _ \u _ \u _ \u _ \u _ \u _ \u l \u _ => constr:(7) | _ \u _ \u _ \u _ \u _ \u _ \u _ \u l \u _ => constr:(8) | _ => constr:(0) (* not found *) end. (** [permut_simplify] simplifies a goal of the form [permut l l'] where [l] and [l'] are lists built with concatenation and consing, by cancelling syntactically equal elements *) Ltac permut_simpl_once := match goal with | |- (_ \u \{}) = _ => fail 1 | |- (_ \u (?l \u ?lr)) = ?l' => cancel_all_dup l; match permut_index_of l l' with | 0 => apply permut_tactic_keep | ?n => let F := permut_lemma_get n in eapply permut_tactic_trans; [ eapply F; try typeclass | apply permut_tactic_simpl ] end end. Ltac permut_simpl := permut_simpl_prepare; repeat permut_simpl_once; rew_permut_simpl; try apply refl_equal. (* TODO: move demos somewhere else *) Section DemoSetUnion. Variables (A:Type). Lemma demo_set_union_permut_simpl_1 : forall l1 l2 l3 : set A, (l1 \u l2 \u l3 \u l1) = (l3 \u l2 \u l1). Proof using. intros. permut_simpl_prepare. permut_simpl_once. permut_simpl_once. permut_simpl_once. rew_permut_simpl. Qed. Lemma demo_set_union_permut_simpl_2 : forall (x:A) l1 l2 l3, (l1 \u \{x} \u l3 \u l2) = (l1 \u l2 \u (\{x} \u l3)). Proof using. intros. permut_simpl_prepare. permut_simpl_once. permut_simpl_once. permut_simpl_once. permut_simpl_once. rew_permut_simpl. Qed. Lemma demo_set_union_permut_simpl_3 : forall (x y:A) l1 l1' l2 l3, l1 = l1' -> (l1 \u (\{x} \u l2) \u \{x} \u (\{y} \u l3)) = (\{y} \u (l1' \u l2) \u (\{x} \u l3)). Proof using. intros. permut_simpl_prepare. permut_simpl_once. permut_simpl_once. permut_simpl_once. permut_simpl_once. permut_simpl_once. try permut_simpl_once. rew_permut_simpl. Qed. End DemoSetUnion. (* ---------------------------------------------------------------------- *) (** ** Tactics to prove membership *) (* DEPRECATED: use "set_prove" when possible *) Section InUnionGet. Variables (A:Type). Implicit Types l : set A. Lemma in_union_get_1 : forall x l1 l2, x \in l1 -> x \in (l1 \u l2). Proof using. intros. apply in_union_l. auto. Qed. Lemma in_union_get_2 : forall x l1 l2 l3, x \in l2 -> x \in (l1 \u l2 \u l3). Proof using. intros. apply in_union_r. apply~ in_union_get_1. Qed. Lemma in_union_get_3 : forall x l1 l2 l3 l4, x \in l3 -> x \in (l1 \u l2 \u l3 \u l4). Proof using. intros. apply in_union_r. apply~ in_union_get_2. Qed. Lemma in_union_get_4 : forall x l1 l2 l3 l4 l5, x \in l4 -> x \in (l1 \u l2 \u l3 \u l4 \u l5). Proof using. intros. apply in_union_r. apply~ in_union_get_3. Qed. Lemma in_union_get_5 : forall x l1 l2 l3 l4 l5 l6, x \in l5 -> x \in (l1 \u l2 \u l3 \u l4 \u l5 \u l6). Proof using. intros. apply in_union_r. apply~ in_union_get_4. Qed. End InUnionGet. Implicit Arguments in_union_get_1 [A x l1 l2]. Implicit Arguments in_union_get_2 [A x l1 l2 l3]. Implicit Arguments in_union_get_3 [A x l1 l2 l3 l4]. Implicit Arguments in_union_get_4 [A x l1 l2 l3 l4 l5]. Implicit Arguments in_union_get_5 [A x l1 l2 l3 l4 l5 l6]. Ltac in_union_get := match goal with H: ?x \in ?A |- ?x \in ?B => match B with context [A] => let go tt := first [ apply (in_union_get_1 H) | apply (in_union_get_2 H) | apply (in_union_get_3 H) | apply (in_union_get_4 H) | apply (in_union_get_5 H) ] in first [ go tt | rewrite <- (for_set_union_empty_r B); repeat rewrite <- for_set_union_assoc; go tt ] end end. Hint Extern 3 (_ \in _ \u _) => in_union_get. Section InUnionExtract. Variables (A:Type). Implicit Types l : set A. Lemma in_union_extract_1 : forall x l1, x \in (\{x} \u l1). Proof using. intros. apply in_union_get_1. apply in_single_self. Qed. Lemma in_union_extract_2 : forall x l1 l2, x \in (l1 \u \{x} \u l2). Proof using. intros. apply in_union_get_2. apply in_single_self. Qed. Lemma in_union_extract_3 : forall x l1 l2 l3, x \in (l1 \u l2 \u \{x} \u l3). Proof using. intros. apply in_union_get_3. apply in_single_self. Qed. Lemma in_union_extract_4 : forall x l1 l2 l3 l4, x \in (l1 \u l2 \u l3 \u \{x} \u l4). Proof using. intros. apply in_union_get_4. apply in_single_self. Qed. Lemma in_union_extract_5 : forall x l1 l2 l3 l4 l5, x \in (l1 \u l2 \u l3 \u l4 \u \{x} \u l5). Proof using. intros. apply in_union_get_5. apply in_single_self. Qed. End InUnionExtract. Ltac in_union_extract := match goal with |- ?x \in ?A => match A with context [\{x}] => let go tt := first [ apply (in_union_extract_1) | apply (in_union_extract_2) | apply (in_union_extract_3) | apply (in_union_extract_4) | apply (in_union_extract_5) ] in first [ go tt | rewrite <- (for_set_union_empty_r A); repeat rewrite <- for_set_union_assoc; go tt ] end end. Hint Extern 3 (_ \in _) => in_union_extract. (* ---------------------------------------------------------------------- *) (** ** Tactics to invert a membership hypothesis *) (* TODO: document and clean up *) Section InversionsTactic. Context (A:Type). Implicit Types l : set A. Implicit Types x : A. Lemma empty_eq_single_inv_1 : forall x l1 l2, l1 = l2 -> x \notin l1 -> x \in l2 -> False. Proof using. intros. subst*. Qed. Lemma empty_eq_single_inv_2 : forall x l1 l2, l1 = l2 -> x \notin l2 -> x \in l1 -> False. Proof using. intros. subst*. Qed. Lemma notin_empty : forall x, x \notin (\{}:set A). Proof using. intros. unfold notin. rewrite in_empty_eq. auto. Qed. End InversionsTactic. Hint Resolve notin_empty. Ltac in_union_meta := match goal with | |- _ \in \{_} => apply in_single_self | |- _ \in \{_} \u _ => apply in_union_l; apply in_single_self | |- _ \in _ \u _ => apply in_union_r; in_union_meta end. Ltac fset_inv_core_for H := let go L := false L; [ apply H | try apply notin_empty | instantiate; try in_union_meta ] in match type of H with | \{} = _ => go empty_eq_single_inv_1 | _ = \{} => go empty_eq_single_inv_2 | _ = _ => go empty_eq_single_inv_1 end. Tactic Notation "fset_inv" constr(H) := fset_inv_core_for H. Ltac fset_inv_core := match goal with | |- \{} <> _ => let H := fresh in intro H; fset_inv H | |- _ <> \{} => let H := fresh in intro H; fset_inv H | H: \{} = _ |- _ => fset_inv H | H: _ = \{} |- _ => fset_inv H end. Tactic Notation "fset_inv" := fset_inv_core. Section InUnionInv. Variables (A:Type). Implicit Types l : set A. Lemma set_in_empty_inv : forall x, x \in (\{}:set A) -> False. Proof using. introv. apply notin_empty. Qed. Lemma set_in_single_inv : forall x y : A, x \in (\{y}:set A) -> x = y. Proof using. intros. rewrite @in_single_eq in H. auto. typeclass. Qed. Lemma set_in_union_inv : forall x l1 l2, x \in (l1 \u l2) -> x \in l1 \/ x \in l2. Proof using. introv H. rewrite @in_union_eq in H. auto. typeclass. Qed. End InUnionInv. Implicit Arguments set_in_single_inv [A x y]. Implicit Arguments set_in_union_inv [A x l1 l2]. Ltac set_in_inv_base H M := match type of H with | _ \in \{} => false; apply (@set_in_empty_inv _ _ H) | _ \in \{_} => generalize (set_in_single_inv H); try clear H; intro_subst | _ \in _ \u _ => let H' := fresh "TEMP" in destruct (set_in_union_inv H) as [H'|H']; try clear H; set_in_inv_base H' M | _ => rename H into M end. Tactic Notation "set_in" constr(H) "as" ident(M) := set_in_inv_base H M. Tactic Notation "set_in" constr(H) := let M := fresh "H" in set_in H as M. (* ---------------------------------------------------------------------- *) (** ** Tactic to prove two sets equal by double-inclusion *) (* DEPRECATED: use "set_prove" instead when possible *) Tactic Notation "eq_set" := let H := fresh "TEMP" in apply set_ext; iff H; set_in H; in_union_get. Tactic Notation "eq_set" "*" := eq_set; auto_star. (* ---------------------------------------------------------------------- *) (* ---------------------------------------------------------------------- *) (* FUTURE (** Sets of sets *) (* todo: typeclass for bigunion and bigintersection *) Definition bigunion_impl A (E : set (set A)) : set A := \set{ x | exists_ F \in E, x \in (F:set A) }. Definition biguinter_impl A (E : set (set A)) : set A := \set{ x | forall_ F \in E, x \in (F:set A) }. *)
-- -- An instance of this template must have a $Export section and the export_terminals option -- -- Macros that may be redefined in an instance of this template -- -- $eof_token -- $additional_interfaces -- $super_stream_class -- subclass com.ibm.lpg.LpgLexStream for getKind -- $prs_stream_class -- use /.PrsStream./ if not subclassing -- $super_class -- -- B E G I N N I N G O F T E M P L A T E LexerTemplateF -- %Options programming_language=rt_cpp,margin=4 %Options table %options action-block=("*.h", "/.", "./") %options ParseTable=ParseTable %Options prefix=Char_ -- -- This template requires that the name of the EOF token be set -- to EOF and that the prefix be "Char_" to be consistent with -- KeywordTemplateD. -- %Eof EOF %End -- -- This template also requires that the name of the parser EOF -- Token to be exported be set to EOF_TOKEN -- %Export EOF_TOKEN %End %Define -- -- Macros that are be needed in an instance of this template -- $eof_token /.$_EOF_TOKEN./ $additional_interfaces /../ $super_stream_class /.$file_prefix$LpgLexStream./ $prs_stream_class /.IPrsStream./ $super_class /.Object./ $prs_stream /. // macro prs_stream is deprecated. Use function getPrsStream getPrsStream()./ $setSym1 /. // macro setSym1 is deprecated. Use function setResult lexParser->setSym1./ $setResult /. // macro setResult is deprecated. Use function setResult lexParser->setSym1./ $getSym /. // macro getSym is deprecated. Use function getLastToken lexParser->getSym./ $getToken /. // macro getToken is deprecated. Use function getToken lexParser->getToken./ $getLeftSpan /. // macro getLeftSpan is deprecated. Use function getLeftSpan lexParser->getFirstToken./ $getRightSpan /. // macro getRightSpan is deprecated. Use function getRightSpan lexParser->getLastToken./ -- -- Macros useful for specifying actions -- $Header /. // // Rule $rule_number: $rule_text // ./ $DefaultAction /.$Header$case $rule_number: { ./ $BeginAction /.$DefaultAction./ $EndAction /. break; }./ $BeginJava /.$BeginAction $symbol_declarations./ $EndJava /.$EndAction./ $NoAction /.$Header$case $rule_number: break; ./ $BeginActions /. void ruleAction(int ruleNumber) { switch(ruleNumber) {./ $SplitActions /. default: ruleAction$rule_number(ruleNumber); break; } return; } void ruleAction$rule_number(int ruleNumber) { switch (ruleNumber) {./ $EndActions /. default: break; } return; }./ %End %Globals /. ./ %End %Headers /. #pragma once #include <iostream> #include "IPrsStream.h" #include "Object.h" #include "ParseTable.h" #include "RuleAction.h" #include "stringex.h" #include "Token.h" #include "$sym_type.h" #include "$prs_type.h" #include "$kw_lexer_class.h" #include "LexParser.h" #include "LpgLexStream.h" struct $action_type :public $super_class ,public RuleAction$additional_interfaces { struct $super_stream_class; $super_stream_class * lexStream = nullptr; ~$action_type(){ delete lexStream; delete lexParser; } inline static ParseTable* prs = new $prs_type(); ParseTable* getParseTable() { return prs; } LexParser* lexParser = new LexParser(); LexParser* getParser() { return lexParser; } int getToken(int i) { return lexParser->getToken(i); } int getRhsFirstTokenIndex(int i) { return lexParser->getFirstToken(i); } int getRhsLastTokenIndex(int i) { return lexParser->getLastToken(i); } int getLeftSpan() { return lexParser->getToken(1); } int getRightSpan() { return lexParser->getLastToken(); } void resetKeywordLexer() { if (kwLexer == nullptr) this->kwLexer = new $kw_lexer_class(lexStream->getInputChars(), $_IDENTIFIER); else this->kwLexer->setInput(lexStream->getInputChars()); } void reset(const std::wstring& filename, int tab) { delete lexStream; lexStream = new $super_stream_class(filename, tab); lexParser->reset((ILexStream*) lexStream, prs, this); resetKeywordLexer(); } void reset(shared_ptr_wstring input_chars, const std::wstring& filename) { reset(input_chars, filename, 1); } void reset(shared_ptr_wstring input_chars, const std::wstring& filename, int tab) { delete lexStream; lexStream = new $super_stream_class(input_chars, filename, tab); lexParser->reset((ILexStream*) lexStream, prs, this); resetKeywordLexer(); } $action_type(const std::wstring& filename, int tab) { reset(filename, tab); } $action_type(shared_ptr_wstring input_chars, const std::wstring& filename, int tab) { reset(input_chars, filename, tab); } $action_type(shared_ptr_wstring input_chars, const std::wstring& filename) { reset(input_chars, filename, 1); } $action_type() {} ILexStream* getILexStream() { return lexStream; } /** * @deprecated replaced by {@link #getILexStream()} */ ILexStream* getLexStream() { return lexStream; } void initializeLexer($prs_stream_class *prsStream, int start_offset, int end_offset) { if (!lexStream->getInputChars()) throw std::exception("LexStream was not initialized"); lexStream->setPrsStream(prsStream); prsStream->makeToken(start_offset, end_offset, 0); // Token list must start with a bad token } void addEOF($prs_stream_class *prsStream, int end_offset) { prsStream->makeToken(end_offset, end_offset, $eof_token); // and end with the end of file token prsStream->setStreamLength(prsStream->getSize()); } void lexer($prs_stream_class *prsStream) { lexer(nullptr, prsStream); } void lexer(Monitor *monitor, $prs_stream_class *prsStream) { initializeLexer(prsStream, 0, -1); lexParser->parseCharacters(monitor); // Lex the input characters addEOF(prsStream, lexStream->getStreamIndex()); } void lexer($prs_stream_class *prsStream, int start_offset, int end_offset) { lexer(nullptr, prsStream, start_offset, end_offset); } void lexer(Monitor* monitor, $prs_stream_class *prsStream, int start_offset, int end_offset) { if (start_offset <= 1) initializeLexer(prsStream, 0, -1); else initializeLexer(prsStream, start_offset - 1, start_offset - 1); lexParser->parseCharacters(monitor, start_offset, end_offset); addEOF(prsStream, (end_offset >= lexStream->getStreamIndex() ? lexStream->getStreamIndex() : end_offset + 1)); } IPrsStream::Range *incrementalLexer(shared_ptr_wstring input_chars, int start_change_offset, int end_change_offset) { int offset_adjustment = input_chars.size() - lexStream->getStreamLength(); //*System.out.println("The offset adjustment is " + offset_adjustment); if (start_change_offset <= 0 && start_change_offset < input_chars.size()) { std::string str = "The start offset "; std::stringex format; format.format("%d", (start_change_offset)); str += format; str += " is out of bounds for range 0.."; format.format("%d", (input_chars.size() - 1)); str += format; throw std::out_of_range(str); } if (end_change_offset <= 0 && end_change_offset < input_chars.size()) { std::string str = "The end offset "; std::stringex format; format.format("%d", (end_change_offset)); str += format; str += " is out of bounds for range 0.."; format.format("%d", (input_chars.size() - 1)); str += format; } // // Get the potential list of tokens to be rescanned // Tuple<IToken*> affected_tokens = lexStream->getIPrsStream()->incrementalResetAtCharacterOffset(start_change_offset); // // If the change occured between the first two affected tokens (or adjunct) and not immediately // on the characted after the first token (or adjunct), restart the scanning after the first // affected token. Otherwise, rescan the first token. // int affected_index = 0; int repair_offset = start_change_offset; if (affected_tokens.size() > 0) { auto _token_0 = affected_tokens.get(0); if (_token_0->getEndOffset() + 1 < start_change_offset) { repair_offset = _token_0->getEndOffset() + 1; if (dynamic_cast<Token*>(_token_0)) { lexStream->getIPrsStream()->makeToken(_token_0, 0); } else { lexStream->getIPrsStream()->makeAdjunct(_token_0, 0); } affected_index++; } else { repair_offset = _token_0->getStartOffset(); } } lexStream->setInputChars(input_chars); lexStream->setStreamLength(input_chars.size()); lexStream->computeLineOffsets(repair_offset); int first_new_token_index = lexStream->getIPrsStream()->getTokens().size(), first_new_adjunct_index = lexStream->getIPrsStream()->getAdjuncts().size(); resetKeywordLexer(); lexParser->resetTokenStream(repair_offset); int next_offset; do { //*System.out.println("Scanning token starting at " + (lexStream->peek() - 1)); next_offset = lexParser->incrementalParseCharacters(); //*System.out.print("***Remaining string: \""); //*for (int i = next_offset; i < input_chars.length; i++) //*System.out.print(input_chars[i]); //*System.out.println("\""); while (affected_index < affected_tokens.size() && affected_tokens.get(affected_index)->getStartOffset() + offset_adjustment < next_offset) //*{ //*System.out.println("---Skipping token " + affected_index + ": \"" + affected_tokens.get(affected_index).toString() + //*"\" starting at adjusted offset " + (affected_tokens.get(affected_index).getStartOffset() + offset_adjustment)); affected_index++; //*} } while(next_offset <= end_change_offset && // still in the damage region and ... (affected_index < affected_tokens.size() && // not resynchronized with a token in the list of affected tokens affected_tokens.get(affected_index)->getStartOffset() + offset_adjustment != next_offset)); // // If any new tokens were added, compute the first and the last one. // IToken* first_new_token = nullptr; IToken* last_new_token = nullptr; if (first_new_token_index < lexStream->getIPrsStream()->getTokens().size()) { first_new_token = lexStream->getIPrsStream()->getTokenAt(first_new_token_index); last_new_token = lexStream->getIPrsStream()->getTokenAt(lexStream->getIPrsStream()->getTokens().size() - 1); } // // If an adjunct was added prior to the first real token, chose it instead as the first token. // Similarly, if adjucts were added after the last token, chose the last adjunct added as the last token. // if (first_new_adjunct_index < lexStream->getIPrsStream()->getAdjuncts().size()) { if (first_new_token == nullptr || lexStream->getIPrsStream()->getAdjunctAt(first_new_adjunct_index)->getStartOffset() < first_new_token->getStartOffset()) { first_new_token = lexStream->getIPrsStream()->getAdjunctAt(first_new_adjunct_index); } if (last_new_token == nullptr || lexStream->getIPrsStream()->getAdjunctAt(lexStream->getIPrsStream()->getAdjuncts().size() - 1)->getEndOffset() > last_new_token->getEndOffset()) { last_new_token = lexStream->getIPrsStream()->getAdjunctAt(lexStream->getIPrsStream()->getAdjuncts().size() - 1); } } // // For all remainng tokens (and adjuncts) in the list of affected tokens add them to the // list of tokens (and adjuncts). // for (int i = affected_index; i < affected_tokens.size(); i++) { if ( dynamic_cast< Token*>(affected_tokens.get(i)) ) lexStream->getIPrsStream()->makeToken(affected_tokens.get(i), offset_adjustment); else lexStream->getIPrsStream()->makeAdjunct(affected_tokens.get(i), offset_adjustment); //*System.out.println("+++Added affected token " + i + ": \"" + affected_tokens.get(i).toString() + //*"\" starting at adjusted offset " + (affected_tokens.get(i).getStartOffset() + offset_adjustment)); } return new IPrsStream::Range(lexStream->getIPrsStream(), first_new_token, last_new_token); } /** * If a parse stream was not passed to this Lexical analyser then we * simply report a lexical error. Otherwise, we produce a bad token. */ void reportLexicalError(int startLoc, int endLoc) { IPrsStream* prs_stream = lexStream->getIPrsStream(); if (prs_stream == nullptr) lexStream->reportLexicalError(startLoc, endLoc); else { // // Remove any token that may have been processed that fall in the // range of the lexical error... then add one error token that spans // the error range. // for (int i = prs_stream->getSize() - 1; i > 0; i--) { if (prs_stream->getStartOffset(i) >= startLoc) prs_stream->removeLastToken(); else break; } prs_stream->makeToken(startLoc, endLoc, 0); // add an error token to the prsStream } } ./ %End %Rules /.$BeginActions./ %End %Trailers /. $EndActions }; ./ %End -- -- E N D O F T E M P L A T E --
module Fractals ( order , floatOrder , mandelbrot , bmp , tangentPoint , mandelbrotCardioid , mag2 , toBitmap ) where import Data.Complex (Complex(..), mkPolar) import Graphics.Gloss import qualified Data.ByteString as B import Data.Word import Control.Parallel.Strategies import Palette mag2:: Complex Double -> Double mag2 (a:+b) = a^(2::Int) + b^(2::Int) -- | Compute the order of a given complex function. order :: (Complex Double -> Complex Double) -- ^ a function on the complex plane -> Double -- ^ the escape radius squared -> Int -- ^ the maximum order -> Complex Double -- ^ a starting point -> (Int, Complex Double) -- ^ the order order f radius2 nMax z0 = let f' = \ (i, z) -> (i+1, f z) fs = dropWhile (\ (i, z) -> i<nMax && mag2 z < radius2) $ iterate f' (0, z0) in head fs -- | Compute the floating order of a given complex function. floatOrder :: (Complex Double -> Complex Double) -- ^ a function on the complex plane -> Double -- ^ the escape radius squared -> Int -- ^ the maximum order -> Complex Double -- ^ a starting point -> Double -- ^ the order floatOrder f radius2 nMax z0 = let (nu, z) = order f radius2 nMax z0 in fromIntegral nu - log (0.5 * (log $ mag2 z)) / log 2.0 -- | the Mandelbrot function: z^2 + c. mandelbrot :: Complex Double -- ^ the c parameter -> Complex Double -- ^ the z variable -> Complex Double -- ^ the resulting value mandelbrot (cr:+ci) (zr:+zi) = (cr + zr^(2::Int) - zi^(2::Int)) :+ (ci + 2*zr*zi) --mandelbrot c z = z**2 + c -- | Yield the point tangent to the main cardioid and to the bulb with period q -- and combinatorial rotation number r=p/q. tangentPoint :: Rational -> Complex Double tangentPoint r = mandelbrotCardioid $ mkPolar 1.0 (2.0 * pi * fromRational r) -- | The equation of the main cardioid. mandelbrotCardioid :: Complex Double -> Complex Double mandelbrotCardioid mu = 0.5 * mu * (1.0 - 0.5 * mu) bitmapFormat :: BitmapFormat bitmapFormat = BitmapFormat BottomToTop PxRGBA escapeRadius2 :: Double escapeRadius2 = 100000.0 maxIter :: Int maxIter = 255 bmpValues :: Int -> Int -> Double -> Double -> Double -> [Double] bmpValues w h xc yc picScale = let wf = fromIntegral w * picScale hf = fromIntegral h * picScale floatOrderFromIJ :: (Int, Int) -> Double floatOrderFromIJ (i,j) = let x0 = xc - 0.5*wf + (fromIntegral j)*wf/(fromIntegral (w-1)) y0 = yc - 0.5*hf + (fromIntegral i)*hf/(fromIntegral (h-1)) z0 = x0 :+ y0 in floatOrder (mandelbrot z0) escapeRadius2 maxIter z0 indices = (,) <$> [0..h-1] <*> [0..w-1] vals = map floatOrderFromIJ indices in vals `using` parListChunk h rseq toBitmap :: Palette -> [Double] -> [Word8] toBitmap _ [] = [] toBitmap palette l = let maxL = maximum l toBitmap' _ [] = [] toBitmap' maxX (x:xs) = let (r,g,b) = palette (x/maxX) in r:g:b:255:(toBitmap' maxX xs) in toBitmap' maxL l bmpByteString :: Int -> Int -> Double -> Double -> Double -> B.ByteString bmpByteString w h xc yc picScale = B.pack vals where vals = toBitmap hsv $ bmpValues w h xc yc picScale bmp :: Int -> Int -> Complex Double -> Double -> Picture bmp w h (xc :+ yc) picScale = bitmapOfByteString w h bitmapFormat (bmpByteString w h xc yc picScale) False
/** * Reactive * * (c) 2015-2016 Axel Etcheverry * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ #include <boost/test/unit_test.hpp> #include <reactive/web/router/parameters.hpp> #include <boost/test/unit_test.hpp> #include <reactive/web/router/route.hpp> #include <reactive/web/router/context.hpp> #include <reactive/web/resource.hpp> #include <reactive/http/request.hpp> class exception_test_resource: public reactive::web::resource { public: void getAction( const reactive::http::request& request_, const reactive::web::router::parameters& parameters_, reactive::http::response& response_ ) const { response_.setStatusCode(reactive::http::status::OK); response_.setContent("get action"); throw reactive::http::exception("Bad Request", reactive::http::status::BAD_REQUEST); } }; BOOST_AUTO_TEST_SUITE(reactive_web_router_context) BOOST_AUTO_TEST_CASE(test_context) { reactive::web::router::route r("/"); reactive::web::router::context context(r); context.setMethod("GET|POST"); BOOST_CHECK_EQUAL(context.hasMethod("GET"), true); BOOST_CHECK_EQUAL(context.hasMethod("POST"), true); BOOST_CHECK_EQUAL(context.hasMethod("PUT"), false); } // Testing match BOOST_AUTO_TEST_CASE(test_match) { // request object reactive::http::request request; // resource object reactive::web::resource resource; reactive::web::router::parameters parameters; // route object reactive::web::router::route r("/"); // context object reactive::web::router::context context(r); // set resource in context object context.setResource(resource); // set method in context object context.setMethod("GET|POST"); // check if context type is equal to reactive::web::router::TYPE_OBJECT BOOST_CHECK_EQUAL(context.getType(), reactive::web::router::TYPE_OBJECT); // set url in request object request.setUrl("http://dacteev.com/"); // set method in request object request.setMethod(reactive::http::protocol::METHOD_PUT); // check if context match with request BOOST_CHECK_EQUAL(context.match(request, parameters), false); // reset new method in request object request.setMethod(reactive::http::protocol::METHOD_GET); // recheck if context match with request object BOOST_CHECK_EQUAL(context.match(request, parameters), true); // check the path matching against the context route request.setUrl("http://dacteev.com/ads"); BOOST_CHECK_EQUAL(context.match(request, parameters), false); } BOOST_AUTO_TEST_CASE(test_handle_request) { reactive::http::request request; reactive::http::response response; reactive::web::resource resource; reactive::web::router::route route("/"); reactive::web::router::context context(route); reactive::web::router::parameters parameters; context.setResource(resource); context.setMethod("GET|POST"); // set url in request object request.setUrl("http://dacteev.com/"); // set method in request object request.setMethod(reactive::http::protocol::METHOD_GET); BOOST_CHECK_EQUAL(context.handleRequest(request, parameters, response), true); BOOST_CHECK_EQUAL(response.getStatusCode(), reactive::http::status::METHOD_NOT_ALLOWED); } BOOST_AUTO_TEST_CASE(test_handle_request_with_exception) { // request object reactive::http::request request; request.setUrl("http://dacteev.com/"); reactive::http::response response; // resource object exception_test_resource resource; reactive::web::router::parameters parameters; // route object reactive::web::router::route r("/"); // context object reactive::web::router::context context(r); // set resource in context object context.setResource(resource); // set method in context object context.setMethod("GET"); BOOST_CHECK_EQUAL(context.handleRequest(request, parameters, response), false); BOOST_CHECK_EQUAL(response.getStatusCode(), reactive::http::status::BAD_REQUEST); } BOOST_AUTO_TEST_CASE(test_to_log_exception_class) { // request object reactive::http::request request; request.setUrl("http://dacteev.com/"); reactive::http::response response; // resource object exception_test_resource resource; reactive::web::router::parameters parameters; // route object reactive::web::router::route r("/"); // context object reactive::web::router::context context(r); // set resource in context object context.setResource(resource); // set method in context object context.setMethod("GET"); reactive::http::exception ex("Bad Request", reactive::http::status::BAD_REQUEST); BOOST_CHECK_EQUAL( context.toLogException(ex, request), "exception_test_resource::getAction(...) => reactive::http::exception : Bad Request" ); } BOOST_AUTO_TEST_CASE(test_to_log_exception_func) { // request object reactive::http::request request; request.setUrl("http://dacteev.com/"); reactive::http::response response; reactive::web::router::parameters parameters; // route object reactive::web::router::route r("/"); // context object reactive::web::router::context context(r); // set resource in context object context.setResource([]( const reactive::http::request& request_, const reactive::web::router::parameters& parameters_, reactive::http::response& response_ ) -> void { response_.setStatusCode(reactive::http::status::OK); response_.setContent("get action"); throw reactive::http::exception("Bad Request", reactive::http::status::BAD_REQUEST); }); // set method in context object context.setMethod("GET"); reactive::http::exception ex("Bad Request", reactive::http::status::BAD_REQUEST); BOOST_CHECK_EQUAL( context.toLogException(ex, request), "app.match(\"/\", ...).method(\"GET\") => reactive::http::exception : Bad Request" ); context.setMethod("GET|POST"); BOOST_CHECK_EQUAL( context.toLogException(ex, request), "app.match(\"/\", ...).method(\"GET|POST\") => reactive::http::exception : Bad Request" ); } BOOST_AUTO_TEST_SUITE_END()
% % Usage: AAt =mexCalcAAt(A); % % Name: mexCalcAAt % % Description: Compute efficiently AAt = A*A', when A is sparse % and has a lot more columns than rows. In some cases, it is % up to 20 times faster than the equivalent Matlab expression % AAt=A*A'; % % Inputs: A: double sparse m x n matrix % % Output: AAt: double m x m matrix % % Author: Julien Mairal, 2009
-- Andreas, 2019-06-26, issue #3855 -- Mark erased hypotheses as such in a non-erased goal. -- Same for irrelevance. Goal : ( A : Set) (@0 B : Set) (@irr C : Set) (@0 @irr D : Set) ( A : Set) (@0 B : Set) (@irr C : Set) (@0 @irr D : Set) → Set Goal A B C D = λ A B C D → {!!} -- Goal: Set -- ———————————————————————————————————————————————————————————— -- D : Set (erased, irrelevant) -- C : Set (irrelevant) -- B : Set (erased) -- A : Set -- D = D₁ : Set (not in scope, erased, irrelevant) -- C = C₁ : Set (not in scope, irrelevant) -- B = B₁ : Set (not in scope, erased) -- A = A₁ : Set (not in scope) -- Don't show erasure in erased goal! @0 ErasedGoal : ( A : Set) (@0 B : Set) (@irr C : Set) (@0 @irr D : Set) ( A : Set) (@0 B : Set) (@irr C : Set) (@0 @irr D : Set) → Set ErasedGoal A B C D = λ A B C D → {!!} -- Goal: Set -- ———————————————————————————————————————————————————————————— -- D : Set (irrelevant) -- C : Set (irrelevant) -- B : Set -- A : Set -- D = D₁ : Set (not in scope, irrelevant) -- C = C₁ : Set (not in scope, irrelevant) -- B = B₁ : Set (not in scope) -- A = A₁ : Set (not in scope) -- Don't show irrelevance in irrelevant goal! @irr IrrGoal : ( A : Set) (@0 B : Set) (@irr C : Set) (@0 @irr D : Set) ( A : Set) (@0 B : Set) (@irr C : Set) (@0 @irr D : Set) → Set IrrGoal A B C D = λ A B C D → {!!} -- Goal: Set -- ———————————————————————————————————————————————————————————— -- D : Set (erased) -- C : Set -- B : Set (erased) -- A : Set -- D = D₁ : Set (not in scope, erased) -- C = C₁ : Set (not in scope) -- B = B₁ : Set (not in scope, erased) -- A = A₁ : Set (not in scope)
SUBROUTINE WF_QUARTC & (fourb3,sixb2,fourb1,b0,q) c Finds the roots of a quartic polynomial from the closed form. implicit real*8 (a-h,o-z) character*200 error_msg real * 8 mgplus,mgmnus complex * 16 b3,b2,b1,b0,q,fourb3,sixb2,fourb1,b3sq,h,i,g, & hprime,gprime,sqroot,pplus,p,cbert0,cbert1,cbert2, & rootp,rootq,rootr dimension q(4),part(2) equivalence (p,part) b3=fourb3*0.25d0 b2=sixb2/6.d0 b1=fourb1*0.25d0 b3sq=b3**2 h=b2-b3sq i=b0-4.d0*b3*b1+3.d0*b2**2 g=b1+b3*(-3.d0*b2+2.d0*b3sq) hprime=-i/12.d0 gprime=-g**2/4.d0-h*(h**2+3.d0*hprime) sqroot=SQRT(gprime**2+4.d0*hprime**3) p=(-gprime+sqroot)*0.5d0 mgplus=ABS(part(1))+ABS(part(2)) pplus=p p=(-gprime-sqroot)*0.5d0 mgmnus=ABS(part(1))+ABS(part(2)) if (mgplus .gt. mgmnus) p=pplus cbert0=EXP(LOG(p)/3.d0) cbert1=cbert0*(-.5d0, .8660254038d0) cbert2=cbert0*(-.5d0,-.8660254038d0) rootp=SQRT(cbert0-hprime/cbert0-h) rootq=SQRT(cbert1-hprime/cbert1-h) rootr=SQRT(cbert2-hprime/cbert2-h) if (ABS(g) .gt. 1.d-30) then sign=-rootp*rootq*rootr*2.d0/g if (sign .lt. 0.d0) rootr=-rootr end if q(1)=+rootp+rootq+rootr-b3 q(2)=+rootp-rootq-rootr-b3 q(3)=-rootp+rootq-rootr-b3 q(4)=-rootp-rootq+rootr-b3 do n=1,4 iter=0 do while (iter .le. 10) rootp=(((q(n)+fourb3)*q(n)+sixb2)*q(n)+fourb1)*q(n)+b0 rootq=((4.d0*q(n)+3.d0*fourb3)*q(n)+2.d0*sixb2)*q(n)+fourb1 rootr=rootp/rootq q(n)=q(n)-rootr if (ABS(rootr) .lt. 1.d-10) then iter=99 else iter=iter+1 end if end do if (iter .eq. 11) then write(error_msg, & '(''[WF_QUARTC]: '', & ''q= '',1p2e13.5,'' fails to converge after'',i3,1x, & ''iterations'')') & q(n),iter call LWPC_ERROR ('Warning',error_msg) end if end do RETURN END ! WF_QUARTC
function par_estc % transport parameter estimation with derivatives Holzbecher January 2006 global xfit cfit T D c0 c1 % Example values for Chlorid in Marmara Sea Sediment Core T = 3.15e11; % [s] 10.000 years D = 1.0e-5; % [cm*cm/s] c0 = 0; % [mmol/l] c1 = 619; % [mmol/l] xmax = 4000; % [cm] % specify fitting data xfit = [0 20 40 60 100 120 140 160 215 255 275 300 375 450 525 600 750 1050 1200 1350 1650 1950 2250 2550 2700 3000 3450 3900]; cfit = [619 597 608 615 619 615 621 571 621 618 619 625 577 612 608 612 609 590 582 582 556 494 457 489 487 444 381 371]; x = [0:xmax/400:xmax]; options = optimset('Display','iter','TolFun',1e-9); v = fzero(@myfun,0.2e-8,options); display (['Best fit for v = ' num2str(v)]); h = 1./(2.*sqrt(D*T)); e = diag(eye(size(x,2))); plot (xfit,cfit,'o',x,c0+0.5*c1*(erfc(h*(x-v*T*e'))+(exp((v/D)*x)).*erfc(h*(x+v*T*e'))),'-'); legend ('given','modelled'); xlabel ('depth [cm]'); ylabel ('chloride concentration [mmol/l]'); text(0.1*xmax,c1*0.65,['sedimentation velocity [cm/a]: ' num2str(v*3.15e7)]); e = diag(eye(size(xfit,2))); normc = norm(cfit-c0+0.5*c1*(erfc(h*(xfit-v*T*e'))+(exp((v/D)*xfit)).*erfc(h*(xfit+v*T*e')))); text(0.1*xmax,c1*0.6,['norm of residuals: ' num2str(normc)]); function f = myfun(v) global xfit cfit T D c0 c1 e=diag(eye(size(xfit,2))); h=1./(2.*sqrt(D*T)); arg1 = h*(xfit-v*T*e'); arg2 = h*(xfit+v*T*e'); arg3 = (v/D)*xfit; % solve advection diffusion equation for c with c(t=0)=c0 and c(x=0)=c1 c = c0 + 0.5*c1*(erfc(arg1)+(exp(arg3).*erfc(arg2))); % compute derivative of solution due to v cv = c1*((T*h/sqrt(pi))*(exp(-arg1.*arg1)-exp(arg3).*exp(-arg2.*arg2))+0.5*(xfit/D).*exp(arg3).*erfc(arg2)); % specify function f to vanish f = 2*(c-cfit)*cv';
import os import time import cv2 import numpy as np from PIL import ImageColor from darknet_video.utils.nms import py_cpu_nms box_colormap = ["NAVY", "AQUA", "TEAL", "OLIVE", "GREEN", "LIME", "ORANGE", "RED", "MAROON", "FUCHSIA", "PURPLE", "GRAY", "SILVER"] color_len = len(box_colormap) ft = cv2.freetype.createFreeType2() if os.name == 'nt': ft.loadFontData(fontFileName="C:\\Windows\\Fonts\\kaiu.ttf", id=0) else: ft.loadFontData(fontFileName='/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc', id=0) def convert_back(x, y, w, h): xmin = int(round(x - (w / 2))) xmax = int(round(x + (w / 2))) ymin = int(round(y - (h / 2))) ymax = int(round(y + (h / 2))) return xmin, ymin, xmax, ymax def convert_to(xmin, ymin, xmax, ymax): x = int(round((xmin + xmax) / 2)) y = int(round((ymin + ymax) / 2)) w = int(round(xmax - xmin)) h = int(round(ymax - ymin)) return x, y, w, h def to_center(x, y, w, h): x = x + w / 2 y = y + h / 2 return x, y, w, h def cv_draw_boxes(detections, img, box_color=None, use_uid=False): for detection in detections: b = detection["coord"] xmin, ymin, xmax, ymax = detection["box_xy"] pt1 = (xmin, ymin) pt2 = (xmax, ymax) color = _choose_color(box_color, detection, use_uid) cv2.rectangle(img, pt1, pt2, color, 2) ft.putText(img=img, text="%s [%.2f] [%d]" % (detection["name"], detection["confidence"] * 100, b["w"] * b["h"]), org=(pt1[0], pt1[1] - 5), fontHeight=30, color=color, thickness=-1, line_type=cv2.LINE_AA, bottomLeftOrigin=True) return img def cv_draw_text(text, img, offset=160): ft.putText(img=img, text=text, org=(img.shape[1] - offset, 0), fontHeight=40, color=(0, 0, 255), thickness=-1, line_type=cv2.LINE_AA, bottomLeftOrigin=False) return img def all_nms(dets, box_arr, overlapThresh): box_arr = np.array(box_arr) pick = py_cpu_nms(box_arr, overlapThresh) for i, det in enumerate(dets): if i in pick: yield det def sort_confid(dets, box_arr): box_arr = np.array(box_arr) scores = box_arr[:, 4] # bbox打分 highest = scores.argsort()[-1] return [dets[highest]] def _choose_color(box_color, detection, use_uid): if box_color is None: if not use_uid: uid = detection["class_id"] else: uid = detection.state.uid color = ImageColor.getrgb(box_colormap[uid % color_len]) else: color = ImageColor.getrgb(box_color) color = list(reversed(color)) return color def gui_threading(stream): for win_name in ["yolo_raw"]: while stream.__dict__[win_name] is None: time.sleep(0.01) img = stream.__dict__[win_name] cv2.namedWindow(win_name, cv2.WINDOW_NORMAL) cv2.resizeWindow(win_name, *reversed(img.shape[:2])) while True: for win_name in ["yolo_raw"]: img = stream.__dict__[win_name] cv2.imshow(win_name, img) cv2.waitKey(1)
------------------------------------------------------------------------ -- The Agda standard library -- -- A pointwise lifting of a relation to incorporate a new infimum. ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} -- This module is designed to be used with -- Relation.Nullary.Construct.Add.Infimum open import Relation.Binary module Relation.Binary.Construct.Add.Infimum.Equality {a ℓ} {A : Set a} (_≈_ : Rel A ℓ) where open import Relation.Binary.Construct.Add.Point.Equality _≈_ public renaming (_≈∙_ to _≈₋_ ; ∙≈∙ to ⊥₋≈⊥₋ ; ≈∙-refl to ≈₋-refl ; ≈∙-sym to ≈₋-sym ; ≈∙-trans to ≈₋-trans ; ≈∙-dec to ≈₋-dec ; ≈∙-irrelevant to ≈₋-irrelevant ; ≈∙-substitutive to ≈₋-substitutive ; ≈∙-isEquivalence to ≈₋-isEquivalence ; ≈∙-isDecEquivalence to ≈₋-isDecEquivalence )
With a large portion of his fleet no longer battleworthy , Howe was unable to resume his search for the French convoy in the Bay of Biscay . The Admiralty , though unaware of Howe 's specific circumstances , knew a battle had taken place through the arrival of HMS Audacious in Portsmouth , and was preparing a second expedition under George Montagu . Montagu had returned to England after his unsuccessful May cruise , and was refitting in Portsmouth when ordered to sea again . His force of ten ships was intended to both cover Howe 's withdrawal from Biscay , and find and attack the French grain convoy . Montagu returned to sea on 3 June , and by 8 June was off Ushant searching for signs of either the French or Howe ; unknown to him , neither had yet entered European waters . At 15 : 30 on 8 June Montagu spotted sails , and soon identified them as the enemy . He had located Cornic 's squadron , which was also patrolling for the convoy and the returning fleets . Montagu gave chase and drove Cornic into <unk> Bay , where he blockaded the French squadron overnight , hoping to bring them to action the following day . However , on 9 June , Montagu sighted 19 French ships appearing from the west — the remnants of Villaret 's fleet . Hastily turning his ships , Montagu sailed south to avoid becoming trapped between two forces which might easily overwhelm him . Villaret and Cornic gave chase for a day before turning east towards the safety of the French ports .
#ifndef SIMULATION_STEPS #define SIMULATION_STEPS #include <gsl/gsl_matrix.h> extern void calculateLIFTVolMat(int N, int Np, gsl_matrix **LIFT, gsl_matrix **VolMat, gsl_matrix** MassMatrix); extern void store_mesh(char *Mesh); extern void initialize(); extern void time_evolution(double FinalTime); extern void boundary_conditions(); #endif
# Routines for extracting segment/face data for tracks (rays) overlaid on a mesh # Classify a point as on the North, East, South, or West boundary edge of a rectangular mesh function classify_nesw(p::Point_2D, mesh::UnstructuredMesh_2D) ϵ = 1e-4 # First boundary edge ID -> get the first point in the edge -> Get the desired coordinate y_N = mesh.points[mesh.edges[mesh.boundary_edges[1][1]][1]][2] x_E = mesh.points[mesh.edges[mesh.boundary_edges[2][1]][1]][1] y_S = mesh.points[mesh.edges[mesh.boundary_edges[3][1]][1]][2] x_W = mesh.points[mesh.edges[mesh.boundary_edges[4][1]][1]][1] if abs(p[2] - y_N) < ϵ return 1 # North elseif abs(p[1] - x_E) < ϵ return 2 # East elseif abs(p[2] - y_S) < ϵ return 3 # South elseif abs(p[1] - x_W) < ϵ return 4 # West else # Used as an index to boundary_edges, so error should be evident return 0 # Error end end # # Get the face indices for all tracks in a single angle # # Type-stable # function find_segment_faces_in_angle!(segment_points::Vector{Vector{Point_2D{F}}}, # indices::Vector{Vector{MVector{N, U}}}, # HRPM::HierarchicalRectangularlyPartitionedMesh{F, U} # ) where {F <: AbstractFloat, U <: Unsigned, N} # nt = length(segment_points) # nfaces_found = 0 # # for each track, find the segment indices # for it = 1:nt # # Returns true if indices were found for all segments in the track # nfaces_found += Int64(find_segment_faces_in_track!(segment_points[it], indices[it], HRPM)) # end # return nfaces_found == nt # end # # # Get the face indices for all segments in a single track # # Type-stable # function find_segment_faces_in_track!(segment_points::Vector{Point_2D{F}}, # indices::Vector{MVector{N, U}}, # HRPM::HierarchicalRectangularlyPartitionedMesh{F, U} # ) where {F <: AbstractFloat, U <: Unsigned, N} # # Points in the track # npoints = length(segment_points) # nfaces_found = 0 # # Test the midpoint of each segment to find the face # for iseg = 1:npoints-1 # p_midpoint = midpoint(segment_points[iseg], segment_points[iseg+1]) # nfaces_found += Int64(findface!(p_midpoint, indices[iseg], HRPM)) # end # return nfaces_found == npoints - 1 # end # # Get the face indices for all tracks in a single angle function find_segment_faces_in_angle!(segment_points::Vector{Vector{Point_2D}}, segment_faces::Vector{Vector{UInt32}}, mesh::UnstructuredMesh_2D) # for each track, find the segment indices for it = 1:length(segment_points) # Returns true if indices were found for all segments in the track find_segment_faces_in_track!(segment_points[it], segment_faces[it], mesh) end return nothing end # Get the face indices for all segments in a single track function find_segment_faces_in_track!(segment_points::Vector{Point_2D}, segment_faces::Vector{UInt32}, mesh::UnstructuredMesh_2D) npoints = length(segment_points) # Test the midpoint of each segment to find the face for iseg = 1:npoints-1 p_midpoint = midpoint(segment_points[iseg], segment_points[iseg+1]) segment_faces[iseg] = findface(p_midpoint, mesh) end return nothing end # # Follows https://mit-crpg.github.io/OpenMOC/methods/track_generation.html # # Generate tracks with track spacing tₛ for each azimuthal angle in the angular quadrature. # # These tracks lie within the domain of the mesh. # # Type-stable # function generate_tracks(tₛ::F, # ang_quad::ProductAngularQuadrature{nᵧ, nₚ, F}, # HRPM::HierarchicalRectangularlyPartitionedMesh{F, U} # ) where {nᵧ, nₚ, F <: AbstractFloat, U <: Unsigned} # w = HRPM_width(HRPM) # h = HRPM_height(HRPM) # # The tracks for each γ # tracks = [ generate_tracks(γ, tₛ, w, h) for γ in ang_quad.γ ].data # # Shift all tracks if necessary, since the tracks are generated as if the HRPM has a # # bottom left corner at (0,0) # offset = HRPM.rect.points[1] # for iγ = 1:nᵧ # for it in 1:length(tracks[iγ]) # tracks[iγ][it] = LineSegment_2D(tracks[iγ][it].points[1] + offset, # tracks[iγ][it].points[2] + offset) # end # end # return tracks # end # # Generate tracks with track spacing tₛ for each azimuthal angle in the angular quadrature. # These tracks lie within the domain of the mesh. # Follows https://mit-crpg.github.io/OpenMOC/methods/track_generation.html function generate_tracks(tₛ::Float64, ang_quad::ProductAngularQuadrature{nᵧ, nₚ}, mesh::UnstructuredMesh_2D; boundary_shape::String = "Unknown" ) where {nᵧ, nₚ} if boundary_shape !== "Rectangle" @error "Unsupported boundary shape" end bb = boundingbox(mesh, boundary_shape = "Rectangle") # The tracks for each γ tracks = [ generate_tracks(γ, tₛ, width(bb), height(bb)) for γ in ang_quad.γ ].data # Shift all tracks if necessary, since the tracks are generated as if the HRPM has a # bottom left corner at (0,0) offset = bb.bl for iγ = 1:nᵧ tracks[iγ] .+= offset end return tracks end # Generate tracks for angle γ, with track spacing tₛ for a rectangular domain with width w, height h # Rectangle has bottom left corner at (0, 0) function generate_tracks(γ::Float64, tₛ::Float64, w::Float64, h::Float64) if γ ≤ π/2 n_y = ceil(Int64, h*cos(γ)/tₛ) # Number of tracks in x direction n_x = ceil(Int64, w*sin(γ)/tₛ) # Total number of tracks nₜ = n_y + n_x # Allocate the tracks tracks = Vector{LineSegment_2D}(undef, nₜ) # Effective angle to ensure cyclic tracks γₑ = atan((h*n_x)/(w*n_y)) t_eff = w*sin(γₑ)/n_x Δx = t_eff/sin(γₑ) Δy = t_eff/cos(γₑ) # Number of tracks in y direction # Generate tracks from the bottom edge of the rectangular domain for ix = 1:n_x x₀ = w - (ix - 0.5)*Δx y₀ = 0.0 # Segment either terminates at the right edge of the rectangle # Or on the top edge of the rectangle x₁ = min(w, h/tan(γₑ) + x₀) y₁ = min((w - x₀)*tan(γₑ), h) l = LineSegment_2D(Point_2D(x₀, y₀), Point_2D(x₁, y₁)) if arclength(l) < minimum_segment_length @warn "Small track generated: $l" end tracks[ix] = l end # Generate tracks from the left edge of the rectangular domain for iy = 1:n_y x₀ = 0.0 y₀ = (iy - 0.5)*Δy # Segment either terminates at the right edge of the rectangle # Or on the top edge of the rectangle x₁ = min(w, (h - y₀)/tan(γₑ)) y₁ = min(w*tan(γₑ) + y₀, h) l = LineSegment_2D(Point_2D(x₀, y₀), Point_2D(x₁, y₁)) if arclength(l) < minimum_segment_length @warn "Small track generated: $l" end tracks[n_x + iy] = l end else γᶜ = π - γ # Compliment # Number of tracks in y direction n_y = ceil(Int64, h*cos(γᶜ)/tₛ) # Number of tracks in x direction n_x = ceil(Int64, w*sin(γᶜ)/tₛ) # Total number of tracks nₜ = n_y + n_x # Allocate the tracks tracks = Vector{LineSegment_2D}(undef, nₜ) # Effective angle to ensure cyclic tracks γₑ = atan((h*n_x)/(w*n_y)) t_eff = w*sin(γₑ)/n_x Δx = t_eff/sin(γₑ) Δy = t_eff/cos(γₑ) # Generate tracks from the bottom edge of the rectangular domain for ix = 1:n_x x₀ = (ix - 0.5)*Δx y₀ = 0.0 # Segment either terminates at the left edge of the rectangle # Or on the top edge of the rectangle x₁ = max(0, -h/tan(γₑ) + x₀) y₁ = min(x₀*tan(γₑ), h) l = LineSegment_2D(Point_2D(x₀, y₀), Point_2D(x₁, y₁)) if arclength(l) < minimum_segment_length @warn "Small track generated: $l" end tracks[ix] = l end # Generate tracks from the right edge of the rectangular domain for iy = 1:n_y x₀ = w y₀ = (iy - 0.5)*Δy # Segment either terminates at the left edge of the rectangle # Or on the top edge of the rectangle x₁ = max(0, w - (h - y₀)/tan(γₑ)) y₁ = min(w*tan(γₑ) + y₀, h) l = LineSegment_2D(Point_2D(x₀, y₀), Point_2D(x₁, y₁)) if arclength(l) < minimum_segment_length @warn "Small track generated: $l" end tracks[n_x + iy] = l end end return tracks end # Get the boundary edge that a point lies on for a rectangular mesh function get_start_edge_nesw(p::Point_2D, mesh::UnstructuredMesh_2D) nesw = classify_nesw(p, mesh) if nesw == 1 || nesw == 3 # On North or South edge. Just check x coordinates xₚ = p[1] for iedge in mesh.boundary_edges[nesw] epoints = edgepoints(mesh.edges[iedge], mesh.points) x₁ = epoints[1][1] x₂ = epoints[2][1] if x₁ ≤ xₚ ≤ x₂ || x₂ ≤ xₚ ≤ x₁ return iedge end end else # nesw == 2 || nesw == 4 # On East or West edge. Just check y coordinates yₚ = p[2] for iedge in mesh.boundary_edges[nesw] epoints = edgepoints(mesh.edges[iedge], mesh.points) y₁ = epoints[1][2] y₂ = epoints[2][2] if y₁ ≤ yₚ ≤ y₂ || y₂ ≤ yₚ ≤ y₁ return iedge end end end # Used as index to connectivity, so error should be evident return 0x00000000 end # Get the segment points and the face which the segment lies in for all segments, # in all tracks in an angle, using the edge-to-edge ray tracing method. # Assumes a rectangular boundary function ray_trace_angle_edge_to_edge!(tracks::Vector{LineSegment_2D}, segment_points::Vector{Vector{Point_2D}}, segment_faces::Vector{Vector{UInt32}}, mesh::UnstructuredMesh_2D) for it = 1:length(tracks) segment_points[it], segment_faces[it] = ray_trace_track_edge_to_edge(tracks[it], mesh) end return nothing end # Get the segment points and the face which the segment lies in for all segments # in a track, using the edge-to-edge ray tracing method. # Assumes a rectangular boundary # Linear edges function ray_trace_track_edge_to_edge(l::LineSegment_2D, mesh::LinearUnstructuredMesh_2D) # Classify line as intersecting north, east, south, or west boundary edge of the mesh start_point = l.points[1]; end_point = l.points[2] # Find the edges and faces the line starts and ends the mesh on start_edge = get_start_edge_nesw(start_point, mesh) start_face = mesh.edge_face_connectivity[start_edge][2] # 1st entry should be 0 end_edge = get_start_edge_nesw(end_point, mesh) end_face = mesh.edge_face_connectivity[end_edge][2] # 1st entry should be 0 # Setup for finding the segment points, faces segment_points = [start_point] segment_faces = UInt32[] max_iters = Int64(1E3) # Max iterations of finding intersection points before declaring an error current_edge = start_edge current_face = start_face next_edge = start_edge next_face = start_face intersection_point = start_point last_point = start_point end_reached = false iters = 0 # Find the segment points, faces while !end_reached && iters < max_iters if visualize_ray_tracing mesh!(mesh.materialized_faces[current_face], color = (:yellow, 0.2)) end next_edge, next_face, intersection_point = next_edge_and_face(last_point, current_edge, current_face, l, mesh) # Could not find next face, or jumping back to a previous face if next_face === current_face next_edge, next_face = next_edge_and_face_fallback(last_point, current_face, segment_faces, l, mesh) else if visualize_ray_tracing mesh!(mesh.materialized_faces[current_face], color = (:green, 0.15)) scatter!(intersection_point, color = :green) linesegments!(mesh.materialized_edges[next_edge], color = :green) println("Intersection at point $intersection_point, on face $current_face," * " over edge $next_edge") end push!(segment_points, intersection_point) push!(segment_faces, current_face) last_point = intersection_point end current_edge = next_edge current_face = next_face # If the furthest intersection is below the minimum segment length to the # end point, end here. if distance(intersection_point, end_point) < minimum_segment_length || current_face == end_face end_reached = true if intersection_point ≉ end_point push!(segment_points, end_point) push!(segment_faces, end_face) end end iters += 1 end if max_iters ≤ iters @error "Exceeded max iterations for $l." end return sort_intersection_points_E2E(l, segment_points, segment_faces) end # Get the segment points and the face which the segment lies in for all segments # in a track, using the edge-to-edge ray tracing method. # Assumes a rectangular boundary # Quadratic edges function ray_trace_track_edge_to_edge(l::LineSegment_2D, mesh::QuadraticUnstructuredMesh_2D) # Classify line as intersecting north, east, south, or west boundary edge of the mesh start_point = l.points[1]; end_point = l.points[2] # Find the edges and faces the line starts and ends the mesh on start_edge = get_start_edge_nesw(start_point, mesh) start_face = mesh.edge_face_connectivity[start_edge][2] # 1st entry should be 0 end_edge = get_start_edge_nesw(end_point, mesh) end_face = mesh.edge_face_connectivity[end_edge][2] # 1st entry should be 0 # Setup for finding the segment points, faces segment_points = [start_point] segment_faces = UInt32[] max_iters = Int64(1E3) # Max iterations of finding the next point before declaring an error current_face = start_face next_face = start_face intersection_point = start_point last_point = start_point end_reached = false iters = 0 # Find the segment points, faces while !end_reached && iters < max_iters if visualize_ray_tracing mesh!(mesh.materialized_faces[current_face], color = (:yellow, 0.2)) end next_face, intersection_point = next_face_E2E(last_point, current_face, l, mesh) # Could not find next face, or jumping back to a previous face if next_face === current_face next_face = next_face_fallback(last_point, current_face, segment_faces, l, mesh) else if visualize_ray_tracing mesh!(mesh.materialized_faces[current_face], color = (:green, 0.15)) scatter!(intersection_point, color = :green) println("Intersection at point $intersection_point, on face $current_face") end push!(segment_points, intersection_point) push!(segment_faces, current_face) last_point = intersection_point end current_face = next_face # If the furthest intersection is below the minimum segment length to the # end point, end here. if distance(intersection_point, end_point) < minimum_segment_length end_reached = true if intersection_point ≉ end_point push!(segment_points, end_point) push!(segment_faces, end_face) end end iters += 1 end if max_iters ≤ iters @error "Exceeded max iterations for $l." end return sort_intersection_points_E2E(l, segment_points, segment_faces) end # Return the next edge, next face, and intersection point on the next edge # This is for linear, materialized edges function next_edge_and_face(last_point::Point_2D, current_edge::UInt32, current_face::UInt32, l::LineSegment_2D, mesh::LinearUnstructuredMesh_2D) if visualize_ray_tracing # Compile time constant. Compiler will prune branch if not visualizing ax = current_axis() end next_edge = current_edge next_face = current_face start_point = l.points[1] min_distance = distance(start_point, last_point) + minimum_segment_length intersection_point = Point_2D(1e10) # For each edge in this face, intersect the track with the edge for edge in mesh.face_edge_connectivity[current_face] # If we used this edge to get to this face, skip it. if edge === current_edge continue end if visualize_ray_tracing lplot = linesegments!(mesh.materialized_edges[edge], color = :orange) end # Edges are linear, so 1 intersection point max npoints, point = l ∩ mesh.materialized_edges[edge] # If there's an intersection if npoints === 0x00000001 # If the intersection point on this edge is further along the ray than # the last_point, then we want to leave the face from this edge if min_distance < distance(start_point, point) intersection_point = point # Make sure not to pick the current face for the next face if mesh.edge_face_connectivity[edge][1] == current_face next_face = mesh.edge_face_connectivity[edge][2] else next_face = mesh.edge_face_connectivity[edge][1] end next_edge = edge break end end if visualize_ray_tracing readline() delete!(ax.scene, lplot) end end if visualize_ray_tracing readline() end return next_edge, next_face, intersection_point end # Return the next face and intersection point on the next edge # This is for quadratic, materialized edges function next_face_E2E(last_point::Point_2D, current_face::UInt32, l::LineSegment_2D, mesh::QuadraticUnstructuredMesh_2D) if visualize_ray_tracing # Compile time constant. Prune branch if not visualizing ax = current_axis() end next_face = current_face start_point = l[1] min_distance = distance(start_point, last_point) + minimum_segment_length intersection_point = Point_2D(1e10) # For each edge in this face, intersect the track with the edge for edge in mesh.face_edge_connectivity[current_face] if visualize_ray_tracing lplot = linesegments!(mesh.materialized_edges[edge], color = :orange) end npoints, ipoints = l ∩ mesh.materialized_edges[edge] # If there's an intersection for i = 1:npoints point = ipoints[i] # If the intersection point on this edge is further along the ray than # the last_point, then we want to leave the face from this edge if min_distance < distance(start_point, point) < distance(start_point, intersection_point) intersection_point = point # Make sure not to pick the current face for the next face if mesh.edge_face_connectivity[edge][1] == current_face next_face = mesh.edge_face_connectivity[edge][2] else next_face = mesh.edge_face_connectivity[edge][1] end end end if visualize_ray_tracing readline() delete!(ax.scene, lplot) end end return next_face, intersection_point end # Return the next face, and edge to skip, for the edge-to-edge algorithm to check in the event # that they could not be determined simply by checking edges of the current face. This typically # means there was an intersection around a vertex, and floating point error is # causing an intersection to erroneously return 0 points intersected. # Requires materialized faces function next_edge_and_face_fallback(last_point::Point_2D, current_face::UInt32, segment_faces::Vector{UInt32}, l::LineSegment_2D, mesh::LinearUnstructuredMesh_2D) # If the next face could not be determined, or the ray is jumping back to the # previous face, this means either: # (1) The ray is entering or exiting through a vertex, and floating point error # means the exiting edge did not register an intersection. # (2) You're supremely unlucky and a fallback method kicked you to another face # where the next face couldn't be determined next_face = current_face start_point = l[1] # The closest point along l intersected in this iteration closest_point = Point_2D(1e10) # Check adjacent faces first to see if that is sufficient to solve the problem next_face, closest_point = adjacent_faces_fallback(last_point, current_face, l, mesh) # If adjacent faces were not sufficient, try all faces sharing the vertices of this face if next_face === current_face || next_face ∈ segment_faces next_face, closest_point = shared_vertex_fallback(last_point, current_face, l, mesh) if visualize_ray_tracing readline() end end # If the next face STILL couldn't be determined, you're screwed if next_face == current_face @error "Could not find next face, even using fallback methods, for segment $l." end # Determine the edge that should be skipped by choosing the edge with intersection point # closest to the start of the line. next_edge = skipped_edge_fallback(next_face, l, mesh) return next_edge, next_face end # Return the next face for the edge-to-edge algorithm to check in the event # that it could not be determined simply by checking edges of the current face. This typically # means there was an intersection around a vertex, and floating point error is # causing an intersection to erroneously return 0 points intersected. # Requires materialized faces # Quadratic edges function next_face_fallback(last_point::Point_2D, current_face::UInt32, segment_faces::Vector{UInt32}, l::LineSegment_2D, mesh::QuadraticUnstructuredMesh_2D) # If the next face could not be determined, this means either: # (1) The ray is entering or exiting through a vertex, and floating point error # means the exiting edge did not register an intersection. # (2) You're supremely unlucky and a fallback method kicked you to another face # where the next face couldn't be determined next_face = current_face start_point = l[1] # The closest point along l intersected in this iteration closest_point = Point_2D(1e10) next_face, closest_point = quadratic_shared_vertex_fallback(last_point, current_face, l, mesh) if visualize_ray_tracing readline() end # If the next face STILL couldn't be determined, you're screwed if next_face === current_face @error "Could not find next face, even using fallback methods, for segment $l." end return next_face end # Check to see if one of the adjacent faces should be the next face in edge-to-edge ray tracing function adjacent_faces_fallback(last_point::Point_2D, current_face::UInt32, l::LineSegment_2D, mesh::UnstructuredMesh_2D) next_face = current_face start_point = l.points[1] min_distance = distance(start_point, last_point) + minimum_segment_length intersection_point = Point_2D(1e10) for face in adjacent_faces(current_face, mesh) npoints, ipoints = l ∩ mesh.materialized_faces[face] if 0 < npoints for point in ipoints[1:npoints] if min_distance < distance(start_point, point) < distance(start_point, intersection_point) intersection_point = point next_face = face end end end end return next_face, intersection_point end # Check to see if one of the faces sharing a vertex with the current face # should be the next face in edge-to-edge ray tracing function shared_vertex_fallback(last_point::Point_2D, current_face::UInt32, l::LineSegment_2D, mesh::UnstructuredMesh_2D) next_face = current_face start_point = l.points[1] min_distance = distance(start_point, last_point) + minimum_segment_length intersection_point = Point_2D(1e10) # Get the vertex ids for each vertex in the face already_tested = adjacent_faces(current_face, mesh) push!(already_tested, current_face) vertex_ids = mesh.faces[current_face] faces_OI = UInt32[] # faces of interest for vertex in vertex_ids candidate_faces = faces_sharing_vertex(vertex, mesh) for face in candidate_faces if face ∉ already_tested && face ∉ faces_OI push!(faces_OI, face) end end end if visualize_ray_tracing mesh_vec = [] end for face in faces_OI npoints, ipoints = l ∩ mesh.materialized_faces[face] if visualize_ray_tracing println("Face: $face") push!(mesh_vec, mesh!(mesh.materialized_faces[face], color = (:black, 0.2))) readline() end if 1 < npoints contains_last_point = false for point in ipoints[1:npoints] if distance(point, last_point) < minimum_segment_length contains_last_point = true end end for point in ipoints[1:npoints] distance_to_point = distance(start_point, point) # If this is a valid intersection point if min_distance < distance_to_point # If this point is the closest point, use this if distance_to_point ⪉ distance(start_point, intersection_point) intersection_point = point next_face = face # If this face contains the last point, we want to prioritize this face elseif contains_last_point next_face = face end end if visualize_ray_tracing scatter!(point, color = :yellow) readline() end end end end if visualize_ray_tracing ax = current_axis() for m in mesh_vec delete!(ax.scene, m) end end return next_face, intersection_point end # Check to see if one of the faces sharing a vertex with the current face # should be the next face in edge-to-edge ray tracing function quadratic_shared_vertex_fallback(last_point::Point_2D, current_face::UInt32, l::LineSegment_2D, mesh::QuadraticUnstructuredMesh_2D) next_face = current_face start_point = l[1] min_distance = distance(start_point, last_point) + minimum_segment_length intersection_point = Point_2D(1e10) # Get the vertex ids for each vertex in the face vertex_ids = mesh.faces[current_face] faces_OI = UInt32[] # faces of interest for vertex in vertex_ids candidate_faces = faces_sharing_vertex(vertex, mesh) for face in candidate_faces if face !== current_face && face ∉ faces_OI push!(faces_OI, face) end end end if visualize_ray_tracing mesh_vec = [] end next_face_contains_last_point = false for face in faces_OI npoints, ipoints = l ∩ mesh.materialized_faces[face] if visualize_ray_tracing println("Face: $face") push!(mesh_vec, mesh!(mesh.materialized_faces[face], color = (:black, 0.2))) readline() end if 1 < npoints contains_last_point = false for point in ipoints[1:npoints] if distance(point, last_point) < minimum_segment_length contains_last_point = true end end if visualize_ray_tracing println(contains_last_point ? "Contains last point" : "Does not contain last point") end for point in ipoints[1:npoints] distance_to_point = distance(start_point, point) # If this is a valid intersection point if min_distance < distance_to_point # If this point is the closest point, use this # Could be a problem for Float32. if distance_to_point ⪉ distance(start_point, intersection_point) if visualize_ray_tracing println("New intersection point") println("New face: $face") end intersection_point = point next_face = face if contains_last_point next_face_contains_last_point = true end # If this face contains the last point, we want to prioritize this face, # but only if the face with the closest point doesn't also contain # the last point elseif contains_last_point && !next_face_contains_last_point next_face = face if visualize_ray_tracing println("New face: $face") end end end if visualize_ray_tracing println("Point: $point") scatter!(point, color = :yellow) readline() end end end end if visualize_ray_tracing ax = current_axis() for m in mesh_vec delete!(ax.scene, m) end println("Next face: $next_face, Intersection: $intersection_point") end return next_face, intersection_point end # Determine the edge that should be skipped by choosing the edge with intersection point # closest to the start of the line. # Linear edges function skipped_edge_fallback(next_face::UInt32, l::LineSegment_2D, mesh::LinearUnstructuredMesh_2D) start_point = l.points[1] closest_point = Point_2D(1.0e10) edges_OI = mesh.face_edge_connectivity[next_face] next_edge = 0x00000000 for iedge in edges_OI npoints, point = l ∩ mesh.materialized_edges[iedge] if 0 < npoints if distance(start_point, point) < distance(start_point, closest_point) closest_point = point next_edge = iedge end end end return next_edge end function sort_intersection_points_E2E(l::LineSegment_2D, segment_points::Vector{Point_2D}, segment_faces::Vector{UInt32}) if 2 <= length(segment_points) npoints = length(segment_points) perm = sortperm(distance².(l[1], view(segment_points, 2:npoints))) permute!(view(segment_points, 2:npoints), perm) permute!(segment_faces, perm) # Eliminate any points and faces for which the distance between consecutive points # is less than the minimum segment length delete_ids = Int64[] id_start = 1 for id_stop ∈ 2:npoints if distance²(segment_points[id_start], segment_points[id_stop]) < minimum_segment_length^2 push!(delete_ids, id_stop) else id_start = id_stop end end deleteat!(segment_points, delete_ids) deleteat!(segment_faces, delete_ids .- 1) return segment_points, segment_faces else return segment_points, segment_faces end end function use_E2E_raytracing(mesh::UnstructuredMesh_2D) return 0 < length(mesh.boundary_edges) end
{-# OPTIONS --without-K #-} module Lecture4 where import Lecture3 open Lecture3 public -- the identity type on a type A, given a fixed basepoint x data Id {i : Level} {A : UU i} (x : A) : A → UU i where refl : Id x x _==_ : {i : Level} {A : UU i} (x y : A) → UU i x == y = Id x y ind-Id : {i j : Level} {A : UU i} {x : A} (B : (y : A) (p : Id x y) → UU j) → (B x refl) → (y : A) (p : Id x y) → B y p ind-Id x b y refl = b -- groupoid structure on identity types (a.k.a. paths) inv : {i : Level} {A : UU i} {x y : A} → Id x y → Id y x inv (refl) = refl _⁻¹ : {i : Level} {A : UU i} {x y : A} → Id x y → Id y x x ⁻¹ = inv x concat : {i : Level} {A : UU i} {x z : A} (y : A) → Id x y → Id y z → Id x z concat x refl q = q _·_ : {i : Level} {A : UU i} {x z : A} {y : A} → Id x y → Id y z → Id x z p · q = concat _ p q -- equational reasoning (TODO: demonstrate this by reworking some of the proofs to use it) infix 15 _==∎ -- \qed infixr 10 _==⟨_⟩_ -- \< \> _==∎ : ∀ {i : Level} {A : UU i} (a : A) → a == a a ==∎ = refl _==⟨_⟩_ : ∀ {i : Level} {A : UU i} (a : A) {b c : A} → a == b → b == c → a == c a ==⟨ γ ⟩ η = γ · η -- end equational reasoning assoc : {i : Level} {A : UU i} {x y z w : A} (p : Id x y) (q : Id y z) (r : Id z w) → Id (concat _ p (concat _ q r)) (concat _ (concat _ p q) r) assoc refl q r = refl left-unit : {i : Level} {A : UU i} {x y : A} (p : Id x y) → Id (concat _ refl p) p left-unit refl = refl right-unit : {i : Level} {A : UU i} {x y : A} (p : Id x y) → Id (concat _ p refl) p right-unit refl = refl left-inv : {i : Level} {A : UU i} {x y : A} (p : Id x y) → Id (concat _ (inv p) p) refl left-inv refl = refl right-inv : {i : Level} {A : UU i} {x y : A} (p : Id x y) → Id (concat _ p (inv p)) refl right-inv refl = refl -- action on paths of a function ap : {i j : Level} {A : UU i} {B : UU j} (f : A → B) {x y : A} (p : Id x y) → Id (f x) (f y) ap f refl = refl ap-id : {i : Level} {A : UU i} {x y : A} (p : Id x y) → Id (ap id p) p ap-id refl = refl ap-comp : {i j k : Level} {A : UU i} {B : UU j} {C : UU k} (g : B → C) (f : A → B) {x y : A} (p : Id x y) → Id (ap (comp g f) p) (ap g (ap f p)) ap-comp g f refl = refl ap-refl : {i j : Level} {A : UU i} {B : UU j} (f : A → B) (x : A) → Id (ap f (refl {_} {_} {x})) refl ap-refl f x = refl ap-concat : {i j : Level} {A : UU i} {B : UU j} (f : A → B) {x y z : A} (p : Id x y) (q : Id y z) → Id (ap f (concat _ p q)) (concat _ (ap f p) (ap f q)) ap-concat f refl q = refl ap-inv : {i j : Level} {A : UU i} {B : UU j} (f : A → B) {x y : A} (p : Id x y) → Id (ap f (inv p)) (inv (ap f p)) ap-inv f refl = refl tr : {i j : Level} {A : UU i} (B : A → UU j) {x y : A} (p : Id x y) (b : B x) → B y tr B refl b = b apd : {i j : Level} {A : UU i} {B : A → UU j} (f : (x : A) → B x) {x y : A} (p : Id x y) → Id (tr B p (f x)) (f y) apd f refl = refl -- Exercises below -- Exercise 4.1 The composition of transports is the transport of the concatenation tr-concat : {i j : Level} {A : UU i} (B : A → UU j) {x y z : A} (p : Id x y) (q : Id y z) (b : B x) → Id (tr B q (tr B p b)) (tr B (concat _ p q) b) tr-concat B refl refl b = refl -- Exercise 4.2 Taking the inverse distributes contravariantly over concatenation inv-assoc : {i : Level} {A : UU i} {x y z : A} (p : Id x y) (q : Id y z) → Id (inv (concat _ p q)) (concat _ (inv q) (inv p)) inv-assoc refl refl = refl -- Exercise 4.3 If B is a weakened family over A (trivial bundle, not dependent), then tr is refl tr-triv : {i j : Level} {A : UU i} {B : UU j} {x y : A} (p : Id x y) (b : B) → Id (tr (weaken A B) p b) b tr-triv refl b = refl -- Exercise 4.4 Transporting, using x=y and f:A → B, an identity between identities tr-fib : {i j : Level} {A : UU i} {B : UU j} {f : A → B} {x y : A} (p : Id x y) (b : B) → (q : Id (f x) b) → Id (tr (λ (a : A) → Id (f a) b) p q) (concat _ (inv (ap f p)) q) tr-fib refl b q = refl tr-fib' : {i j : Level} {A : UU i} {B : UU j} {f : A → B} {x y : A} (p : Id x y) (b : B) → (q : Id b (f x)) → Id (tr (λ (a : A) → Id b (f a)) p q) (concat _ q (ap f p)) tr-fib' refl b refl = refl -- Exercise 4.5 inv-con : {i : Level} {A : UU i} {x y z : A} (p : Id x y) (q : Id y z) (r : Id x z) → (Id (p · q) r) → (Id q ((inv p) · r)) inv-con refl refl r refl = refl con-inv : {i : Level} {A : UU i} {x y z : A} (p : Id x y) (q : Id y z) (r : Id x z) → (Id (p · q) r) → (Id p (r · (inv q))) con-inv refl refl r refl = refl -- Exercise 4.6 Path lifting, from a path in the base A to a path in the total space Σ A B lift : {i j : Level} {A : UU i} {B : A → UU j} {x y : A} (p : Id x y) (b : B x) → Id (dpair x b) (dpair y (tr B p b)) lift refl b = refl -- Exercise 4.7 Some laws of arithmetic (follow-up from Remark 2.3.1) right-unit-addN : (m : ℕ) → Id (m + Nzero) m right-unit-addN Nzero = refl right-unit-addN (Nsucc m) = ap Nsucc (right-unit-addN m) left-unit-addN : (m : ℕ) → Id (Nzero + m) m left-unit-addN m = refl assoc-addN : (m n k : ℕ) → Id (m + (n + k)) ((m + n) + k) assoc-addN Nzero n k = refl assoc-addN (Nsucc m) n k = ap Nsucc (assoc-addN m n k) right-succ-addN : (m n : ℕ) → Id (m + (Nsucc n)) (Nsucc (m + n)) right-succ-addN Nzero n = refl right-succ-addN (Nsucc m) n = ap Nsucc (right-succ-addN m n) comm-addN : (m n : ℕ) → Id (m + n) (n + m) comm-addN Nzero Nzero = refl comm-addN Nzero (Nsucc n) = ap Nsucc (comm-addN Nzero n) comm-addN (Nsucc m) Nzero = ap Nsucc (comm-addN m Nzero) comm-addN (Nsucc m) (Nsucc n) = ((Nsucc m) + (Nsucc n)) ==⟨ ap Nsucc (comm-addN m (Nsucc n)) ⟩ (Nsucc ((Nsucc n) + m)) ==⟨ inv (right-succ-addN (Nsucc n) m) ⟩ ((Nsucc n) + (Nsucc m)) ==∎ left-zero-mulN : (m : ℕ) → Id (Nzero ** m) Nzero left-zero-mulN m = refl right-zero-mulN : (m : ℕ) → Id (m ** Nzero) Nzero right-zero-mulN Nzero = refl right-zero-mulN (Nsucc m) = concat (m ** Nzero) (right-unit-addN _) (right-zero-mulN m) left-unit-mulN : (m : ℕ) → Id ((Nsucc Nzero) ** m) m left-unit-mulN m = refl right-unit-mulN : (m : ℕ) → Id (m ** (Nsucc Nzero)) m right-unit-mulN Nzero = refl right-unit-mulN (Nsucc m) = ((Nsucc m) ** (Nsucc Nzero)) ==⟨ comm-addN _ (Nsucc Nzero) ⟩ (Nsucc Nzero) + (m ** (Nsucc Nzero)) ==⟨ ap Nsucc (right-unit-mulN m) ⟩ (Nsucc m) ==∎ distr-addN-mulN : (m n k : ℕ) → Id ((m + n) ** k) ((m ** k) + (n ** k)) distr-addN-mulN Nzero n k = refl distr-addN-mulN (Nsucc m) n k = ((Nsucc m) + n) ** k ==⟨ refl ⟩ (Nsucc (m + n)) ** k ==⟨ refl ⟩ ((m + n) ** k) + k ==⟨ ap (λ x → x + k) (distr-addN-mulN m n k) ⟩ ((m ** k) + (n ** k)) + k ==⟨ inv (assoc-addN (m ** k) (n ** k) k) ⟩ (m ** k) + ((n ** k) + k) ==⟨ ap (λ x → (m ** k) + x) (comm-addN (n ** k) k) ⟩ (m ** k) + (k + (n ** k)) ==⟨ assoc-addN (m ** k) k (n ** k) ⟩ ((m ** k) + k) + (n ** k) ==⟨ refl ⟩ ((Nsucc m) ** k) + (n ** k) ==∎ assoc-mulN : (m n k : ℕ) → Id (m ** (n ** k)) ((m ** n) ** k) assoc-mulN Nzero n k = refl assoc-mulN (Nsucc m) n k = ((Nsucc m) ** (n ** k)) ==⟨ refl ⟩ (m ** (n ** k)) + (n ** k) ==⟨ ap (λ x → x + (n ** k)) (assoc-mulN m n k) ⟩ ((m ** n) ** k) + (n ** k) ==⟨ inv (distr-addN-mulN (m ** n) n k) ⟩ ((m ** n) + n) ** k ==⟨ refl ⟩ (Nsucc m ** n) ** k ==∎
[STATEMENT] lemma wfT_TRUE: assumes "wfG P \<B> \<Gamma>" and "wfB P \<B> b" shows "wfT P \<B> \<Gamma> (\<lbrace> z : b | TRUE \<rbrace>)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. P ; \<B> ; \<Gamma> \<turnstile>\<^sub>w\<^sub>f \<lbrace> z : b | TRUE \<rbrace> [PROOF STEP] proof - [PROOF STATE] proof (state) goal (1 subgoal): 1. P ; \<B> ; \<Gamma> \<turnstile>\<^sub>w\<^sub>f \<lbrace> z : b | TRUE \<rbrace> [PROOF STEP] obtain z'::x where *:"atom z' \<sharp> (P, \<B>, \<Gamma>)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. (\<And>z'. atom z' \<sharp> (P, \<B>, \<Gamma>) \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] using obtain_fresh [PROOF STATE] proof (prove) using this: (\<And>a. atom a \<sharp> ?x \<Longrightarrow> ?thesis) \<Longrightarrow> ?thesis goal (1 subgoal): 1. (\<And>z'. atom z' \<sharp> (P, \<B>, \<Gamma>) \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] by metis [PROOF STATE] proof (state) this: atom z' \<sharp> (P, \<B>, \<Gamma>) goal (1 subgoal): 1. P ; \<B> ; \<Gamma> \<turnstile>\<^sub>w\<^sub>f \<lbrace> z : b | TRUE \<rbrace> [PROOF STEP] hence "\<lbrace> z : b | TRUE \<rbrace> = \<lbrace> z' : b | TRUE \<rbrace>" [PROOF STATE] proof (prove) using this: atom z' \<sharp> (P, \<B>, \<Gamma>) goal (1 subgoal): 1. \<lbrace> z : b | TRUE \<rbrace> = \<lbrace> z' : b | TRUE \<rbrace> [PROOF STEP] by auto [PROOF STATE] proof (state) this: \<lbrace> z : b | TRUE \<rbrace> = \<lbrace> z' : b | TRUE \<rbrace> goal (1 subgoal): 1. P ; \<B> ; \<Gamma> \<turnstile>\<^sub>w\<^sub>f \<lbrace> z : b | TRUE \<rbrace> [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: \<lbrace> z : b | TRUE \<rbrace> = \<lbrace> z' : b | TRUE \<rbrace> goal (1 subgoal): 1. P ; \<B> ; \<Gamma> \<turnstile>\<^sub>w\<^sub>f \<lbrace> z : b | TRUE \<rbrace> [PROOF STEP] using wfT_TRUE_aux assms * [PROOF STATE] proof (prove) using this: \<lbrace> z : b | TRUE \<rbrace> = \<lbrace> z' : b | TRUE \<rbrace> \<lbrakk> ?P ; ?\<B> \<turnstile>\<^sub>w\<^sub>f ?\<Gamma> ; atom ?z \<sharp> (?P, ?\<B>, ?\<Gamma>); ?P ; ?\<B> \<turnstile>\<^sub>w\<^sub>f ?b \<rbrakk> \<Longrightarrow> ?P ; ?\<B> ; ?\<Gamma> \<turnstile>\<^sub>w\<^sub>f \<lbrace> ?z : ?b | TRUE \<rbrace> P ; \<B> \<turnstile>\<^sub>w\<^sub>f \<Gamma> P ; \<B> \<turnstile>\<^sub>w\<^sub>f b atom z' \<sharp> (P, \<B>, \<Gamma>) goal (1 subgoal): 1. P ; \<B> ; \<Gamma> \<turnstile>\<^sub>w\<^sub>f \<lbrace> z : b | TRUE \<rbrace> [PROOF STEP] by metis [PROOF STATE] proof (state) this: P ; \<B> ; \<Gamma> \<turnstile>\<^sub>w\<^sub>f \<lbrace> z : b | TRUE \<rbrace> goal: No subgoals! [PROOF STEP] qed
Formal statement is: lemma emeasure_null_measure[simp]: "emeasure (null_measure M) X = 0" Informal statement is: The measure of any set is zero under the null measure.
require(httr) headers = c( `Origin` = 'http://fiddle.jshell.net', `Accept-Encoding` = 'gzip, deflate', `Accept-Language` = 'en-US,en;q=0.8', `User-Agent` = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36', `Content-Type` = 'application/x-www-form-urlencoded; charset=UTF-8', `Accept` = '*/*', `Referer` = 'http://fiddle.jshell.net/_display/', `X-Requested-With` = 'XMLHttpRequest', `Connection` = 'keep-alive' ) data = list( `msg1` = 'wow', `msg2` = 'such' ) res <- httr::POST(url = 'http://localhost:28139/echo/html/', httr::add_headers(.headers=headers), body = data, encode = 'form')
State Before: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ ⊢ (↑n + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * ↑derivative (U R n) State After: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ h : ↑derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) ⊢ (↑n + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * ↑derivative (U R n) Tactic: have h : derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n) := by conv_lhs => rw [T_eq_X_mul_T_sub_pol_U] simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow, one_mul, T_derivative_eq_U] rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast] ring State Before: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ h : ↑derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) ⊢ (↑n + 1) * T R (n + 1) = X * U R n - (1 - X ^ 2) * ↑derivative (U R n) State After: no goals Tactic: calc ((n : R[X]) + 1) * T R (n + 1) = ((n : R[X]) + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((n + 1 : R[X]) * U R n) - (X * U R n + T R (n + 1)) := by ring _ = derivative (T R (n + 2)) - X * derivative (T R (n + 1)) - U R (n + 1) := by rw [← U_eq_X_mul_U_add_T, ← T_derivative_eq_U, ← Nat.cast_one, ← Nat.cast_add, Nat.cast_one, ← T_derivative_eq_U (n + 1)] _ = U R (n + 1) - X * U R n + X * derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * derivative (U R n) - X * derivative (T R (n + 1)) - U R (n + 1) := by rw [h] _ = X * U R n - (1 - X ^ 2) * derivative (U R n) := by ring State Before: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ ⊢ ↑derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) State After: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ ⊢ ↑derivative (X * T R (n + 1) - (1 - X ^ 2) * U R n) = U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) Tactic: conv_lhs => rw [T_eq_X_mul_T_sub_pol_U] State Before: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ ⊢ ↑derivative (X * T R (n + 1) - (1 - X ^ 2) * U R n) = U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) State After: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ ⊢ T R (n + 1) + X * ((↑n + 1) * U R n) - ((0 - ↑C ↑2 * X ^ (2 - 1)) * U R n + (1 - X ^ 2) * ↑derivative (U R n)) = U R (n + 1) - X * U R n + X * ((↑n + 1) * U R n) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) Tactic: simp only [derivative_sub, derivative_mul, derivative_X, derivative_one, derivative_X_pow, one_mul, T_derivative_eq_U] State Before: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ ⊢ T R (n + 1) + X * ((↑n + 1) * U R n) - ((0 - ↑C ↑2 * X ^ (2 - 1)) * U R n + (1 - X ^ 2) * ↑derivative (U R n)) = U R (n + 1) - X * U R n + X * ((↑n + 1) * U R n) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) State After: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ ⊢ U R (n + 1) - X * U R n + X * ((↑n + 1) * U R n) - ((0 - ↑2 * X ^ (2 - 1)) * U R n + (1 - X ^ 2) * ↑derivative (U R n)) = U R (n + 1) - X * U R n + X * ((↑n + 1) * U R n) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) Tactic: rw [T_eq_U_sub_X_mul_U, C_eq_nat_cast] State Before: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ ⊢ U R (n + 1) - X * U R n + X * ((↑n + 1) * U R n) - ((0 - ↑2 * X ^ (2 - 1)) * U R n + (1 - X ^ 2) * ↑derivative (U R n)) = U R (n + 1) - X * U R n + X * ((↑n + 1) * U R n) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) State After: no goals Tactic: ring State Before: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ h : ↑derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) ⊢ (↑n + 1) * T R (n + 1) = (↑n + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((↑n + 1) * U R n) - (X * U R n + T R (n + 1)) State After: no goals Tactic: ring State Before: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ h : ↑derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) ⊢ (↑n + 1 + 1) * (X * U R n + T R (n + 1)) - X * ((↑n + 1) * U R n) - (X * U R n + T R (n + 1)) = ↑derivative (T R (n + 2)) - X * ↑derivative (T R (n + 1)) - U R (n + 1) State After: no goals Tactic: rw [← U_eq_X_mul_U_add_T, ← T_derivative_eq_U, ← Nat.cast_one, ← Nat.cast_add, Nat.cast_one, ← T_derivative_eq_U (n + 1)] State Before: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ h : ↑derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) ⊢ ↑derivative (T R (n + 2)) - X * ↑derivative (T R (n + 1)) - U R (n + 1) = U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) - X * ↑derivative (T R (n + 1)) - U R (n + 1) State After: no goals Tactic: rw [h] State Before: R : Type u_1 S : Type ?u.79032 inst✝¹ : CommRing R inst✝ : CommRing S n : ℕ h : ↑derivative (T R (n + 2)) = U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) ⊢ U R (n + 1) - X * U R n + X * ↑derivative (T R (n + 1)) + 2 * X * U R n - (1 - X ^ 2) * ↑derivative (U R n) - X * ↑derivative (T R (n + 1)) - U R (n + 1) = X * U R n - (1 - X ^ 2) * ↑derivative (U R n) State After: no goals Tactic: ring