text
stringlengths
0
1.25M
meta
stringlengths
47
1.89k
import numpy as np import matplotlib.pyplot as plt import matplotlib.image as mpimg import sys import gif from os import getcwd, path def hilbert(i): index = i & 3 points = np.array([[0,0],[0,1],[1,1],[1,0]]) v = points[index] for iOrder in range(1,order): i = i >> 2 index = i & 3 l = int(2**iOrder) if index == 0: temp = v[0] v[0] = v[1] v[1] = temp elif index == 1: v[1] += l elif index == 2: v[0] += l v[1] += l elif index == 3: temp = l - 1 - v[0] v[0] = l - 1 - v[1] v[1] = temp v[0] += l return v @gif.frame def plot(i): plt.figure(frameon='False') plt.imshow(img) x1 = curve[i-1,0] x2 = curve[i,0] y1 = curve[i-1,1] y2 = curve[i,1] x = np.arange(min(x1,x2),min(max(x1,x2)+1,width)) y = np.arange(min(y1,y2),min(max(y1,y2)+1,heigth)) xx,yy = np.meshgrid(x,y) background[xx,yy,3] = empty plt.imshow(background) plt.axis('off') if __name__ == '__main__': defaultInputs = 3 if len(sys.argv)-1 == defaultInputs: order = int(sys.argv[1]) imagePath = sys.argv[2] gifPath = sys.argv[3] else: order = 1 imagePath = 'Superman.png' gifPath = 'Superman.gif' # LOAD IMAGE img = mpimg.imread(imagePath) empty, full = 0, 255 width, heigth, RGBa = img.shape background = np.zeros((width+1,heigth+1,RGBa)) background[:,:,RGBa-1] = full N = int(2**order) total = N*N # 2D l = int(width / N) # or heigth curve = np.zeros((total,2)).astype(int) frames = [] for i in range(0,total): curve[i] = hilbert(i) curve[i] = curve[i]*l curve[i] += int(l/2) if i > 0: frames.append(plot(i)) gif.save(frames,path.join(getcwd(),gifPath),duration=50)
{"hexsha": "5c25ea7ce1b2996cd6e231e9c1f9f34dd3c8cf08", "size": 1945, "ext": "py", "lang": "Python", "max_stars_repo_path": "HilbertCurve.py", "max_stars_repo_name": "damuopel/HilbertCurve", "max_stars_repo_head_hexsha": "b0a93275a57090d21144a35b600f8a2d93391389", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "HilbertCurve.py", "max_issues_repo_name": "damuopel/HilbertCurve", "max_issues_repo_head_hexsha": "b0a93275a57090d21144a35b600f8a2d93391389", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "HilbertCurve.py", "max_forks_repo_name": "damuopel/HilbertCurve", "max_forks_repo_head_hexsha": "b0a93275a57090d21144a35b600f8a2d93391389", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.2837837838, "max_line_length": 66, "alphanum_fraction": 0.5033419023, "include": true, "reason": "import numpy", "num_tokens": 637}
% !TEX root = ../../main.tex % !TEX encoding = UTF-8 Unicode \chapter{The Large Hadron Collider} \label{ch:lhc} The Large Hadron Collider (LHC)~\cite{LHC,LHC_design_v1,LHC_design_v2,LHC_design_v3} is a circular particle accelerator designed to probe physics at the \TeV\,scale. By colliding protons or heavy-ions with high energy, at a high rate, in compact beams, the LHC provides access to extremely rare phenomena that have escaped previous experimental efforts. Currently producing the highest energy collisions in the world, the LHC has two rings carrying hadrons in opposite directions around a 26.7\,km loop, with superconducting magnets to bend the particles' trajectories. The tunnel housing the accelerator was already built between 1984-1989 for the previous Large Electron-Positron collider (LEP)~\cite{LEP} and is located at the European Organization for Nuclear Research (CERN) on the border between France and Switzerland, near Geneva, between 45\,m and 170\,m underground. After ten years of construction between 1998-2008, %and minor archeology\footnote{Gallo-Roman ruins were unearthed as the Compact Muon Solenoid (CMS) began excavation at their future detector site in July 1998~\cite{lhc_timeline}.}, the LHC began operations in September 2008. Shortly after, a faulty electrical connection between two superconducting magnets caused severe damage and required 14 months of repairs~\cite{lhc_incident}. % created an arc that damaged the helium coolant enclosure, explosively releasing over 6 tonnes of liquid helium which caused severe damage to 53 superconducting magnets and the vacuum beam pipes as its vapors rapidly expanded in the tunnel~\cite{lhc_incident}. After 14 months of repairs, The LHC successfully reinitiated operations for Run-I (2010-2012) while operating at a center-of-mass energy $\sqs=7-8$\,\TeV. %\footnote{In order to ``train'' the superconducting magnets to handle the extremely large currents without ``quenching'', or loosing it's superconducting properties, the magnets are repeatedly run with lower currents to incite smaller quenches, allowing the magnets to slowly ``settle''. It was decided, then, to use lower energy collisions during Run-I to prevent further setbacks.} Following two years of scheduled upgrades and repairs, the LHC began the current phase, Run-II (2015-2018), where it is operating near the design energy at $\sqs=13$\,\TeV. The data in this thesis was collected during the first two years of Run-II (2015 and 2016). The following chapter will discuss the basic physics involved in the accelerator (\Sect{\ref{ch:lhc:acc}}), the layout and injection chain (\Sect{\ref{ch:lhc:inj}}), the machine design (\Sect{\ref{ch:lhc:des}}), and the participating experiments (\Sect{\ref{ch:lhc:exp}}). % \section{Accelerator Physics} \label{ch:lhc:acc} With the goal of studying exceedingly rare processes, two parameters can be of particular interest: the center-of-mass energy of the collision, and the frequency of collisions. The LHC addresses both of these concerns. However, each parameter has limiting factors which constrain the design. A charged particle in a magnetic field has momentum defined by~\Eqn{\ref{eqn:mag_field}} and will travel in a circular trajectory in the plane perpendicular to the field~\cite{accelerators} . For a circular accelerator of fixed radius, the magnetic field determines the maximum allowed particle momentum. The LHC used the existing LEP tunnel and invested in developing and implementing strong superconducting magnet technology. Since the LHC uses two beams circulating in opposite directions, the upper limit of the center-of-mass energy is the sum of the two beam energies. \begin{equation} p[\textrm{TeV}] =0.3B[\textrm{T}]\cdot R[\textrm{km}] \label{eqn:mag_field} \end{equation} Besides the limitations on beam energy from size and magnet strength, charged particles that experience acceleration perpendicular to their velocity, such as moving in a circular orbit, lose energy to synchrotron radiation. The power radiated due to synchrotron radiation is shown in~\Eqn{\ref{eqn:synchrotron_rad}}. The power radiated is proportional to $m^{-4}$; thus, heavy particles like protons are much less affected by synchrotron radiation than lighter particles like, for example, electrons. Using the nominal LHC parameters, this translates to each proton losing approximately 10\,\keV\,per turn. \begin{equation} P = \frac{e^2}{6\pi\epsilon_0c^7r^2m^4}E^4 \label{eqn:synchrotron_rad} \end{equation} To study rare processes, it is also important to generate many events. The number of expected events, $N_{\textrm{exp}}$, for a process with cross section, $\sigma_{\textrm{exp}}$, is defined by~\Eqn{\ref{eqn:n_evts}} where $\mathcal{L}$ is the instantaneous luminosity, $N_b$ is the number of particles per bunch, $n_b$ is the number of bunches per beam, $f_{\textrm rev}$ is the revolution frequency, and A is the transverse beam area. Generating many collisions, then, can be accomplished by increasing the luminosity, and running the experiment over a long time period. \begin{equation} N_{\textrm{exp}} = \sigma_{\textrm{exp}}\int\mathcal{L}(t)dt = \sigma_{\textrm{exp}}\int \frac{N_b^2n_b^2f_{\textrm{rev}}}{A} dt \label{eqn:n_evts} \end{equation} Besides the bending dipole magnets of the LHC, quadrupole magnets are used to produce ``strong focusing'' of the beam: sections that focus the horizontal beam direction and defocus the vertical beam direction alternate with sections that defocus the horizontal beam direction and focus the vertical beam direction. This alternate-gradient focusing has the net effect of focusing the beam in both transverse directions, and allows the beam to reach much higher intensities. However, the focusing also induces betatron oscillations, $\beta(s)$, about a nominal trajectory $s$. For an approximately Gaussian beam, the RMS of the beam size in the transverse direction is $\sigma(s)$. The value of $\beta(s)$ and $\sigma(s)$ measured at the interaction point (IP) is denoted $\beta^*$ and $\sigma^*$ respectively. A measure of the beam spread in position and momentum space, known as transverse emittance $\epsilon$, is defined in~\Eqn{\ref{eqn:trans_emit}}. As emittance scales with energy, an invariant, normalized emittance is defined by $\epsilon_n\equiv \beta_r\gamma_r\epsilon$, where $\beta_r, \gamma_r$ are the relativistic functions. Since the beams do not collide head-on, but rather with a crossing angle $\theta_c$, a geometric factor, $F$, accounting for the corresponding reduction in luminosity is defined in~\Eqn{\ref{eqn:f_fact}}, where $\sigma_z$ is the RMS bunch length. \begin{eqnarray} \epsilon&\equiv& \pi\frac{\sigma^2(s)}{\beta(s)} \label{eqn:trans_emit} \\ F &\equiv& \left[ 1+ \left(\frac{\theta_c\sigma_z}{2\sigma^{*}} \right) \right]^{-1/2} \label{eqn:f_fact} \end{eqnarray} %The nominal values for the LHC for F = 0.78 %Design values: $\theta_c=285\,\mu$rad, $\sigma_z=7.55$\,cm, $\sigma^{*}=16.6\,\mu$m, $\epsilon_n\simeq 3.75\,\mu$m, and $\beta^{*}=0.55\,$m. %\footnote{The value of the betatron oscillation function, $\beta(s)$, at the IP is denoted by $\beta^{*}$.} Using these parameters, the luminosity at the IP from~\Eqn{\ref{eqn:n_evts}} can be expressed as shown in~\Eqn{\ref{eqn:inst_lumi}}. %\footnote{$$F = \left[ 1+ \left(\frac{\theta_c\sigma_z}{2\sigma^{*}} \right) \right]^{-1/2}$$ where $\theta_c$ is the full crossing angle at the interaction point (IP), $\sigma_z$ is the RMS bunch length, and $\sigma^{*}$ is the transverse RMS beam size at the IP~\cite{LHC}. Design values: $\theta_c=285\,\mu$rad, $\sigma_z=7.55$\,cm, $\sigma^{*}=16.6\,\mu$m.} Maximizing the luminosity involves maximizing the beam current, $N_bn_bf_{\textrm{rev}}$, maximizing the beam brightness, $N_b/\epsilon_n$, maximizing the beam energy, and minimizing $\beta^{*}$. Several issues arise and limit the maximum achievable luminosity, including beam-beam effects, space-charge, and limited cryogenic absorption. \begin{equation} \mathcal{L} = \frac{N_b^2n_bf_{\textrm{rev}}\gamma_r}{4\pi\epsilon_n\beta^{*}}F(\theta_c,\sigma_z,\beta^{*},\epsilon_n) = \frac{1}{4\pi}\left(N_bn_bf_{\textrm{rev}}\right)\frac{N_b}{\epsilon_n}\frac{\gamma_r}{\beta^{*}}F(\theta_c,\sigma_z,\beta^{*},\epsilon_n) \label{eqn:inst_lumi} \end{equation} In the LHC, due to large uncertainties in determining $\beta^{*}$, the luminosity is not directly measured from the parameters listed in~\Eqn{\ref{eqn:inst_lumi}}; instead, van der Meer scans~\cite{vanderMeer} are used to measure the absolute luminosity during special calibrating runs. A van der Meer scan involves moving the beams relative to each other in both the horizontal and vertical directions while measuring how the event rate changes. The luminosity is rewritten in~\Eqn{\ref{eqn:inel_lumi}} in terms of inelastic collisions, where $\mu = \langle N_{\textrm{inel}}/n_b\rangle$ is the average number of inelastic interactions per bunch crossing. Relative luminosity measurements can be calibrated by measuring the inelastic rate, $R_{\textrm{inel}}$, while the absolute luminosity is determined during a van der Meer scan. \begin{equation} \mathcal{L} = \frac{R_{\textrm{inel}}}{\sigma_{\textrm{inel}}} = \frac{\mu n_b f_{rev}}{\sigma_{\textrm{inel}}} \label{eqn:inel_lumi} \end{equation} % \section{Injection Chain} \label{ch:lhc:inj} To accelerate protons into highly focused, stable bunches, a series of injection stages comprised of previous accelerators at CERN is utilized. The full accelerator complex is shown in~\Fig{\ref{fig:lhc_acc_comp}}, including several experiments not associated with the LHC. The first stage of the injection chain involves producing protons from diatomic hydrogen gas using a metal cylinder, called a Duoplasmatron, in an electric field~\cite{lhc_closer_look}. The 100\,\keV\,plasma beam of bare protons leaving the Duoplasmatron is then accelerated up to 750\,\keV\, in the Radio-Frequency Quadrupole (RFQ). %The gas undergoes a chemical reaction, shown in~\Eqn{\ref{eq:proton_strip}}, producing a 100\,\keV\,plasma beam with bare protons at a 70\% efficiency. %\footnote{At STP, a typical 5\,kg tank of H$_2$ has 2,500 moles of gas. Assuming a typical LHC beam lifetime of 10 hours, this tank would last: \begin{eqnarray} & 0.7\,(\text{efficiency})\times2500\,\text{mol} \times \frac{6\cdot 10^{23}\,\text{H}_2\,\text{molecules}}{\text{mol}}\times\frac{2\,p^+}{\text{H}_2\,\text{molecule}}\times\frac{\text{bunch}}{1.15\cdot10^{11}\,p^+}\nonumber\\ &\times\frac{\text{run}}{2\times2808\,\text{bunches}}\times\frac{10\,\text{hr}}{\text{run}}\times\frac{\text{yr}}{24\times365.25\,\text{hr}} = 3.7\cdot10^9\,\text{yr}\nonumber\end{eqnarray}} %\begin{eqnarray}H_2+e^-&\ra& H_2^+ +2e^- \nonumber\\H_2^+ + e^- &\ra& H^+ + H + e^-\nonumber\\H+e^-&\ra& H^+ + 2e^- \label{eq:proton_strip}\end{eqnarray} Besides providing acceleration, the RFQ also efficiently focuses and bunches the initially continuous input beam. The next leg of the journey is through the Linear Accelerator 2 (Linac2), whose 200 \,MHz radio-frequency (RF) cavities accelerate the proton bunches to 50\,\MeV\,over 30\,m, while quadrupole magnets keep the beam focused. The protons are transported through 80\,m of connecting pipe, with 20 focusing quadrupole magnets, to the Proton Synchrotron Booster (PSB). In the 25\,m radius PSB, four superimposed rings accelerate the protons further to 1.4\,\GeV\,before injection into the Proton Synchrotron (PS). The high beam brightness, $N_b/\epsilon_n$, has a de-focusing effect due to high space charge\footnote{ The protons feel an electrostatic repulsion to each other from their charge, but also feel an attraction since they behave like parallel currents as they orbit. For low momenta the repulsion dominates and has a defocussing effect, while in the ultra-relativistic limit the forces cancel. }; thus, the PSB injects the PS with multiple cycles, lowering $N_b$ per injection, and thus minimizing the impact of space charge. Protons travel around the 628\,m circumference PS for 3.6 seconds, at which point they have been accelerated to 25\,\GeV. In the PS, the proton bunches form trains where each bunch of approximately $1.15\times10^{11}$ protons is separated by 25\,ns. Typically three or four bunch trains are then injected into the 7\,km circumference Super Proton Synchrotron (SPS). The SPS accelerates the bunch trains to 450\,\GeV\, and then injects them into both rings of the LHC. Typically 12 cycles are required to fill each ring in the LHC with the nominal 2,808 bunches. \begin{figure}[tbp] \begin{center} \includegraphics[width=.8\textwidth]{figures/LHC/accelerator} \end{center} \caption[The LHC accelerator complex]{The layout of the accelerator complex at CERN. The protons are accelerated through Linac 2, PSB, PS and SPS and then injected into the LHC as shown. Several additional experiments unrelated to the LHC are also depicted~\cite{acc_comp}.} \label{fig:lhc_acc_comp} \end{figure} % \section{LHC Design} \label{ch:lhc:des} The fundamental components of the LHC are the two rings, dipole bending magnets, quadrupole focusing magnets, and RF acceleration cavities. Since the diameter of the LHC tunnel is only 3.7\,m, there is no room for two separate rings. Instead, a ``twin-bore'' dipole magnet design is implemented, whereby both coils and beam channels are magnetically and mechanically coupled inside the same cryostat. There are 1,232 superconducting dipole magnets which principally provide the necessary bending for protons circling the LHC. The dipoles consist of coils of superconducting niobium-titanium (NbTi) in two layers around the beam pipe. The wires are arranged so that the current flows in opposite directions on either side of the beam pipe in order to produce a magnetic field perpendicular to the beam line. %, as depicted in~\Fig{\ref{fig:lhc_magnets}}. The dipole coils are cooled with superfluid helium to 1.9\,K, well below the critical temperature of the wires, carrying an enormous 11.85\,kA current and producing an 8.33\,T magnetic field. Since the wires on either side of the beam pipe carry currents in opposing directions, they feel a strong repulsive force. Therefore, non-magnetic collars envelop the coils and prevent them from separating. As mentioned previously, the LHC uses quadrupole magnets in an alternate-gradient focusing scheme to constrain the transverse beam profile in both the horizontal and vertical directions. %, as depicted in~\Fig{\ref{fig:lhc_magnets}}. There are 392 such quadrupole magnets interspaced with the dipole magnets and several other, higher multipole adjustment magnets. %\begin{figure} %\begin{center} %\includegraphics[width=.39\textwidth]{figures/LHC/dipole_bend} %\includegraphics[width=.41\textwidth]{figures/LHC/quad_field} %\caption[Dipole and quadrupole LHC magnets]{The wires of the dipole magnets (left) are arranged so the current flows in opposite directions on either side of the beam pipe, producing a perpendicular magnetic field. The quadrupole magnet (right) alternate-gradient focusing scheme results in focusing both horizontal and vertical beam profiles~\cite{lhc_closer_look}.} %\label{fig:lhc_magnets} %\end{center} %\end{figure} In order to accelerate the injected protons to their nominal energy, eight superconducting RF cavities are used per beam. The RF cavities operate at 400\,MHz, generating an oscillating electric field that provides additional kicks to synchronous protons. A proton arriving slightly before or after a synchronous proton will undergo a longitudinal oscillation about the nominal trajectory. This effectively creates RF ``buckets'' in which the LHC bunches are confined. The nominal LHC bunch spacing is 25\,ns, which corresponds to 10 RF buckets. Each RF cavity is made out of a niobium film on a copper cavity, cooled to 4.5\,K. The cavities each deliver 2\,MV, corresponding to a boost per proton of 16\,\MeV\, per turn. After both rings of the LHC are filled, the bunches are slowly accelerated, or ``ramped'', over approximately 20 minutes to the nominal collision energy by the RF cavities. When the beams are fully prepared, they are aligned onto each other to provide collisions %\footnote{Since the LHC is 26.7\,km in circumference, with 25\,ns bunch spacing there is room for 3,550 bunches; however, only 2808 are filled to help with beam injection and dumping. At 6.5\,\TeV, protons have an ultra-relativistic $\gamma_r=6,927$ corresponding to 11,245 trips around the LHC per second. The 2808 bunches thus produce an average crossing rate of 31.6\,MHz. An average interaction per crossing, $\mu$, of $\sim25$ yields $0.8\times10^9$\, collisions per second.} at several interaction points around the ring. Further fine-tuning adjustments are made, if required, and then the beams are declared ``stable''. During stable beams, the detectors begin recording the collision data for physics analysis. The beam lifetime is approximately 10\,hours, after which the bunches are dumped and the injection process begins again. During an LHC run, the instantaneous luminosity drops as a function of time as the bunches slowly deplete from collisions; therefore, short segments called luminosity blocks are used to estimate periods of approximately equal instantaneous luminosity. Typically, luminosity blocks are around one to two minutes long. Using the instantaneous luminosity measurements for each luminosity block the total integrated luminosity can be calculated. The total luminosity delivered and recorded by ATLAS in 2015 and 2016 is shown in~\Fig{\ref{fig:lumi_2015_2016}}. \begin{figure}[htbp] \begin{center} \includegraphics[width=.49\textwidth]{figures/Atlas/Lumi_2015} \includegraphics[width=.49\textwidth]{figures/Atlas/Lumi_2016} \end{center} \caption[Delivered and recorded luminosity in 2015 and 2016]{The total integrated luminosity versus time delivered to ATLAS (green) and recorded by ATLAS (yellow) during stable beams for $pp$ collisions at $\sqrt{s}=13$\,\TeV\, is shown for 2015 (left) and 2016 (right)~\cite{Lumi_Public_Run2}.} \label{fig:lumi_2015_2016} \end{figure} % %\clearpage \section{Experiments at the LHC} \label{ch:lhc:exp} %\begin{figure}[htbp] %\begin{wrapfigure}{r}{.5\textwidth} %\begin{center} %\includegraphics[width=0.49\textwidth]{figures/LHC/lhc-grid} %\caption[Octant geometry of the LHC]{A schematic of the octant geometry of the LHC: ATLAS and CMS sit opposite each other at Point 1 and Point 5, respectively, while ALICE and LHCb sit adjacent to ATLAS at Point 2 and Point 8, respectively~\cite{LHC}.} %\label{fig:lhc_grid} %\end{center} %\end{wrapfigure} %\end{figure} The LHC is constructed with an octant geometry, %, shown in~\Fig{\ref{fig:lhc_grid}}, with eight arcing sections alternating with eight 528\,m straight sections. In the straight sections, the two beams are either brought together at an IP for a detector to measure collisions, or the section are used for services and utilities. There are four main experiments at the LHC: two general-purpose, high-luminosity detectors ATLAS (A Toroidal LHC ApparatuS)~\cite{ATLAS} and CMS (Compact Muon Solenoid)~\cite{CMS}, and two specialized detectors designed for specific phenomena ALICE (A Large Ion Collider Experiment)~\cite{ALICE} and LHCb (Large Hadron Collider beauty)~\cite{LHCb}. The two high-luminosity experiments are placed on opposite sides of the ring: ATLAS is located at Point 1, while CMS is located at Point 5. ALICE and LHCb sit on either side of ATLAS at Point 2 and Point 8, respectively. Both ATLAS and CMS search for a wide spectrum of physics processes. Consequently, the two independently designed experiments offer a valuable cross check in the event of potential discoveries, as was the case with the discovery of the Higgs boson in 2012~\cite{Higgs_atlas,Higgs_cms}. In addition to the four main experiments, three smaller experiments are placed near existing IPs: TOTEM (TOTal Elastic and diffractive cross section Measurement)~\cite{TOTEM}, MoEDAL (Monopole and Exotics Detector at the LHC)~\cite{MoEDAL}, and LHCf (Large Hadron Collider forward)~\cite{LHCf} sit close to CMS, LHCb, and ATLAS respectively. This analysis uses data collected with ATLAS, described in depth in~\Ch{\ref{ch:atlas}}. %%% \iffalse %%% One of the main design differences between ATLAS and CMS is the magnet system: CMS is designed around a large solenoid magnet that produces a 4\,T field. From IP outwards, the detector consists of a silicon tracker, a scintillating lead tungstate electromagnetic calorimeter, a sampling, plastic-scintillator hadronic calorimeter, a large superconducting solenoid magnet, and a variety of muon detectors. Unlike CMS and ATLAS, ALICE is specifically designed to study heavy-ion (Pb-Pb) collisions in order to investigate the quark-gluon plasma and the environment of the early universe\footnote{Proton-lead collisions are also useful.}. The lead nuclei are stripped of all 84 electrons, and accelerated so that each proton has 3.5\,\TeV, or $\sqrt{s}=574\,\TeV$ for the collision of two lead nuclei. The tremendous energy densities reached produce a large multiplicity of particles per collision; consequently, ALICE was designed to differentiate and categorize each collision product. In the barrel region, hadrons, electrons and photons are measured, whereas muons are measured in the forward spectrometer. From IP outwards in the barrel, particles travel through an inner silicon tracker, a gas-tracker Time Projection Chamber, several particle identification arrays, and finally two electromagnetic calorimeters. One of the main goals of the system of forward muon detectors is to measure and differentiate heavy-quark resonances. Specializing in the study of b-hadron physics, LHCb detects $pp$ collisions. One important investigation is the study of CP violation parameters which can help answer questions related to the observed matter-antimatter asymmetry in the Universe. Due to the large expected $b\bar{b}$ cross section at the nominal 14\,\TeV, LHCb can run efficiently at lower luminosities to eliminate multiple interactions per crossing. LHCb takes advantage of the fact that b-hadrons typically decay close to the direction of the colliding beams: it is a narrow, single-arm detector covering a polar angle of 10\,mrad to 300 (250)\,mrad in the horizontal (vertical) plane. Close to the IP, primary and secondary vertices are distinguished with a vertex detector. Particle identification is performed with two ring imaging Cherenkov detectors, sandwiching three trackers and a large dipole magnet. Finally, the outermost layers consist of electromagnetic and hadronic calorimeters as well as a muon spectrometer. The final three experiments at the LHC are much smaller. The goal of TOTEM is to measure the total $pp$ cross section, as well as to study diffractive (one proton emerges) and elastic (both protons emerge) scattering at very small angles. MoEDAL uses nuclear track detectors to search for magnetic monopoles, or other heavy, stable, highly-ionizing particles. Finally, LHCf is designed to measure neutral pions emanating extremely close to the beam line, which can be used to understand the hadronic interactions of high energy cosmic rays. %%% \fi %%%
{"hexsha": "8423fe2e2c58b9e1760ade666e61201a2755c7bd", "size": 23292, "ext": "tex", "lang": "TeX", "max_stars_repo_path": "tex/preface/LHC.tex", "max_stars_repo_name": "rynecarbone/Thesis_lvJ", "max_stars_repo_head_hexsha": "46ba8b142e945d5f3103a364630f661da3405479", "max_stars_repo_licenses": ["CC0-1.0"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2017-09-29T22:35:55.000Z", "max_stars_repo_stars_event_max_datetime": "2017-09-30T22:25:37.000Z", "max_issues_repo_path": "tex/preface/LHC.tex", "max_issues_repo_name": "rynecarbone/Thesis_lvJ", "max_issues_repo_head_hexsha": "46ba8b142e945d5f3103a364630f661da3405479", "max_issues_repo_licenses": ["CC0-1.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tex/preface/LHC.tex", "max_forks_repo_name": "rynecarbone/Thesis_lvJ", "max_forks_repo_head_hexsha": "46ba8b142e945d5f3103a364630f661da3405479", "max_forks_repo_licenses": ["CC0-1.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 154.2516556291, "max_line_length": 1528, "alphanum_fraction": 0.7810836339, "num_tokens": 6118}
[STATEMENT] lemma SubstAtomicP_unique: "{SubstAtomicP v tm x y, SubstAtomicP v tm x y'} \<turnstile> y' EQ y" [PROOF STATE] proof (prove) goal (1 subgoal): 1. {SubstAtomicP v tm x y, SubstAtomicP v tm x y'} \<turnstile> y' EQ y [PROOF STEP] proof - [PROOF STATE] proof (state) goal (1 subgoal): 1. {SubstAtomicP v tm x y, SubstAtomicP v tm x y'} \<turnstile> y' EQ y [PROOF STEP] obtain t::name and ts::name and u::name and us::name and t'::name and ts'::name and u'::name and us'::name where "atom t \<sharp> (v,tm,x,y,y',ts,u,us)" "atom ts \<sharp> (v,tm,x,y,y',u,us)" "atom u \<sharp> (v,tm,x,y,y',us)" "atom us \<sharp> (v,tm,x,y,y')" "atom t' \<sharp> (v,tm,x,y,y',t,ts,u,us,ts',u',us')" "atom ts' \<sharp> (v,tm,x,y,y',t,ts,u,us,u',us')" "atom u' \<sharp> (v,tm,x,y,y',t,ts,u,us,us')" "atom us' \<sharp> (v,tm,x,y,y',t,ts,u,us)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. (\<And>t ts u us t' ts' u' us'. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] by (metis obtain_fresh) [PROOF STATE] proof (state) this: atom t \<sharp> (v, tm, x, y, y', ts, u, us) atom ts \<sharp> (v, tm, x, y, y', u, us) atom u \<sharp> (v, tm, x, y, y', us) atom us \<sharp> (v, tm, x, y, y') atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us') atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us') atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us') atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us) goal (1 subgoal): 1. {SubstAtomicP v tm x y, SubstAtomicP v tm x y'} \<turnstile> y' EQ y [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: atom t \<sharp> (v, tm, x, y, y', ts, u, us) atom ts \<sharp> (v, tm, x, y, y', u, us) atom u \<sharp> (v, tm, x, y, y', us) atom us \<sharp> (v, tm, x, y, y') atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us') atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us') atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us') atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us) goal (1 subgoal): 1. {SubstAtomicP v tm x y, SubstAtomicP v tm x y'} \<turnstile> y' EQ y [PROOF STEP] apply (simp add: SubstAtomicP.simps [of t v tm x y ts u us] SubstAtomicP.simps [of t' v tm x y' ts' u' us']) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {SyntaxN.Ex t (SyntaxN.Ex u (SyntaxN.Ex ts (SyntaxN.Ex us (SubstTermP v tm (Var t) (Var ts) AND SubstTermP v tm (Var u) (Var us) AND (x EQ Q_Eq (Var t) (Var u) AND y EQ Q_Eq (Var ts) (Var us) OR x EQ Q_Mem (Var t) (Var u) AND y EQ Q_Mem (Var ts) (Var us)))))), SyntaxN.Ex t' (SyntaxN.Ex u' (SyntaxN.Ex ts' (SyntaxN.Ex us' (SubstTermP v tm (Var t') (Var ts') AND SubstTermP v tm (Var u') (Var us') AND (x EQ Q_Eq (Var t') (Var u') AND y' EQ Q_Eq (Var ts') (Var us') OR x EQ Q_Mem (Var t') (Var u') AND y' EQ Q_Mem (Var ts') (Var us'))))))} \<turnstile> y' EQ y [PROOF STEP] apply (rule Ex_EH Disj_EH Conj_EH)+ [PROOF STATE] proof (prove) goal (19 subgoals): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ Q_Eq (Var t) (Var u), y EQ Q_Eq (Var ts) (Var us), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ Q_Eq (Var t') (Var u'), y' EQ Q_Eq (Var ts') (Var us'), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 2. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ Q_Mem (Var t) (Var u) AND y EQ Q_Mem (Var ts) (Var us), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ Q_Eq (Var t') (Var u'), y' EQ Q_Eq (Var ts') (Var us'), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 3. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ Q_Mem (Var t') (Var u') AND y' EQ Q_Mem (Var ts') (Var us'), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts'), SubstTermP v tm (Var t) (Var ts) AND SubstTermP v tm (Var u) (Var us) AND (x EQ Q_Eq (Var t) (Var u) AND y EQ Q_Eq (Var ts) (Var us) OR x EQ Q_Mem (Var t) (Var u) AND y EQ Q_Mem (Var ts) (Var us))} \<turnstile> y' EQ y 4. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> atom us' \<sharp> y' EQ y 5. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> \<forall>C\<in>{SubstTermP v tm (Var t) (Var ts) AND SubstTermP v tm (Var u) (Var us) AND (x EQ Q_Eq (Var t) (Var u) AND y EQ Q_Eq (Var ts) (Var us) OR x EQ Q_Mem (Var t) (Var u) AND y EQ Q_Mem (Var ts) (Var us))}. atom us' \<sharp> C 6. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> atom ts' \<sharp> y' EQ y 7. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> \<forall>C\<in>{SubstTermP v tm (Var t) (Var ts) AND SubstTermP v tm (Var u) (Var us) AND (x EQ Q_Eq (Var t) (Var u) AND y EQ Q_Eq (Var ts) (Var us) OR x EQ Q_Mem (Var t) (Var u) AND y EQ Q_Mem (Var ts) (Var us))}. atom ts' \<sharp> C 8. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> atom u' \<sharp> y' EQ y 9. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> \<forall>C\<in>{SubstTermP v tm (Var t) (Var ts) AND SubstTermP v tm (Var u) (Var us) AND (x EQ Q_Eq (Var t) (Var u) AND y EQ Q_Eq (Var ts) (Var us) OR x EQ Q_Mem (Var t) (Var u) AND y EQ Q_Mem (Var ts) (Var us))}. atom u' \<sharp> C 10. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> atom t' \<sharp> y' EQ y A total of 19 subgoals... [PROOF STEP] apply simp_all [PROOF STATE] proof (prove) goal (3 subgoals): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ Q_Eq (Var t) (Var u), y EQ Q_Eq (Var ts) (Var us), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ Q_Eq (Var t') (Var u'), y' EQ Q_Eq (Var ts') (Var us'), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 2. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ Q_Mem (Var t) (Var u) AND y EQ Q_Mem (Var ts) (Var us), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ Q_Eq (Var t') (Var u'), y' EQ Q_Eq (Var ts') (Var us'), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 3. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ Q_Mem (Var t') (Var u') AND y' EQ Q_Mem (Var ts') (Var us'), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts'), SubstTermP v tm (Var t) (Var ts) AND SubstTermP v tm (Var u) (Var us) AND (x EQ Q_Eq (Var t) (Var u) AND y EQ Q_Eq (Var ts) (Var us) OR x EQ Q_Mem (Var t) (Var u) AND y EQ Q_Mem (Var ts) (Var us))} \<turnstile> y' EQ y [PROOF STEP] apply (rule Eq_Trans_E [OF Hyp], auto simp: HTS) [PROOF STATE] proof (prove) goal (4 subgoals): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {Zero EQ Zero, Var t EQ Var t', Var u EQ Var u', y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 2. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 3. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 4. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (rule SubstTermP_eq [THEN thin1], blast) [PROOF STATE] proof (prove) goal (4 subgoals): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {SubstTermP v tm (Var t') (Var ts), Var u EQ Var u', y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 2. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 3. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 4. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (rule SubstTermP_eq [THEN rotate2], blast) [PROOF STATE] proof (prove) goal (4 subgoals): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {SubstTermP v tm (Var u') (Var us), SubstTermP v tm (Var t') (Var ts), y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 2. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 3. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 4. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (rule Trans [OF Hyp Sym], blast) [PROOF STATE] proof (prove) goal (4 subgoals): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {SubstTermP v tm (Var u') (Var us), SubstTermP v tm (Var t') (Var ts), y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')) 2. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 3. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 4. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (rule Trans [OF Hyp], blast) [PROOF STATE] proof (prove) goal (4 subgoals): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {SubstTermP v tm (Var u') (Var us), SubstTermP v tm (Var t') (Var ts), y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)) EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')) 2. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 3. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 4. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (metis Assume AssumeH(8) HPair_cong Refl cut2 [OF SubstTermP_unique] thin1) [PROOF STATE] proof (prove) goal (3 subgoals): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), SubstTermP v tm (Var t) (Var ts), x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts') (Var us')), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 2. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 3. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (rule Eq_Trans_E [OF Hyp], blast, force simp add: HTS) [PROOF STATE] proof (prove) goal (2 subgoals): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero (HPair Zero (HPair Zero Zero))) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y 2. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (rule Eq_Trans_E [OF Hyp], blast, force simp add: HTS) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {x EQ HPair (HPair Zero Zero) (HPair (Var t) (Var u)), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (rule Eq_Trans_E [OF Hyp], auto simp: HTS) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {Zero EQ Zero, Var t EQ Var t', Var u EQ Var u', y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (rule SubstTermP_eq [THEN thin1], blast) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {SubstTermP v tm (Var t') (Var ts), Var u EQ Var u', y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (rule SubstTermP_eq [THEN rotate2], blast) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {SubstTermP v tm (Var u') (Var us), SubstTermP v tm (Var t') (Var ts), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y' EQ y [PROOF STEP] apply (rule Trans [OF Hyp Sym], blast) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {SubstTermP v tm (Var u') (Var us), SubstTermP v tm (Var t') (Var ts), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> y EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')) [PROOF STEP] apply (rule Trans [OF Hyp], blast) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>atom t \<sharp> (v, tm, x, y, y', ts, u, us); atom ts \<sharp> (v, tm, x, y, y', u, us); atom u \<sharp> (v, tm, x, y, y', us); atom us \<sharp> (v, tm, x, y, y'); atom t' \<sharp> (v, tm, x, y, y', t, ts, u, us, ts', u', us'); atom ts' \<sharp> (v, tm, x, y, y', t, ts, u, us, u', us'); atom u' \<sharp> (v, tm, x, y, y', t, ts, u, us, us'); atom us' \<sharp> (v, tm, x, y, y', t, ts, u, us)\<rbrakk> \<Longrightarrow> {SubstTermP v tm (Var u') (Var us), SubstTermP v tm (Var t') (Var ts), y EQ HPair (HPair Zero Zero) (HPair (Var ts) (Var us)), SubstTermP v tm (Var u) (Var us), x EQ HPair (HPair Zero Zero) (HPair (Var t') (Var u')), y' EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')), SubstTermP v tm (Var t) (Var ts), SubstTermP v tm (Var u') (Var us'), SubstTermP v tm (Var t') (Var ts')} \<turnstile> HPair (HPair Zero Zero) (HPair (Var ts) (Var us)) EQ HPair (HPair Zero Zero) (HPair (Var ts') (Var us')) [PROOF STEP] apply (metis Assume AssumeH(8) HPair_cong Refl cut2 [OF SubstTermP_unique] thin1) [PROOF STATE] proof (prove) goal: No subgoals! [PROOF STEP] done [PROOF STATE] proof (state) this: {SubstAtomicP v tm x y, SubstAtomicP v tm x y'} \<turnstile> y' EQ y goal: No subgoals! [PROOF STEP] qed
{"llama_tokens": 18208, "file": "Incompleteness_Functions", "length": 23}
C Copyright(C) 1988-2017 National Technology & Engineering Solutions C of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with C NTESS, the U.S. Government retains certain rights in this software. C C Redistribution and use in source and binary forms, with or without C modification, are permitted provided that the following conditions are C met: C C * Redistributions of source code must retain the above copyright C notice, this list of conditions and the following disclaimer. C C * Redistributions in binary form must reproduce the above C copyright notice, this list of conditions and the following C disclaimer in the documentation and/or other materials provided C with the distribution. C C * Neither the name of NTESS nor the names of its C contributors may be used to endorse or promote products derived C from this software without specific prior written permission. C C THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS C "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT C LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR C A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT C OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, C SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT C LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, C DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY C THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT C (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE C OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. C $Id: lissel.f,v 1.1 1991/02/21 15:43:56 gdsjaar Exp $ C $Log: lissel.f,v $ C Revision 1.1 1991/02/21 15:43:56 gdsjaar C Initial revision C C======================================================================= SUBROUTINE LISSEL (OPT, TYPE, IOMIN, IOMAX, LIST, SELECT, NUMLST) C======================================================================= C C ... Output selected entities to Terminal and/or List file C C OPT = IN = Option: C 'L' = Selected by logical list C 'A' = All selected are in list C 'R' = List in Range form C LOGICAL SELECT(*) CHARACTER*(*) OPT, TYPE INTEGER LIST(*), ISCR(12) CHARACTER*80 STRING LOGICAL ISABRT WRITE (STRING, 10) TYPE(:LENSTR(TYPE)) 10 FORMAT ('List of Selected ',A) CALL SQZSTR(STRING,LSTR) DO 20 IO=IOMIN, IOMAX WRITE (IO, 30) STRING(:LSTR) 20 CONTINUE 30 FORMAT (/,1X,A/) II = 0 IF (INDEX(OPT,'R') .GT. 0) THEN CALL RANGE(NUMLST, SELECT, IOMIN, IOMAX) ELSE DO 50 I = 1, NUMLST IF (SELECT(I)) THEN II = II + 1 ISCR(II) = I IF (II .EQ. 12) THEN IF (ISABRT()) RETURN DO 40 IO = IOMIN, IOMAX WRITE (IO, 70) (ISCR(ILST),ILST=1,II) 40 CONTINUE II = 0 END IF END IF 50 CONTINUE IF (II .GT. 0) THEN DO 60 IO = IOMIN, IOMAX WRITE (IO, 70) (ISCR(ILST),ILST=1,II) 60 CONTINUE END IF 70 FORMAT ((1X,12I6)) END IF RETURN END
{"hexsha": "05b6c4a7e43f46a46bccb9e4d0218b4dc086403b", "size": 3489, "ext": "f", "lang": "FORTRAN", "max_stars_repo_path": "packages/seacas/applications/numbers/nu_lissel.f", "max_stars_repo_name": "mathstuf/seacas", "max_stars_repo_head_hexsha": "49b3466e3bba12ec6597e364ce0f0f149f9ca909", "max_stars_repo_licenses": ["BSD-3-Clause", "NetCDF", "Zlib", "MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "packages/seacas/applications/numbers/nu_lissel.f", "max_issues_repo_name": "mathstuf/seacas", "max_issues_repo_head_hexsha": "49b3466e3bba12ec6597e364ce0f0f149f9ca909", "max_issues_repo_licenses": ["BSD-3-Clause", "NetCDF", "Zlib", "MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/seacas/applications/numbers/nu_lissel.f", "max_forks_repo_name": "mathstuf/seacas", "max_forks_repo_head_hexsha": "49b3466e3bba12ec6597e364ce0f0f149f9ca909", "max_forks_repo_licenses": ["BSD-3-Clause", "NetCDF", "Zlib", "MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 39.202247191, "max_line_length": 75, "alphanum_fraction": 0.6041845801, "num_tokens": 913}
using TypeClasses using Test using DataTypesBasic using Suppressor splitln(str) = split(strip(str), "\n") # Combine # ======= a = Callable(x -> "hello $x") b = Callable(x -> "!") (a ⊕ b)(:Albert) # FunctorApplicativeMonad # ======================= g = Callable(x -> x*2) f = Callable(x -> x*x) # just function composition fg = map(g) do x2 f(x2) end @test fg(3) == f(g(3)) fPLUSg = mapn(f, g) do x1, x2 x1 + x2 end @test fPLUSg(3) == f(3) + g(3) fPRODg = @syntax_flatmap begin x1 = f x2 = g @pure x1 * x2 end @test fPRODg(3) == f(3) * g(3) # FlipTypes # ========= # this works because Callable implements `ap` a = Callable.([x -> x, y -> 2y, z -> z*z]) @test flip_types(a)(3) == [3, 6, 9]
{"hexsha": "5fbd5bab3981f97b03ffe30471698e8e7ee7a39c", "size": 714, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "test/TypeInstances/Callable.jl", "max_stars_repo_name": "JuliaFunctional/TypeClasses.jl", "max_stars_repo_head_hexsha": "815ab57bc0b15a57132191d4989b3bbe7abcabbe", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2021-07-27T18:50:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-07T04:30:01.000Z", "max_issues_repo_path": "test/TypeInstances/Callable.jl", "max_issues_repo_name": "JuliaFunctional/TypeClasses.jl", "max_issues_repo_head_hexsha": "815ab57bc0b15a57132191d4989b3bbe7abcabbe", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2021-07-16T10:52:24.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-24T22:21:27.000Z", "max_forks_repo_path": "test/TypeInstances/Callable.jl", "max_forks_repo_name": "JuliaFunctional/TypeClasses.jl", "max_forks_repo_head_hexsha": "815ab57bc0b15a57132191d4989b3bbe7abcabbe", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-07-30T02:26:00.000Z", "max_forks_repo_forks_event_max_datetime": "2021-07-30T02:26:00.000Z", "avg_line_length": 14.28, "max_line_length": 45, "alphanum_fraction": 0.5574229692, "num_tokens": 266}
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt from matplotlib.collections import PatchCollection import random class Atom: """A simple atom in a 2-D crystal grain, with its coordinates.""" def __init__(self, grain, coords): self.grain = grain self.coords = coords class Grain: """A grain in a 2-D (poly-)crystal. grain_id is the unique ID of the grain, seed is the (x,y) coordinates of the first atom placed in the grain, and lattice is a string identifying which kind of crystal lattice to use ('hex' or 'square'). """ def __init__(self, grain_id, origin_coord, lattice='hex'): print("Creating Grain " + str(grain_id) + " with origin_coord " + str(origin_coord)) self.grain_id = grain_id self.origin_coord = origin_coord self.lattice = lattice # Initialize the displacements for other atoms around a reference atom, # and the maximum rotation angle, phi, to obtain all orientations. if lattice == 'hex': # Hexagonal lattice: 6 other atoms in a hexagonal pattern. a, b = 0.5, np.sqrt(3)/2 self.lattice_disp = np.array( [[a,-b],[1,0],[a,b],[-a,b],[-1,0],[-a,-b]]).T self.phi = np.pi / 3 elif lattice == 'square': # Square lattice: 4 other atoms placed orthogonally. self.lattice_disp = np.array([[1.,0],[0,1.],[-1.,0],[0,-1.]]).T self.phi = np.pi / 2 else: sys.exit('Undefined lattice type: {}'.format(lattice)) # Rotate the displacements by some random angle up to phi. self.setup_rotated_displacements() def setup_rotated_displacements(self): """Rotate atom displacements at random to change the orientation.""" def _make_rot_matrix(alpha): return np.array([[np.cos(alpha), -np.sin(alpha)], [np.sin(alpha), np.cos(alpha)]]) theta = np.random.rand() * self.phi # Two-dimensional rotation matrix. self.rot = _make_rot_matrix(theta) self.lattice_disp = (self.rot @ self.lattice_disp).T patch_rot = _make_rot_matrix(self.phi/2) if self.lattice == 'hex': a = 1 / np.sqrt(3) else: a = 1 / np.sqrt(2) self.patch_disp = a * (patch_rot @ self.lattice_disp.T).T def distance(p, q): """Return the Euclidean distance between points p and q.""" return np.hypot(*(p-q)) class SimCells: """A region of the simulation area to search for neighbours. To save us from calculating all the pairwise distances, keep track of the location of atoms in "cells": for a given candidate site, we then only need to look within that site's cell and its immediate neighbouring cells. """ def __init__(self, atom_diameter): """Initialize the cell size and the array of cells.""" self.n = int(1 / 2 / atom_diameter) self.a = 1 / self.n print("N: ", self.n) print("a: ", self.a) self.cell_array = [[[] for i in range(self.n)] for j in range(self.n)] def _get_cell_indexes_from_atom_coords(self, coords): """Return the indexes ix, iy of the cell containing point coords.""" x, y = coords return int(x / self.a), int(y / self.a) def _get_atom_cell(self, atom): """Return the cell containing atom.""" ix, iy = self._get_cell_indexes_from_atom_coords(atom.coords) return self.cell_array[ix][iy] def add_atom_to_cell(self, atom): """Add atom to the appropriate cell.""" self._get_atom_cell(atom).append(atom) def neighbouring_atoms_generator(self, coords): """Return a generator yielding all atoms "near" point coords.""" ix, iy = self._get_cell_indexes_from_atom_coords(coords) dxy = ((0,0), (1,0), (1,1), (0,1), (-1,1), (-1,0), (-1,-1), (0,-1), (-1,1)) for dx, dy in dxy: ixx, iyy = ix+dx, iy+dy if not (0 <= ixx < self.n and 0 <= iyy < self.n): continue for atom in self.cell_array[ixx][iyy]: yield atom class Crystal: """A simulation of a two-dimensional polycrystal.""" def __init__(self, ngrains=5, seed_minimum_distance=0.2, lattice='hex', atom_diameter=0.02): """Initialise the polycrystal. ngrains is the number of grains, to be placed randomly on the unit square with a minumum distance, seed_minimum_distance, between them. hex = 'hex' or 'square' is the crystalline lattice type and d is the atom diameter. """ self.ngrains = ngrains self.seed_minimum_distance = seed_minimum_distance self.lattice = lattice self.atom_diameter = atom_diameter self.atoms, self.grains = [], [] def seed_grains(self): """De acordo com o critério de validação de distancia minima entre os seeds (Origens) dos Grains, obtém o ponto de origem de cada um dos Grains e os instancia.""" """Esta funcão foi ajustada em 11/12/2021 para quando só existir 1 Grain aceitar diretamente o seed sugerido pelo ramdomize. Neste caso, não há necessidade do uso de seed_minimum_distance como critério de validação. """ """Caso no futuro deseje-se utilizar esta função para multiplos Grains deve-se verificar a necessidade de ajustar o código, pois ocorre aceitação do seed proposto pelo randomize independente do critério de validação seed_minimum_distance. """ # Reset the crystal. self.atoms, self.grains = [], [] self.sim_cells = SimCells(self.atom_diameter) if self.ngrains == 1: grain_origin_atom_coord = np.random.random((2,)) print("VEIO PRA CÁ") # Initialise a grain and add its seed atom. grain = Grain(0, grain_origin_atom_coord, self.lattice) self.grains.append(grain) atom = Atom(grain, grain_origin_atom_coord) self.atoms.append(atom) self.sim_cells.add_atom_to_cell(atom) else: for i in range(self.ngrains): print("\n\ni: ", i, len(self.atoms)) while True: grain_origin_atom_coord = np.random.random((2,)) for atom in self.atoms: if distance(grain_origin_atom_coord, atom.coords) < self.seed_minimum_distance: print(grain_origin_atom_coord, atom.coords, distance(grain_origin_atom_coord, atom.coords), self.seed_minimum_distance, len(self.atoms), "ACEITOU ATOM!\n") # Seed atom too close to another: go back and try again break print(grain_origin_atom_coord, atom.coords, distance(grain_origin_atom_coord, atom.coords), self.seed_minimum_distance, len(self.atoms), "NÃO ACEITOU ATOM!") else: print("VEIO PRA CÁ") # Initialise a grain and add its seed atom. grain = Grain(i, grain_origin_atom_coord, self.lattice) self.grains.append(grain) atom = Atom(grain, grain_origin_atom_coord) self.atoms.append(atom) self.sim_cells.add_atom_to_cell(atom) break # def seed_grains(self): # """Place the ngrain seeds randomly, a minimum distance apart.""" # """De acordo com o critério de validação de distancia minima entre os # seeds (Origens) dos Grains, obtém o ponto de origem de cada um dos # Grains e os instancia.""" # # Reset the crystal. # self.atoms, self.grains = [], [] # self.sim_cells = SimCells(self.atom_diameter) # for i in range(self.ngrains): # print("\n\ni: ", i, len(self.atoms)) # while True: # grain_origin_atom_coord = np.random.random((2,)) # for atom in self.atoms: # if distance(grain_origin_atom_coord, atom.coords) < self.seed_minimum_distance: # print(grain_origin_atom_coord, atom.coords, # distance(grain_origin_atom_coord, atom.coords), # self.seed_minimum_distance, len(self.atoms), "ACEITOU ATOM!\n") # # Seed atom too close to another: go back and try again # break # print(grain_origin_atom_coord, atom.coords, # distance(grain_origin_atom_coord, atom.coords), # self.seed_minimum_distance, len(self.atoms), "NÃO ACEITOU ATOM!") # else: # print("VEIO PRA CÁ") # # Initialise a grain and add its seed atom. # grain = Grain(i, grain_origin_atom_coord, self.lattice) # self.grains.append(grain) # atom = Atom(grain, grain_origin_atom_coord) # self.atoms.append(atom) # self.sim_cells.add_atom_to_cell(atom) # break def grow_crystal(self): """Grow a new polycrystal.""" print() print(len(self.atoms), 'atoms placed - grow_crystal started.') self.seed_grains() print() print(len(self.atoms), 'atoms placed - grow_crystal middled.') print() # i_active is a list of the indices of atoms whcih have space next # to them to place a new atom. i_active = list(range(self.ngrains)) while i_active: # Pick a random "active" atom, and get its neighbouring lattice # sites with enough space to place a new atom i = np.random.choice(i_active) candidate_sites = self.get_neighbour_candidate_sites(self.atoms[i]) if not candidate_sites: # No candidate site was found: the atom is no longer active. i_active.remove(i) print("len(i_active): ", len(i_active)) print("len(candidate_sites): ", len(candidate_sites)) continue # Add the atom and mark it as active (until we know better). n = len(self.atoms) atom = Atom(self.atoms[i].grain, random.choice(candidate_sites)) self.atoms.append(atom) self.sim_cells.add_atom_to_cell(atom) i_active.append(n) print(len(self.atoms), 'atoms placed - grow_crystal ended.') def get_neighbour_candidate_sites(self, atom): """Return candidate locations next to atom to place a new atom. Look for sites on the crystal lattice of the grain of the provided atom with enough space to locate a new atom and return a list of the site coordinates. """ neighbour_sites = atom.coords + self.atom_diameter * atom.grain.lattice_disp candidate_sites = [] for site in neighbour_sites: if not (0 <= site[0] < 1 and 0 <= site[1] < 1): continue # neighbouring_atoms_generator spits out atoms in the # vicinity of site, using our array of "SimCells". neighbouring_atoms_generator = self.sim_cells.\ neighbouring_atoms_generator(site) for other_atom in neighbouring_atoms_generator: if distance(site, other_atom.coords) < self.atom_diameter * 0.99: break else: candidate_sites.append(site) return candidate_sites def save_atom_positions(self, filename='crystal.out'): """Save the atom diameter and all atom locations to filename.""" with open(filename, 'w') as fo: print('d =', self.atom_diameter, file=fo) for atom in self.atoms: print(atom.coords[0], atom.coords[1], file=fo) def _get_patch_vertices(self, atom): return atom.coords + self.atom_diameter * atom.grain.patch_disp def plot_crystal(self, filename='crystal.png', circular_atoms=True, colours=None, **kwargs): """Create a Matplotlib image of the polycrystal as filename. If colours is None, use a single colour for all atoms; otherwise a sequence of colours to cycle through for each grain can be provided. Additional kwargs are passed straight to the PatchCollection call that controls the drawing style of the atoms. If circular_atoms is not True, each atom is represented by the shape of its lattice (square or hexagon). """ if not colours: # Atoms are boring grey if no alternative is provided. colours = ['#444444'] ncolours = len(colours) if not kwargs: kwargs = {'linewidth': 1, 'edgecolor': 'k'} fig, ax = plt.subplots() # We have a bit of book-keeping to do: group the atoms into their # grains in this dictionary, keyed by the grain_id. grains = {} for atom in self.atoms: grains.setdefault(atom.grain.grain_id, []).append(atom) for j,atoms in grains.items(): if circular_atoms: patches = [plt.Circle(atom.coords, radius=self.atom_diameter/2) for atom in atoms] else: patches = [plt.Polygon(self._get_patch_vertices(atom)) for atom in atoms] c = PatchCollection(patches, facecolor=colours[j % ncolours], **kwargs) ax.add_collection(c) # Ensure the Axes are square and remove the spines, ticks, etc. ax.set_aspect('equal', 'box') plt.axis('off') plt.savefig(filename) plt.show() crystal = Crystal(ngrains=1, seed_minimum_distance=0.2, lattice='square', atom_diameter=0.1) crystal.grow_crystal() crystal.save_atom_positions() colours = plt.get_cmap("tab10").colors crystal.plot_crystal(colours=colours, filename='crystal_mexer_006.png')
{"hexsha": "716abcf8a0899063ece5c16e0f636da5a989ec90", "size": 14619, "ext": "py", "lang": "Python", "max_stars_repo_path": "crystal_para_mexer.py", "max_stars_repo_name": "adrianopls/SonicSim", "max_stars_repo_head_hexsha": "77c77c49781cbd947c70869aabed859323e0e07b", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "crystal_para_mexer.py", "max_issues_repo_name": "adrianopls/SonicSim", "max_issues_repo_head_hexsha": "77c77c49781cbd947c70869aabed859323e0e07b", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "crystal_para_mexer.py", "max_forks_repo_name": "adrianopls/SonicSim", "max_forks_repo_head_hexsha": "77c77c49781cbd947c70869aabed859323e0e07b", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 40.0520547945, "max_line_length": 103, "alphanum_fraction": 0.5766468295, "include": true, "reason": "import numpy", "num_tokens": 3269}
import detectron2 from detectron2.engine import DefaultPredictor from detectron2.config import get_cfg from detectron2.data import MetadataCatalog from detectron2.utils.visualizer import ColorMode, Visualizer from detectron2 import model_zoo from detectron2.modeling import build_model from detectron2.checkpoint import DetectionCheckpointer import cv2 import numpy as np import torch # trying to change class Detector: def __init__(self): self.cfg = get_cfg() # Load model config and model weights self.cfg.merge_from_file(model_zoo.get_config_file("COCO-Detection/faster_rcnn_R_101_FPN_3x.yaml")) self.cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = 0.7 self.cfg.MODEL.DEVICE = "cuda" self.classes = MetadataCatalog.get(self.cfg.DATASETS.TRAIN[0]).thing_classes self.model = build_model(self.cfg) DetectionCheckpointer(self.model).load('saved_models/model_final_f6e8b1.pkl') # must load weights this way, can't use cfg.MODEL.WEIGHTS = "..." self.model.train(False) # inference mode print("Done initializing") self.classes_dict = {} self.construct_class_dict() self.interested_classes = ["person", "car", "truck", "stop sign"] self.interested_classes_num = self.construct_interested_cls_num() def construct_class_dict(self): for i, name in enumerate(MetadataCatalog.get(self.cfg.DATASETS.TRAIN[0]).thing_classes): self.classes_dict[name] = i def construct_interested_cls_num(self): intr_cls_num = [] for name in self.interested_classes: num = self.classes_dict[name] intr_cls_num.append(num) return intr_cls_num def filtered_outputs(self, pred_classes, pred_boxes): pred_classes_list = pred_classes.tolist() indx_to_remove = [] for i, num in enumerate(pred_classes_list): if num not in self.interested_classes_num: indx_to_remove.append(i) # convert to numpy to use np.delete pred_classes = np.delete(pred_classes.cpu().detach().numpy(), indx_to_remove) pred_boxes = np.delete(pred_boxes.cpu().detach().numpy(), indx_to_remove, axis=0) # convert back to tensor pred_classes = torch.tensor(pred_classes).cuda() pred_boxes = torch.tensor(pred_boxes).cuda() # # Print outs for debugging # print(indx_to_remove) # print(pred_classes) # print(pred_boxes) # for data in pred_classes: # num = data.item() # print(MetadataCatalog.get(self.cfg.DATASETS.TRAIN[0]).thing_classes[num]) return pred_classes, pred_boxes def single_inference(self, image_path, filter=False): """Takes in a path to an image and returns tensors for the classes (indices) in the image, and a tensor for the bounding boxes. Args: image_path (string): path to a single images filter (boolean): whether to filter out unwanted classes Returns: pred_classes: tensor with the indices of identified classes pred_boxes: tensor with the bounding box coordinates (top left and bottom right) for each instance identified """ img = cv2.imread(image_path) img = np.transpose(img,(2,0,1)) img_tensor = torch.from_numpy(img) inputs = [{"image":img_tensor}] # inputs is ready outputs = self.model(inputs) pred_classes = outputs[0]["instances"].pred_classes.detach() pred_boxes = outputs[0]["instances"].pred_boxes.tensor.detach() if filter: pred_classes, pred_boxes = self.filtered_outputs(pred_classes, pred_boxes) return pred_classes, pred_boxes def batch_inference_frompaths(self, list_of_paths, filter=False): """Takes in a list of paths to images and returns a list of tensors for the classes (indices) in the images, and a list of tensors for the bounding boxes. Args: image_path (list of string): list of paths to images filter (boolean): whether to filter out unwanted classes Returns: list_of_pred_classes: list of tensors with the indices of identified classes. If filter is True, then it is possible each of the tensors will be completely empty. list_of_pred_boxes: list of tensors with the bounding box coordinates (top left and bottom right) for each instance identified If filter is True, then it is possible each of the tensors will be completely empty. """ inputs = [] for image_path in list_of_paths: img = cv2.imread(image_path) img = np.transpose(img,(2,0,1)) img_tensor = torch.from_numpy(img) inputs.append({"image":img_tensor}) outputs = self.model(inputs) list_of_pred_classes = [] list_of_pred_boxes = [] for i in range(0, len(outputs)): pred_classes = outputs[i]["instances"].pred_classes.detach() pred_boxes = outputs[i]["instances"].pred_boxes.tensor.detach() if filter: pred_classes, pred_boxes = self.filtered_outputs(pred_classes, pred_boxes) list_of_pred_classes.append(pred_classes) list_of_pred_boxes.append(pred_boxes) return list_of_pred_classes, list_of_pred_boxes def batch_inference_fromtensors(self, stacked_tensors, filter=False): """Takes in a batched tensor of images of shape (batch_size, C, H, W) and returns a list of tensors for the classes (indices) in the images, and a list of tensors for the bounding boxes. Args: stacked_tensors (tensor): tensor of shape (batch_size, C, H, W) that contains images (e.g. from a dataloader) filter (boolean): whether to filter out unwanted classes Returns: list_of_pred_classes: list of tensors with the indices of identified classes. If filter is True, then it is possible each of the tensors will be completely empty. list_of_pred_boxes: list of tensors with the bounding box coordinates (top left and bottom right) for each instance identified If filter is True, then it is possible each of the tensors will be completely empty. """ batch_size = stacked_tensors.size()[0] inputs = [] for i in range(0, batch_size): img_tensor = stacked_tensors[i, :] img_tensor = img_tensor.squeeze() inputs.append({"image":img_tensor}) outputs = self.model(inputs) list_of_pred_classes = [] list_of_pred_boxes = [] for i in range(0, len(outputs)): pred_classes = outputs[i]["instances"].pred_classes.detach() pred_boxes = outputs[i]["instances"].pred_boxes.tensor.detach() if filter: pred_classes, pred_boxes = self.filtered_outputs(pred_classes, pred_boxes) list_of_pred_classes.append(pred_classes) list_of_pred_boxes.append(pred_boxes) return list_of_pred_classes, list_of_pred_boxes
{"hexsha": "86aff4e493606150d824b4bb55ad2775467ec8e8", "size": 7372, "ext": "py", "lang": "Python", "max_stars_repo_path": "Detectron_roadside.py", "max_stars_repo_name": "jinsuwang/16824-Fall2021-Project", "max_stars_repo_head_hexsha": "a60d33b1413db350be1d47660abec051071e5296", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Detectron_roadside.py", "max_issues_repo_name": "jinsuwang/16824-Fall2021-Project", "max_issues_repo_head_hexsha": "a60d33b1413db350be1d47660abec051071e5296", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Detectron_roadside.py", "max_forks_repo_name": "jinsuwang/16824-Fall2021-Project", "max_forks_repo_head_hexsha": "a60d33b1413db350be1d47660abec051071e5296", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 39.2127659574, "max_line_length": 151, "alphanum_fraction": 0.6467715681, "include": true, "reason": "import numpy", "num_tokens": 1524}
(* Title: Jive Data and Store Model Author: Norbert Schirmer <schirmer at informatik.tu-muenchen.de>, 2003 Maintainer: Nicole Rauch <rauch at informatik.uni-kl.de> License: LGPL *) section \<open>Store Properties\<close> theory StoreProperties imports Store begin text \<open>This theory formalizes advanced concepts and properties of stores.\<close> subsection \<open>Reachability of a Location from a Reference\<close> text \<open>For a given store, the function \<open>reachS\<close> yields the set of all pairs $(l,v)$ where $l$ is a location that is reachable from the value $v$ (which must be a reference) in the given store. The predicate \<open>reach\<close> decides whether a location is reachable from a value in a store. \<close> inductive reach :: "Store \<Rightarrow> Location \<Rightarrow> Value \<Rightarrow> bool" ("_\<turnstile> _ reachable'_from _" [91,91,91]90) for s :: Store where Immediate: "ref l \<noteq> nullV \<Longrightarrow> s\<turnstile> l reachable_from (ref l)" | Indirect: "\<lbrakk>s\<turnstile> l reachable_from (s@@k); ref k \<noteq> nullV\<rbrakk> \<Longrightarrow> s\<turnstile> l reachable_from (ref k)" text \<open>Note that we explicitly exclude \<open>nullV\<close> as legal reference for reachability. Keep in mind that static fields are not associated to any object, therefore \<open>ref\<close> yields \<open>nullV\<close> if invoked on static fields (see the definition of the function \<open>ref\<close>, Sect. \ref{ref_def}). Reachability only describes the locations directly reachable from the object or array by following the pointers and should not include the static fields if we encounter a \<open>nullV\<close> reference in the pointer chain.\<close> text \<open>We formalize some properties of reachability. Especially, Lemma 3.2 as given in \<^cite>\<open>\<open>p. 53\<close> in "Poetzsch-Heffter97specification"\<close> is proven.\<close> lemma unreachable_Null: assumes reach: "s\<turnstile> l reachable_from x" shows "x\<noteq>nullV" using reach by (induct) auto corollary unreachable_Null_simp [simp]: "\<not> s\<turnstile> l reachable_from nullV" by (iprover dest: unreachable_Null) corollary unreachable_NullE [elim]: "s\<turnstile> l reachable_from nullV \<Longrightarrow> P" by (simp) lemma reachObjLoc [simp,intro]: "C=cls cf \<Longrightarrow> s\<turnstile> objLoc cf a reachable_from objV C a" by (iprover intro: reach.Immediate [of "objLoc cf a",simplified]) lemma reachArrLoc [simp,intro]: "s\<turnstile> arrLoc T a i reachable_from arrV T a" by (rule reach.Immediate [of "arrLoc T a i",simplified]) lemma reachArrLen [simp,intro]: "s\<turnstile> arrLenLoc T a reachable_from arrV T a" by (rule reach.Immediate [of "arrLenLoc T a",simplified]) lemma unreachStatic [simp]: "\<not> s\<turnstile> staticLoc f reachable_from x" proof - { fix y assume "s\<turnstile> y reachable_from x" "y=staticLoc f" then have False by induct auto } thus ?thesis by auto qed lemma unreachStaticE [elim]: "s\<turnstile> staticLoc f reachable_from x \<Longrightarrow> P" by (simp add: unreachStatic) lemma reachable_from_ArrLoc_impl_Arr [simp,intro]: assumes reach_loc: "s\<turnstile> l reachable_from (s@@arrLoc T a i)" shows "s\<turnstile> l reachable_from (arrV T a)" using reach.Indirect [OF reach_loc] by simp lemma reachable_from_ObjLoc_impl_Obj [simp,intro]: assumes reach_loc: "s\<turnstile> l reachable_from (s@@objLoc cf a)" assumes C: "C=cls cf" shows "s\<turnstile> l reachable_from (objV C a)" using C reach.Indirect [OF reach_loc] by simp text \<open>Lemma 3.2 (i)\<close> lemma reach_update [simp]: assumes unreachable_l_x: "\<not> s\<turnstile> l reachable_from x" shows "s\<langle>l:=y\<rangle>\<turnstile> k reachable_from x = s\<turnstile> k reachable_from x" proof assume "s\<turnstile> k reachable_from x" from this unreachable_l_x show "s\<langle>l := y\<rangle>\<turnstile> k reachable_from x" proof (induct) case (Immediate k) have "ref k \<noteq> nullV" by fact then show "s\<langle>l := y\<rangle>\<turnstile> k reachable_from (ref k)" by (rule reach.Immediate) next case (Indirect k m) have hyp: "\<not> s\<turnstile> l reachable_from (s@@m) \<Longrightarrow> s\<langle>l:=y\<rangle> \<turnstile> k reachable_from (s@@m)" by fact have "ref m \<noteq> nullV" and "\<not> s\<turnstile> l reachable_from (ref m)" by fact+ hence "l\<noteq>m" "\<not> s\<turnstile> l reachable_from (s@@m)" by (auto intro: reach.intros) with hyp have "s\<langle>l := y\<rangle> \<turnstile> k reachable_from (s\<langle>l := y\<rangle>@@m)" by simp then show "s\<langle>l := y\<rangle>\<turnstile> k reachable_from (ref m)" by (rule reach.Indirect) (rule Indirect.hyps) qed next assume "s\<langle>l := y\<rangle>\<turnstile> k reachable_from x" from this unreachable_l_x show "s\<turnstile> k reachable_from x" proof (induct) case (Immediate k) have "ref k \<noteq> nullV" by fact then show "s \<turnstile> k reachable_from (ref k)" by (rule reach.Immediate) next case (Indirect k m) with Indirect.hyps have hyp: "\<not> s\<turnstile> l reachable_from (s\<langle>l := y\<rangle>@@m) \<Longrightarrow> s\<turnstile> k reachable_from (s\<langle>l := y\<rangle>@@m)" by simp have "ref m \<noteq> nullV" and "\<not> s\<turnstile> l reachable_from (ref m)" by fact+ hence "l\<noteq>m" "\<not> s \<turnstile> l reachable_from (s@@m)" by (auto intro: reach.intros) with hyp have "s \<turnstile> k reachable_from (s@@m)" by simp thus "s\<turnstile> k reachable_from (ref m)" by (rule reach.Indirect) (rule Indirect.hyps) qed qed text \<open>Lemma 3.2 (ii)\<close> lemma reach2: "\<not> s\<turnstile> l reachable_from x \<Longrightarrow> \<not> s\<langle>l:=y\<rangle>\<turnstile> l reachable_from x" by (simp) text \<open>Lemma 3.2 (iv)\<close> lemma reach4: "\<not> s \<turnstile> l reachable_from (ref k) \<Longrightarrow> k \<noteq> l \<or> (ref k) = nullV" by (auto intro: reach.intros) lemma reachable_isRef: assumes reach: "s\<turnstile>l reachable_from x" shows "isRefV x" using reach proof (induct) case (Immediate l) show "isRefV (ref l)" by (cases l) simp_all next case (Indirect l k) show "isRefV (ref k)" by (cases k) simp_all qed lemma val_ArrLen_IntgT: "isArrLenLoc l \<Longrightarrow> typeof (s@@l) = IntgT" proof - assume isArrLen: "isArrLenLoc l" have T: "typeof (s@@l) \<le> ltype l" by (simp) also from isArrLen have I: "ltype l = IntgT" by (cases l) simp_all finally show ?thesis by (auto elim: rtranclE simp add: le_Javatype_def subtype_defs) qed lemma access_alloc' [simp]: assumes no_arr_len: "\<not> isArrLenLoc l" shows "s\<langle>t\<rangle>@@l = s@@l" proof - from no_arr_len have "isNewArr t \<longrightarrow> l \<noteq> arr_len (new s t)" by (cases t) (auto simp add: new_def isArrLenLoc_def split: Location.splits) thus ?thesis by (rule access_alloc) qed text \<open>Lemma 3.2 (v)\<close> lemma reach_alloc [simp]: "s\<langle>t\<rangle>\<turnstile> l reachable_from x = s\<turnstile> l reachable_from x" proof assume "s\<langle>t\<rangle>\<turnstile> l reachable_from x" thus "s\<turnstile> l reachable_from x" proof (induct) case (Immediate l) thus "s\<turnstile> l reachable_from ref l" by (rule reach.intros) next case (Indirect l k) have reach_k: "s\<turnstile> l reachable_from (s\<langle>t\<rangle>@@k)" by fact moreover have "s\<langle>t\<rangle>@@k = s@@k" proof - from reach_k have isRef: "isRefV (s\<langle>t\<rangle>@@k)" by (rule reachable_isRef) have "\<not> isArrLenLoc k" proof (rule ccontr,simp) assume "isArrLenLoc k" then have "typeof (s\<langle>t\<rangle>@@k) = IntgT" by (rule val_ArrLen_IntgT) with isRef show "False" by (cases "(s\<langle>t\<rangle>@@k)") simp_all qed thus ?thesis by (rule access_alloc') qed ultimately have "s\<turnstile> l reachable_from (s@@k)" by simp thus "s\<turnstile> l reachable_from ref k" by (rule reach.intros) (rule Indirect.hyps) qed next assume "s\<turnstile> l reachable_from x" thus "s\<langle>t\<rangle>\<turnstile> l reachable_from x" proof (induct) case (Immediate l) thus "s\<langle>t\<rangle>\<turnstile> l reachable_from ref l" by (rule reach.intros) next case (Indirect l k) have reach_k: "s\<langle>t\<rangle>\<turnstile> l reachable_from (s@@k)" by fact moreover have "s\<langle>t\<rangle>@@k = s@@k" proof - from reach_k have isRef: "isRefV (s@@k)" by (rule reachable_isRef) have "\<not> isArrLenLoc k" proof (rule ccontr,simp) assume "isArrLenLoc k" then have "typeof (s@@k) = IntgT" by (rule val_ArrLen_IntgT) with isRef show "False" by (cases "(s@@k)") simp_all qed thus ?thesis by (rule access_alloc') qed ultimately have "s\<langle>t\<rangle>\<turnstile> l reachable_from (s\<langle>t\<rangle>@@k)" by simp thus "s\<langle>t\<rangle>\<turnstile> l reachable_from ref k" by (rule reach.intros) (rule Indirect.hyps) qed qed text \<open>Lemma 3.2 (vi)\<close> lemma reach6: "isprimitive(typeof x) \<Longrightarrow> \<not> s \<turnstile> l reachable_from x" proof assume prim: "isprimitive(typeof x)" assume "s \<turnstile> l reachable_from x" hence "isRefV x" by (rule reachable_isRef) with prim show False by (cases x) simp_all qed text \<open>Lemma 3.2 (iii)\<close> lemma reach3: assumes k_y: "\<not> s\<turnstile> k reachable_from y" assumes k_x: "\<not> s\<turnstile> k reachable_from x" shows "\<not> s\<langle>l:=y\<rangle>\<turnstile> k reachable_from x" proof assume "s\<langle>l:=y\<rangle>\<turnstile> k reachable_from x" from this k_y k_x show False proof (induct) case (Immediate l) have "\<not> s\<turnstile> l reachable_from ref l" and "ref l \<noteq> nullV" by fact+ thus False by (iprover intro: reach.intros) next case (Indirect m k) have k_not_Null: "ref k \<noteq> nullV" by fact have not_m_y: "\<not> s\<turnstile> m reachable_from y" by fact have not_m_k: "\<not> s\<turnstile> m reachable_from ref k" by fact have hyp: "\<lbrakk>\<not> s\<turnstile> m reachable_from y; \<not> s\<turnstile> m reachable_from (s\<langle>l := y\<rangle>@@k)\<rbrakk> \<Longrightarrow> False" by fact have m_upd_k: "s\<langle>l := y\<rangle>\<turnstile> m reachable_from (s\<langle>l := y\<rangle>@@k)" by fact show False proof (cases "l=k") case False then have "s\<langle>l := y\<rangle>@@k = s@@k" by simp moreover from not_m_k k_not_Null have "\<not> s\<turnstile> m reachable_from (s@@k)" by (iprover intro: reach.intros) ultimately show False using not_m_y hyp by simp next case True note eq_l_k = this show ?thesis proof (cases "alive (ref l) s \<and> alive y s \<and> typeof y \<le> ltype l") case True with eq_l_k have "s\<langle>l := y\<rangle>@@k = y" by simp with not_m_y hyp show False by simp next case False hence "s\<langle>l := y\<rangle> = s" by auto moreover from not_m_k k_not_Null have "\<not> s\<turnstile> m reachable_from (s@@k)" by (iprover intro: reach.intros) ultimately show False using not_m_y hyp by simp qed qed qed qed text \<open>Lemma 3.2 (vii).\<close> lemma unreachable_from_init [simp,intro]: "\<not> s\<turnstile> l reachable_from (init T)" using reach6 by (cases T) simp_all lemma ref_reach_unalive: assumes unalive_x:"\<not> alive x s" assumes l_x: "s\<turnstile> l reachable_from x" shows "x = ref l" using l_x unalive_x proof induct case (Immediate l) show "ref l = ref l" by simp next case (Indirect l k) have "ref k \<noteq> nullV" by fact have "\<not> alive (ref k) s" by fact hence "s@@k = init (ltype k)" by simp moreover have "s\<turnstile> l reachable_from (s@@k)" by fact ultimately have False by simp thus ?case .. qed lemma loc_new_reach: assumes l: "ref l = new s t" assumes l_x: "s\<turnstile> l reachable_from x" shows "x = new s t" using l_x l proof induct case (Immediate l) show "ref l = new s t" by fact next case (Indirect l k) hence "s@@k = new s t" by iprover moreover have "\<not> alive (new s t) s" by simp moreover have "alive (s@@k) s" by simp ultimately have False by simp thus ?case .. qed text \<open>Lemma 3.2 (viii)\<close> lemma alive_reach_alive: assumes alive_x: "alive x s" assumes reach_l: "s \<turnstile> l reachable_from x" shows "alive (ref l) s" using reach_l alive_x proof (induct) case (Immediate l) show ?case by fact next case (Indirect l k) have hyp: "alive (s@@k) s \<Longrightarrow> alive (ref l) s" by fact moreover have "alive (s@@k) s" by simp ultimately show "alive (ref l) s" by iprover qed text \<open>Lemma 3.2 (ix)\<close> lemma reach9: assumes reach_impl_access_eq: "\<forall>l. s1\<turnstile>l reachable_from x \<longrightarrow> (s1@@l = s2@@l)" shows "s1\<turnstile> l reachable_from x = s2\<turnstile> l reachable_from x" proof assume "s1\<turnstile> l reachable_from x" from this reach_impl_access_eq show "s2\<turnstile> l reachable_from x" proof (induct) case (Immediate l) show "s2\<turnstile> l reachable_from ref l" by (rule reach.intros) (rule Immediate.hyps) next case (Indirect l k) have hyp: "\<forall>l. s1\<turnstile> l reachable_from (s1@@k) \<longrightarrow> s1@@l = s2@@l \<Longrightarrow> s2\<turnstile> l reachable_from (s1@@k)" by fact have k_not_Null: "ref k \<noteq> nullV" by fact have reach_impl_access_eq: "\<forall>l. s1\<turnstile> l reachable_from ref k \<longrightarrow> s1@@l = s2@@l" by fact have "s1\<turnstile> l reachable_from (s1@@k)" by fact with k_not_Null have "s1@@k = s2@@k" by (iprover intro: reach_impl_access_eq [rule_format] reach.intros) moreover from reach_impl_access_eq k_not_Null have "\<forall>l. s1\<turnstile> l reachable_from (s1@@k) \<longrightarrow> s1@@l = s2@@l" by (iprover intro: reach.intros) then have "s2\<turnstile> l reachable_from (s1@@k)" by (rule hyp) ultimately have "s2\<turnstile> l reachable_from (s2@@k)" by simp thus "s2\<turnstile> l reachable_from ref k" by (rule reach.intros) (rule Indirect.hyps) qed next assume "s2\<turnstile> l reachable_from x" from this reach_impl_access_eq show "s1\<turnstile> l reachable_from x" proof (induct) case (Immediate l) show "s1\<turnstile> l reachable_from ref l" by (rule reach.intros) (rule Immediate.hyps) next case (Indirect l k) have hyp: "\<forall>l. s1\<turnstile> l reachable_from (s2@@k) \<longrightarrow> s1@@l = s2@@l \<Longrightarrow> s1\<turnstile> l reachable_from (s2@@k)" by fact have k_not_Null: "ref k \<noteq> nullV" by fact have reach_impl_access_eq: "\<forall>l. s1\<turnstile> l reachable_from ref k \<longrightarrow> s1@@l = s2@@l" by fact have "s1\<turnstile> k reachable_from ref k" by (rule reach.intros) (rule Indirect.hyps) with reach_impl_access_eq have eq_k: "s1@@k = s2@@k" by simp from reach_impl_access_eq k_not_Null have "\<forall>l. s1\<turnstile> l reachable_from (s1@@k) \<longrightarrow> s1@@l = s2@@l" by (iprover intro: reach.intros) then have "\<forall>l. s1\<turnstile> l reachable_from (s2@@k) \<longrightarrow> s1@@l = s2@@l" by (simp add: eq_k) with eq_k hyp have "s1\<turnstile> l reachable_from (s1@@k)" by simp thus "s1\<turnstile> l reachable_from ref k" by (rule reach.intros) (rule Indirect.hyps) qed qed subsection \<open>Reachability of a Reference from a Reference\<close> text \<open>The predicate \<open>rreach\<close> tests whether a value is reachable from another value. This is an extension of the predicate \<open>oreach\<close> as described in \<^cite>\<open>\<open>p. 54\<close> in "Poetzsch-Heffter97specification"\<close> because now arrays are handled as well. \<close> definition rreach:: "Store \<Rightarrow> Value \<Rightarrow> Value \<Rightarrow> bool" ("_\<turnstile>Ref _ reachable'_from _" [91,91,91]90) where "s\<turnstile>Ref y reachable_from x = (\<exists> l. s\<turnstile> l reachable_from x \<and> y = ref l)" subsection \<open>Disjointness of Reachable Locations\<close> text \<open>The predicate \<open>disj\<close> tests whether two values are disjoint in a given store. Its properties as given in \<^cite>\<open>\<open>Lemma 3.3, p. 54\<close> in "Poetzsch-Heffter97specification"\<close> are then proven. \<close> definition disj:: "Value \<Rightarrow> Value \<Rightarrow> Store \<Rightarrow> bool" where "disj x y s = (\<forall> l. \<not> s\<turnstile> l reachable_from x \<or> \<not> s\<turnstile> l reachable_from y)" lemma disjI1: "\<lbrakk>\<And> l. s\<turnstile> l reachable_from x \<Longrightarrow> \<not> s\<turnstile> l reachable_from y\<rbrakk> \<Longrightarrow> disj x y s" by (simp add: disj_def) lemma disjI2: "\<lbrakk>\<And> l. s\<turnstile> l reachable_from y \<Longrightarrow> \<not> s\<turnstile> l reachable_from x\<rbrakk> \<Longrightarrow> disj x y s" by (auto simp add: disj_def) lemma disj_cases [consumes 1]: assumes "disj x y s" assumes "\<And> l. \<not> s\<turnstile> l reachable_from x \<Longrightarrow> P" assumes "\<And> l. \<not> s\<turnstile> l reachable_from y \<Longrightarrow> P" shows "P" using assms by (auto simp add: disj_def) text \<open>Lemma 3.3 (i) in \<^cite>\<open>"Poetzsch-Heffter97specification"\<close>\<close> lemma disj1: "\<lbrakk>disj x y s; \<not> s\<turnstile> l reachable_from x; \<not> s\<turnstile> l reachable_from y\<rbrakk> \<Longrightarrow> disj x y (s\<langle>l:=z\<rangle>)" by (auto simp add: disj_def) text \<open>Lemma 3.3 (ii)\<close> lemma disj2: assumes disj_x_y: "disj x y s" assumes disj_x_z: "disj x z s" assumes unreach_l_x: "\<not> s\<turnstile> l reachable_from x" shows "disj x y (s\<langle>l:=z\<rangle>)" proof (rule disjI1) fix k assume reach_k_x: "s\<langle>l := z\<rangle>\<turnstile> k reachable_from x" show "\<not> s\<langle>l := z\<rangle>\<turnstile> k reachable_from y" proof - from unreach_l_x reach_k_x have reach_s_k_x: "s\<turnstile> k reachable_from x" by simp with disj_x_z have "\<not> s\<turnstile> k reachable_from z" by (simp add: disj_def) moreover from reach_s_k_x disj_x_y have "\<not> s\<turnstile> k reachable_from y" by (simp add: disj_def) ultimately show ?thesis by (rule reach3) qed qed text \<open>Lemma 3.3 (iii)\<close> lemma disj3: assumes alive_x_s: "alive x s" shows "disj x (new s t) (s\<langle>t\<rangle>)" proof (rule disjI1,simp only: reach_alloc) fix l assume reach_l_x: "s\<turnstile> l reachable_from x" show "\<not> s\<turnstile> l reachable_from new s t" proof assume reach_l_new: "s\<turnstile> l reachable_from new s t" have unalive_new: "\<not> alive (new s t) s" by simp from this reach_l_new have "new s t = ref l" by (rule ref_reach_unalive) moreover from alive_x_s reach_l_x have "alive (ref l) s" by (rule alive_reach_alive) ultimately show False using unalive_new by simp qed qed text \<open>Lemma 3.3 (iv)\<close> lemma disj4: "\<lbrakk>disj (objV C a) y s; CClassT C \<le> dtype f \<rbrakk> \<Longrightarrow> disj (s@@(objV C a)..f) y s" by (auto simp add: disj_def) lemma disj4': "\<lbrakk>disj (arrV T a) y s \<rbrakk> \<Longrightarrow> disj (s@@(arrV T a).[i]) y s" by (auto simp add: disj_def) subsection \<open>X-Equivalence\<close> text \<open>We call two stores $s_1$ and $s_2$ equivalent wrt. a given value $X$ (which is called X-equivalence) iff $X$ and all values reachable from $X$ in $s_1$ or $s_2$ have the same state \<^cite>\<open>\<open>p. 55\<close> in "Poetzsch-Heffter97specification"\<close>. This is tested by the predicate \<open>xeq\<close>. Lemma 3.4 of \<^cite>\<open>"Poetzsch-Heffter97specification"\<close> is then proven for \<open>xeq\<close>. \<close> definition xeq:: "Value \<Rightarrow> Store \<Rightarrow> Store \<Rightarrow> bool" where "xeq x s t = (alive x s = alive x t \<and> (\<forall> l. s\<turnstile> l reachable_from x \<longrightarrow> s@@l = t@@l))" abbreviation xeq_syntax :: "Store \<Rightarrow> Value \<Rightarrow> Store \<Rightarrow> bool" ("_/ (\<equiv>[_])/ _" [900,0,900] 900) where "s \<equiv>[x] t == xeq x s t" lemma xeqI: "\<lbrakk>alive x s = alive x t; \<And> l. s\<turnstile> l reachable_from x \<Longrightarrow> s@@l = t@@l \<rbrakk> \<Longrightarrow> s \<equiv>[x] t" by (auto simp add: xeq_def) text \<open>Lemma 3.4 (i) in \<^cite>\<open>"Poetzsch-Heffter97specification"\<close>.\<close> lemma xeq1_refl: "s \<equiv>[x] s" by (simp add: xeq_def) text \<open>Lemma 3.4 (i)\<close> lemma xeq1_sym': assumes s_t: "s \<equiv>[x] t" shows "t \<equiv>[x] s" proof - from s_t have "alive x s = alive x t" by (simp add: xeq_def) moreover from s_t have "\<forall> l. s\<turnstile> l reachable_from x \<longrightarrow> s@@l = t@@l" by (simp add: xeq_def) with reach9 [OF this] have "\<forall> l. t\<turnstile> l reachable_from x \<longrightarrow> t@@l = s@@l" by simp ultimately show ?thesis by (simp add: xeq_def) qed lemma xeq1_sym: "s \<equiv>[x] t = t \<equiv>[x] s" by (auto intro: xeq1_sym') text \<open>Lemma 3.4 (i)\<close> lemma xeq1_trans [trans]: assumes s_t: "s \<equiv>[x] t" assumes t_r: "t \<equiv>[x] r" shows "s \<equiv>[x] r" proof - from s_t t_r have "alive x s = alive x r" by (simp add: xeq_def) moreover have "\<forall> l. s\<turnstile> l reachable_from x \<longrightarrow> s@@l = r@@l" proof (intro allI impI) fix l assume reach_l: "s\<turnstile> l reachable_from x" show "s@@l = r@@l" proof - from reach_l s_t have "s@@l=t@@l" by (simp add: xeq_def) also have "t@@l = r@@l" proof - from s_t have "\<forall> l. s\<turnstile> l reachable_from x \<longrightarrow> s@@l = t@@l" by (simp add: xeq_def) from reach9 [OF this] reach_l have "t\<turnstile> l reachable_from x" by simp with t_r show ?thesis by (simp add: xeq_def) qed finally show ?thesis . qed qed ultimately show ?thesis by (simp add: xeq_def) qed text \<open>Lemma 3.4 (ii)\<close> lemma xeq2: assumes xeq: "\<forall> x. s \<equiv>[x] t" assumes static_eq: "\<forall> f. s@@(staticLoc f) = t@@(staticLoc f)" shows "s = t" proof (rule Store_eqI) from xeq show "\<forall>x. alive x s = alive x t" by (simp add: xeq_def) next show "\<forall>l. s@@l = t@@l" proof fix l show "s@@l = t@@l" proof (cases l) case (objLoc cf a) have "l = objLoc cf a" by fact hence "s\<turnstile> l reachable_from (objV (cls cf) a)" by simp with xeq show ?thesis by (simp add: xeq_def) next case (staticLoc f) have "l = staticLoc f" by fact with static_eq show ?thesis by (simp add: xeq_def) next case (arrLenLoc T a) have "l = arrLenLoc T a" by fact hence "s\<turnstile> l reachable_from (arrV T a)" by simp with xeq show ?thesis by (simp add: xeq_def) next case (arrLoc T a i) have "l = arrLoc T a i" by fact hence "s\<turnstile> l reachable_from (arrV T a)" by simp with xeq show ?thesis by (simp add: xeq_def) qed qed qed text \<open>Lemma 3.4 (iii)\<close> lemma xeq3: assumes unreach_l: "\<not> s\<turnstile> l reachable_from x" shows "s \<equiv>[x] s\<langle>l:=y\<rangle>" proof (rule xeqI) show "alive x s = alive x (s\<langle>l := y\<rangle>)" by simp next fix k assume reach_k: "s\<turnstile> k reachable_from x" with unreach_l have "l\<noteq>k" by auto then show "s@@k = s\<langle>l := y\<rangle>@@k" by simp qed text \<open>Lemma 3.4 (iv)\<close> text \<open>Lemma 3.4 (v)\<close> lemma xeq5: "s \<equiv>[x] t \<Longrightarrow> s\<turnstile> l reachable_from x = t\<turnstile> l reachable_from x" by (rule reach9) (simp add: xeq_def) subsection \<open>T-Equivalence\<close> text \<open>T-equivalence is the extension of X-equivalence from values to types. Two stores are T-equivalent iff they are X-equivalent for all values of type T. This is formalized by the predicate \<open>teq\<close> \<^cite>\<open>\<open>p. 55\<close> in "Poetzsch-Heffter97specification"\<close>.\<close> definition teq:: "Javatype \<Rightarrow> Store \<Rightarrow> Store \<Rightarrow> bool" where "teq t s1 s2 = (\<forall> x. typeof x \<le> t \<longrightarrow> s1 \<equiv>[x] s2)" subsection \<open>Less Alive\<close> text \<open>To specify that methods have no side-effects, the following binary relation on stores plays a prominent role. It expresses that the two stores differ only in values that are alive in the store passed as first argument. This is formalized by the predicate \<open>lessalive\<close> \<^cite>\<open>\<open>p. 55\<close> in "Poetzsch-Heffter97specification"\<close>. The stores have to be X-equivalent for the references of the first store that are alive, and the values of the static fields have to be the same in both stores. \<close> definition lessalive:: "Store \<Rightarrow> Store \<Rightarrow> bool" ("_/ \<lless> _" [70,71] 70) where "lessalive s t = ((\<forall> x. alive x s \<longrightarrow> s \<equiv>[x] t) \<and> (\<forall> f. s@@staticLoc f = t@@staticLoc f))" text \<open>We define an introduction rule for the new operator.\<close> lemma lessaliveI: "\<lbrakk>\<And> x. alive x s \<Longrightarrow> s \<equiv>[x] t; \<And> f. s@@staticLoc f = t@@staticLoc f\<rbrakk> \<Longrightarrow> s \<lless> t" by (simp add: lessalive_def) text \<open>It can be shown that \<open>lessalive\<close> is reflexive, transitive and antisymmetric.\<close> lemma lessalive_refl: "s \<lless> s" by (simp add: lessalive_def xeq1_refl) lemma lessalive_trans [trans]: assumes s_t: "s \<lless> t" assumes t_w: "t \<lless> w" shows "s \<lless> w" proof (rule lessaliveI) fix x assume alive_x_s: "alive x s" with s_t have "s \<equiv>[x] t" by (simp add: lessalive_def) also have "t \<equiv>[x] w" proof - from alive_x_s s_t have "alive x t" by (simp add: lessalive_def xeq_def) with t_w show ?thesis by (simp add: lessalive_def) qed finally show "s \<equiv>[x] w". next fix f from s_t t_w show "s@@staticLoc f = w@@staticLoc f" by (simp add: lessalive_def) qed lemma lessalive_antisym: assumes s_t: "s \<lless> t" assumes t_s: "t \<lless> s" shows "s = t" proof (rule xeq2) show "\<forall>x. s \<equiv>[x] t" proof fix x show "s \<equiv>[x] t" proof (cases "alive x s") case True with s_t show ?thesis by (simp add: lessalive_def) next case False note unalive_x_s = this show ?thesis proof (cases "alive x t") case True with t_s show ?thesis by (subst xeq1_sym) (simp add: lessalive_def) next case False show ?thesis proof (rule xeqI) from False unalive_x_s show "alive x s = alive x t" by simp next fix l assume reach_s_x: "s\<turnstile> l reachable_from x" with unalive_x_s have x: "x = ref l" by (rule ref_reach_unalive) with unalive_x_s have "s@@l = init (ltype l)" by simp also from reach_s_x x have "t\<turnstile> l reachable_from x" by (auto intro: reach.Immediate unreachable_Null) with False x have "t@@l = init (ltype l)" by simp finally show "s@@l = t@@l" by simp qed qed qed qed next from s_t show "\<forall>f. s@@staticLoc f = t@@staticLoc f" by (simp add: lessalive_def) qed text \<open>This gives us a partial ordering on the store. Thus, the type @{typ "Store"} can be added to the appropriate type class @{term "ord"} which lets us define the $<$ and $\leq$ symbols, and to the type class @{term "order"} which axiomatizes partial orderings. \<close> instantiation Store :: order begin definition le_Store_def: "s \<le> t \<longleftrightarrow> s \<lless> t" definition less_Store_def: "(s::Store) < t \<longleftrightarrow> s \<le> t \<and> \<not> t \<le> s" text \<open>We prove Lemma 3.5 of \<^cite>\<open>\<open>p. 56\<close> in "Poetzsch-Heffter97specification"\<close> for this relation. \<close> text \<open>Lemma 3.5 (i)\<close> instance proof fix s t w:: "Store" { show "s \<le> s" by (simp add: le_Store_def lessalive_refl) next assume "s \<le> t" "t \<le> w" then show "s \<le> w" by (unfold le_Store_def) (rule lessalive_trans) next assume "s \<le> t" "t \<le> s" then show "s = t" by (unfold le_Store_def) (rule lessalive_antisym) next show "(s < t) = (s \<le> t \<and> \<not> t \<le> s)" by (simp add: less_Store_def) } qed end text \<open>Lemma 3.5 (ii)\<close> lemma lessalive2: "\<lbrakk>s \<lless> t; alive x s\<rbrakk> \<Longrightarrow> alive x t" by (simp add: lessalive_def xeq_def) text \<open>Lemma 3.5 (iii)\<close> lemma lessalive3: assumes s_t: "s \<lless> t" assumes alive: "alive x s \<or> \<not> alive x t" shows "s \<equiv>[x] t" proof (cases "alive x s") case True with s_t show ?thesis by (simp add: lessalive_def) next case False note unalive_x_s = this with alive have unalive_x_t: "\<not> alive x t" by simp show ?thesis proof (rule xeqI) from False alive show "alive x s = alive x t" by simp next fix l assume reach_s_x: "s\<turnstile> l reachable_from x" with unalive_x_s have x: "x = ref l" by (rule ref_reach_unalive) with unalive_x_s have "s@@l = init (ltype l)" by simp also from reach_s_x x have "t\<turnstile> l reachable_from x" by (auto intro: reach.Immediate unreachable_Null) with unalive_x_t x have "t@@l = init (ltype l)" by simp finally show "s@@l = t@@l" by simp qed qed text \<open>Lemma 3.5 (iv)\<close> lemma lessalive_update [simp,intro]: assumes s_t: "s \<lless> t" assumes unalive_l: "\<not> alive (ref l) t" shows "s \<lless> t\<langle>l:=x\<rangle>" proof - from unalive_l have "t\<langle>l:=x\<rangle> = t" by simp with s_t show ?thesis by simp qed lemma Xequ4': assumes alive: "alive x s" shows "s \<equiv>[x] s\<langle>t\<rangle>" proof - from alive have "x \<noteq> new s t" by auto thus ?thesis by (rule xeq4) qed text \<open>Lemma 3.5 (v)\<close> lemma lessalive_alloc [simp,intro]: "s \<lless> s\<langle>t\<rangle>" by (simp add: lessalive_def Xequ4') subsection \<open>Reachability of Types from Types\<close> text \<open>The predicate \<open>treach\<close> denotes the fact that the first type reaches the second type by stepping finitely many times from a type to the range type of one of its fields. This formalization diverges from \<^cite>\<open>\<open>p. 106\<close> in "Poetzsch-Heffter97specification"\<close> in that it does not include the number of steps that are allowed to reach the second type. Reachability of types is a static approximation of reachability in the store. If I cannot reach the type of a location from the type of a reference, I cannot reach the location from the reference. See lemma \<open>not_treach_ref_impl_not_reach\<close> below. \<close> inductive treach :: "Javatype \<Rightarrow> Javatype \<Rightarrow> bool" where Subtype: "U \<le> T \<Longrightarrow> treach T U" | Attribute: "\<lbrakk>treach T S; S \<le> dtype f; U \<le> rtype f\<rbrakk> \<Longrightarrow> treach T U" | ArrLength: "treach (ArrT AT) IntgT" | ArrElem: "treach (ArrT AT) (at2jt AT)" | Trans [trans]: "\<lbrakk>treach T U; treach U V\<rbrakk> \<Longrightarrow> treach T V" lemma treach_ref_l [simp,intro]: assumes not_Null: "ref l \<noteq> nullV" shows "treach (typeof (ref l)) (ltype l)" proof (cases l) case (objLoc cf a) have "l=objLoc cf a" by fact moreover have "treach (CClassT (cls cf)) (rtype (att cf))" by (rule treach.Attribute [where ?f="att cf" and ?S="CClassT (cls cf)"]) (auto intro: treach.Subtype) ultimately show ?thesis by simp next case (staticLoc f) have "l=staticLoc f" by fact hence "ref l = nullV" by simp with not_Null show ?thesis by simp next case (arrLenLoc T a) have "l=arrLenLoc T a" by fact then show ?thesis by (auto intro: treach.ArrLength) next case (arrLoc T a i) have "l=arrLoc T a i" by fact then show ?thesis by (auto intro: treach.ArrElem) qed lemma treach_ref_l' [simp,intro]: assumes not_Null: "ref l \<noteq> nullV" shows "treach (typeof (ref l)) (typeof (s@@l))" proof - from not_Null have "treach (typeof (ref l)) (ltype l)" by (rule treach_ref_l) also have "typeof (s@@l) \<le> ltype l" by simp hence "treach (ltype l) (typeof (s@@l))" by (rule treach.intros) finally show ?thesis . qed lemma reach_impl_treach: assumes reach_l: "s \<turnstile> l reachable_from x" shows "treach (typeof x) (ltype l)" using reach_l proof (induct) case (Immediate l) have "ref l \<noteq> nullV" by fact then show "treach (typeof (ref l)) (ltype l)" by (rule treach_ref_l) next case (Indirect l k) have "treach (typeof (s@@k)) (ltype l)" by fact moreover have "ref k \<noteq> nullV" by fact hence "treach (typeof (ref k)) (typeof (s@@k))" by simp ultimately show "treach (typeof (ref k)) (ltype l)" by (iprover intro: treach.Trans) qed lemma not_treach_ref_impl_not_reach: assumes not_treach: "\<not> treach (typeof x) (typeof (ref l))" shows "\<not> s \<turnstile> l reachable_from x" proof assume reach_l: "s\<turnstile> l reachable_from x" from this not_treach show False proof (induct) case (Immediate l) have "\<not> treach (typeof (ref l)) (typeof (ref l))" by fact thus False by (iprover intro: treach.intros order_refl) next case (Indirect l k) have hyp: "\<not> treach (typeof (s@@k)) (typeof (ref l)) \<Longrightarrow> False" by fact have not_Null: "ref k \<noteq> nullV" by fact have not_k_l:"\<not> treach (typeof (ref k)) (typeof (ref l))" by fact show False proof (cases "treach (typeof (s@@k)) (typeof (ref l))") case False thus False by (rule hyp) next case True from not_Null have "treach (typeof (ref k)) (typeof (s@@k))" by (rule treach_ref_l') also note True finally have "treach (typeof (ref k)) (typeof (ref l))" . with not_k_l show False .. qed qed qed text \<open>Lemma 4.6 in \<^cite>\<open>\<open>p. 107\<close> in "Poetzsch-Heffter97specification"\<close>.\<close> lemma treach1: assumes x_t: "typeof x \<le> T" assumes not_treach: "\<not> treach T (typeof (ref l))" shows "\<not> s \<turnstile> l reachable_from x" proof - have "\<not> treach (typeof x) (typeof (ref l))" proof from x_t have "treach T (typeof x)" by (rule treach.intros) also assume "treach (typeof x) (typeof (ref l))" finally have "treach T (typeof (ref l))" . with not_treach show False .. qed thus ?thesis by (rule not_treach_ref_impl_not_reach) qed end
{"author": "isabelle-prover", "repo": "mirror-afp-devel", "sha": "c84055551f07621736c3eb6a1ef4fb7e8cc57dd1", "save_path": "github-repos/isabelle/isabelle-prover-mirror-afp-devel", "path": "github-repos/isabelle/isabelle-prover-mirror-afp-devel/mirror-afp-devel-c84055551f07621736c3eb6a1ef4fb7e8cc57dd1/thys/JiveDataStoreModel/Isabelle_Store/StoreProperties.thy"}
""" Copyright 2019 Manuel Olguín 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. """ from process_results import * import os import numpy as np def load_1Client_Experiment(): os.chdir('1Client_IdealBenchmark') data = parse_client_stats(0) os.chdir('..') return data def load_5Clients_Experiment(): os.chdir('5Clients_IdealBenchmark') results = [] for i in range(5): results.append(parse_client_stats(i)) os.chdir('..') return results def load_10Clients_Experiment(): os.chdir('10Clients_IdealBenchmark') results = [] for i in range(10): results.append(parse_client_stats(i)) os.chdir('..') return results def load_system_stats(): df = pd.read_csv('system_stats.csv') start_time = df['timestamp'][0] df['timestamp'] = (df['timestamp'] - start_time) / (60 * 1000.0) df['avg_cpu_load'] = df['cpu_load'].rolling(11, center=True).mean() return df def plot_avg_times(): c1 = load_1Client_Experiment() c5 = load_5Clients_Experiment() c10 = load_10Clients_Experiment() avg_up = [c1['avg_up']] avg_proc = [c1['avg_proc']] avg_down = [c1['avg_down']] sum_up = 0 count_up = 0 sum_down = 0 count_down = 0 sum_proc = 0 count_proc = 0 for c in c5: sum_up += c['avg_up'] * c['count_up'] sum_down += c['avg_down'] * c['count_down'] sum_proc += c['avg_proc'] * c['count_proc'] count_up += c['count_up'] count_down += c['count_down'] count_proc += c['count_proc'] avg_up.append(sum_up / float(count_up)) avg_down.append(sum_down / float(count_down)) avg_proc.append(sum_proc / float(count_proc)) sum_up = 0 count_up = 0 sum_down = 0 count_down = 0 sum_proc = 0 count_proc = 0 for c in c10: sum_up += c['avg_up'] * c['count_up'] sum_down += c['avg_down'] * c['count_down'] sum_proc += c['avg_proc'] * c['count_proc'] count_up += c['count_up'] count_down += c['count_down'] count_proc += c['count_proc'] avg_up.append(sum_up / float(count_up)) avg_down.append(sum_down / float(count_down)) avg_proc.append(sum_proc / float(count_proc)) fig, ax = plt.subplots() x = ['1 client', '5 clients', '10 clients'] rects1 = ax.bar(x, avg_up, label='Avg uplink time') rects2 = ax.bar(x, avg_proc, bottom=avg_up, label='Avg processing time') rects3 = ax.bar(x, avg_down, bottom=[x + y for x, y in zip(avg_up, avg_proc)], label='Avg downlink time') autolabel(ax, rects1) autolabel(ax, rects2) autolabel(ax, rects3) ax.set_ylabel('Time [ms]') plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left") # plt.savefig( # 'client_{}_avgtimes_.png'.format(data['client_id']), # bbox_inches='tight' # ) plt.show() def compare_cpu_loads(): os.chdir('1Client_IdealBenchmark') c1_df = load_system_stats() os.chdir('..') os.chdir('5Clients_IdealBenchmark') c5_df = load_system_stats() os.chdir('..') os.chdir('10Clients_IdealBenchmark') c10_df = load_system_stats() os.chdir('..') fig, ax = plt.subplots() ax.plot(c1_df['timestamp'], c1_df['avg_cpu_load'], label='1 client') ax.plot(c5_df['timestamp'], c5_df['avg_cpu_load'], label='5 clients') ax.plot(c10_df['timestamp'], c10_df['avg_cpu_load'], label='10 clients') ax.set_ylabel('Load [%]') ax.set_xlabel('Time [m]') ax.set_ylim(0, 100) plt.legend(bbox_to_anchor=(1.04, 1), loc="upper left") plt.title('Average CPU load') plt.show() if __name__ == '__main__': #plot_avg_times() compare_cpu_loads()
{"hexsha": "541482ea0a061d022f20323e8b42b5e8b2562563", "size": 4212, "ext": "py", "lang": "Python", "max_stars_repo_path": "aggregate.py", "max_stars_repo_name": "molguin92/EdgeDroidResults", "max_stars_repo_head_hexsha": "083906c3b1e95d81327494e2d6465c3a39547050", "max_stars_repo_licenses": ["Apache-2.0", "CC-BY-4.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "aggregate.py", "max_issues_repo_name": "molguin92/EdgeDroidResults", "max_issues_repo_head_hexsha": "083906c3b1e95d81327494e2d6465c3a39547050", "max_issues_repo_licenses": ["Apache-2.0", "CC-BY-4.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "aggregate.py", "max_forks_repo_name": "molguin92/EdgeDroidResults", "max_forks_repo_head_hexsha": "083906c3b1e95d81327494e2d6465c3a39547050", "max_forks_repo_licenses": ["Apache-2.0", "CC-BY-4.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.8280254777, "max_line_length": 76, "alphanum_fraction": 0.6358024691, "include": true, "reason": "import numpy", "num_tokens": 1149}
# Creating the Two Zone Example Data # # Transform the TM1 TAZ-based model 25 zone inputs to a two-zone (MAZ and TAZ) set of inputs for software development. # # The 25 zones are downtown San Francisco and they are converted to 25 MAZs. # MAZs 1,2,3,4 are small and adjacent and assigned TAZ 2 and TAP 10002. # MAZs 13,14,15 are small and adjacent and as signed TAZ 14 and TAP 10014. # TAZs 1,3,4,13,15 are removed from the final data set. # # This script should work for the full TM1 example as well. import os import sys import pandas as pd import numpy as np import openmatrix as omx # Create example directory input_data = os.path.join(os.path.dirname(__file__), '../data_1') output_data = os.path.join(os.path.dirname(__file__), '../data_3') MAZ_MULTIPLIER = 1000 TAP_OFFSET = 90000 # ### initialize output data directory # new empty output_dir if os.path.exists(output_data): # shutil.rmtree(output_data) # os.makedirs(output_data) file_type = ('csv', 'omx') for file_name in os.listdir(output_data): if file_name.endswith(file_type): os.unlink(os.path.join(output_data, file_name)) else: os.makedirs(output_data) # ### Convert tazs to mazs and add transit access distance by mode land_use = pd.read_csv(os.path.join(input_data, 'land_use.csv')) if 'ZONE' in land_use.columns: land_use.insert(loc=0, column='MAZ', value=land_use.ZONE) land_use.insert(loc=1, column='TAZ', value=land_use.ZONE) land_use.drop(columns=['ZONE'], inplace=True) else: land_use.insert(loc=0, column='MAZ', value=land_use.TAZ) land_use.TAZ = land_use.TAZ.replace([1, 2, 3, 4], 2) land_use.TAZ = land_use.TAZ.replace([13, 14, 15], 14) # make MAZ indexes different from TAZ to drive MAZ/TAZ confusion errors and omisisons land_use.MAZ *= MAZ_MULTIPLIER shortWalk = 0.333 # the tm1 example assumes this distance for transit access longWalk = 0.667 land_use['access_dist_transit'] = shortWalk # FIXME - could assign longWalk where maz != taz, but then results wodl differe from one-zone # land_use['access_dist_transit'] =\ # np.where(land_use.TAZ*MAZ_MULTIPLIER==land_use.MAZ, shortWalk, longWalk) land_use.to_csv(os.path.join(output_data, 'land_use.csv'), index=False) # ### Put households in mazs instead of tazs households = pd.read_csv(os.path.join(input_data, 'households.csv')) households.rename(columns={'TAZ': 'MAZ'}, inplace=True) households.MAZ *= MAZ_MULTIPLIER households.to_csv(os.path.join(output_data, 'households.csv'), index=False) persons = pd.read_csv(os.path.join(input_data, 'persons.csv')) persons.to_csv(os.path.join(output_data, 'persons.csv'), index=False) # ### Create maz file # one row per maz, currentlyt he only attribute it its containing TAZ # FIXME - not clear we need this maz_df = land_use[['MAZ', 'TAZ']] maz_df.to_csv(os.path.join(output_data, 'maz.csv'), index=False) print("maz.csv\n%s" % (maz_df.head(6), )) # ### Create taz file # TAZ # 2 # 5 # 6 # 7 taz_zone_ids = np.unique(land_use.TAZ) taz_zone_indexes = (taz_zone_ids-1) taz_df = pd.DataFrame({'TAZ': taz_zone_ids}, index=taz_zone_indexes) taz_df.to_csv(os.path.join(output_data, 'taz.csv'), index=False) print("taz.csv\n%s" % (taz_df.head(6), )) # currently this has only the one TAZ column, but the legacy table had: # index TAZ # offset int64 # terminal_time float64 # occasional small integer (1-5), but mostly blank (only if it has a TAP? # ptype float64 # parking type at TAP? (rarer than terminal_time, never alone) # ### Create maz to maz time/distance max_distance_for_walk = 1.0 max_distance_for_bike = 5.0 with omx.open_file(os.path.join(input_data, 'skims.omx')) as ur_skims: # create df with DIST column maz_to_maz = pd.DataFrame(ur_skims['DIST']).unstack().reset_index() maz_to_maz.columns = ['OMAZ', 'DMAZ', 'DIST'] maz_to_maz['OMAZ'] = (maz_to_maz['OMAZ'] + 1) * MAZ_MULTIPLIER maz_to_maz['DMAZ'] = (maz_to_maz['DMAZ'] + 1) * MAZ_MULTIPLIER # additional columns for c in ['DISTBIKE', 'DISTWALK']: maz_to_maz[c] = pd.DataFrame(ur_skims[c]).unstack().values maz_to_maz.loc[maz_to_maz['DIST'] <= max_distance_for_walk, ['OMAZ', 'DMAZ', 'DISTWALK']].\ to_csv(os.path.join(output_data, 'maz_to_maz_walk.csv'), index=False) maz_to_maz.loc[maz_to_maz['DIST'] <= max_distance_for_bike, ['OMAZ', 'DMAZ', 'DIST', 'DISTBIKE']].\ to_csv(os.path.join(output_data, 'maz_to_maz_bike.csv'), index=False) ######## # create tap file # currently the only attribute is its containing maz np.random.seed(42) # seed for random_variation so we build the same data every time taz_zone_labels = taz_df.TAZ.values tap_zone_labels = taz_zone_labels + TAP_OFFSET maz_zone_labels = taz_zone_labels * MAZ_MULTIPLIER tap_df = pd.DataFrame({"TAP": tap_zone_labels, "MAZ": maz_zone_labels}) tap_df.to_csv(os.path.join(output_data, 'tap.csv'), index=False) # create taz_z3 and tap skims with \ omx.open_file(os.path.join(input_data, 'skims.omx'), "r") as ur_skims, \ omx.open_file(os.path.join(output_data, 'taz_skims.omx'), "w") as output_taz_skims_file, \ omx.open_file(os.path.join(output_data, 'tap_skims.omx'), "w") as output_tap_skims_file: for skim_name in ur_skims.list_matrices(): ur_skim = ur_skims[skim_name][:] new_skim = ur_skim[taz_zone_indexes, :][:, taz_zone_indexes] # print("skim:", skim_name, ": shape", str(new_skim.shape)) mode_code = skim_name[0:3] is_tap_mode = (mode_code == "DRV" or mode_code == "WLK") is_taz_mode = not is_tap_mode if is_tap_mode: # WLK_TRN_WLK_XWAIT__PM # 012345678911111111112 # 01234567890 access_mode = skim_name[0:3] transit_mode = skim_name[4:7] egress_mode = skim_name[8:11] datum_name = skim_name[12:-4] tod = skim_name[-2:] if access_mode == 'WLK' and egress_mode == 'WLK': for suffix in ['FAST', 'SHORT', 'CHEAP']: if (suffix == 'FAST') and (datum_name == 'TOTIVT'): random_variation = np.random.rand(*new_skim.shape)*-0.1 + 1.0 elif (suffix == 'CHEAP') and (datum_name == 'FAR'): random_variation = np.random.rand(*new_skim.shape) * -0.5 + 1.0 else: random_variation = np.ones_like(new_skim) tap_skim_name = f'{transit_mode}_{datum_name}_{suffix}__{tod}' output_tap_skims_file[tap_skim_name] = new_skim * random_variation # print(f"tap skim: {skim_name} tap_skim_name: {tap_skim_name}, " # f"shape: {str(output_tap_skims_file.shape())}") if is_taz_mode: output_taz_skims_file[skim_name] = new_skim # print("taz skim:", skim_name, ": shape", str(output_taz_skims_file.shape())) output_taz_skims_file.create_mapping("taz", taz_zone_labels) output_tap_skims_file.create_mapping("tap", tap_zone_labels) print("taz skims created: " + os.path.join(output_data, 'taz_skims.omx')) print("tap skims created: " + os.path.join(output_data, 'tap_skims.omx')) # Create maz to tap distance file by mode with omx.open_file(os.path.join(input_data, 'skims.omx')) as ur_skims: distance_table = pd.DataFrame(np.transpose(ur_skims['DIST'])).unstack() distance_table = distance_table.reset_index() distance_table.columns = ["MAZ", "TAP", "DIST"] distance_table['drive_time'] = pd.DataFrame(np.transpose(ur_skims['SOV_TIME__MD'])).unstack().values for c in ['DISTBIKE', 'DISTWALK']: distance_table[c] = pd.DataFrame(np.transpose(ur_skims[c])).unstack().values walk_speed = 3 bike_speed = 10 drive_speed = 25 max_distance_for_nearby_taps_walk = 1.0 max_distance_for_nearby_taps_bike = 5.0 max_distance_for_nearby_taps_drive = 10.0 distance_table["MAZ"] = (distance_table["MAZ"] + 1) * MAZ_MULTIPLIER distance_table["TAP"] = (distance_table["TAP"] + 1) + TAP_OFFSET distance_table["walk_time"] = distance_table["DIST"] * (60 / walk_speed) distance_table["bike_time"] = distance_table["DIST"] * (60 * bike_speed) # FIXME: we are using SOV_TIME__MD - is that right? distance_table["drive_time"] = distance_table["DIST"] * (60 * drive_speed) distance_table = distance_table[distance_table["TAP"].isin(tap_zone_labels)] distance_table.loc[distance_table['DIST'] <= max_distance_for_nearby_taps_walk, ['MAZ', 'TAP', 'DISTWALK', 'walk_time']]. \ to_csv(os.path.join(output_data, 'maz_to_tap_walk.csv'), index=False) distance_table.loc[distance_table['DIST'] <= max_distance_for_nearby_taps_bike, ['MAZ', 'TAP', 'DISTBIKE', 'bike_time']]. \ to_csv(os.path.join(output_data, 'maz_to_tap_bike.csv'), index=False) distance_table.loc[distance_table['DIST'] <= max_distance_for_nearby_taps_drive, ['MAZ', 'TAP', 'DIST', 'drive_time']]. \ to_csv(os.path.join(output_data, 'maz_to_tap_drive.csv'), index=False) sys.exit(0)
{"hexsha": "bc49a2a0ef1eb65b17c7517449f611fba6556cf6", "size": 9084, "ext": "py", "lang": "Python", "max_stars_repo_path": "activitysim/examples/example_multiple_zone/scripts/three_zone_example_data.py", "max_stars_repo_name": "mxndrwgrdnr/activitysim", "max_stars_repo_head_hexsha": "722d6e36b2210d5d24dfa2ac4a3504c1e8f75336", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 85, "max_stars_repo_stars_event_min_datetime": "2018-02-16T15:08:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-23T15:08:08.000Z", "max_issues_repo_path": "activitysim/examples/example_multiple_zone/scripts/three_zone_example_data.py", "max_issues_repo_name": "mxndrwgrdnr/activitysim", "max_issues_repo_head_hexsha": "722d6e36b2210d5d24dfa2ac4a3504c1e8f75336", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 311, "max_issues_repo_issues_event_min_datetime": "2018-01-16T01:59:47.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T00:46:40.000Z", "max_forks_repo_path": "activitysim/examples/example_multiple_zone/scripts/three_zone_example_data.py", "max_forks_repo_name": "mxndrwgrdnr/activitysim", "max_forks_repo_head_hexsha": "722d6e36b2210d5d24dfa2ac4a3504c1e8f75336", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 63, "max_forks_repo_forks_event_min_datetime": "2018-02-05T15:27:51.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-04T20:36:33.000Z", "avg_line_length": 37.6929460581, "max_line_length": 118, "alphanum_fraction": 0.6828489652, "include": true, "reason": "import numpy", "num_tokens": 2618}
import math import numpy as np import sys print("Inflow(Cs),") f=np.load('outfile.npz') x=sys.argv[1] for item in f[x+'PredictPlot']: if not math.isnan(item): print(item[0],",")
{"hexsha": "d138c8a18bbea7ae7b8abbc8c06d422217a9af05", "size": 190, "ext": "py", "lang": "Python", "max_stars_repo_path": "LSTM/graphs/read_outfile.py", "max_stars_repo_name": "Anurag14/Inflow-prediction-Bhakra", "max_stars_repo_head_hexsha": "d440ec552032084991878877ba5154ea2c452264", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2019-05-29T09:07:25.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-28T13:53:50.000Z", "max_issues_repo_path": "LSTM/graphs/read_outfile.py", "max_issues_repo_name": "Anurag14/Inflow-prediction-Bhakra", "max_issues_repo_head_hexsha": "d440ec552032084991878877ba5154ea2c452264", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "LSTM/graphs/read_outfile.py", "max_forks_repo_name": "Anurag14/Inflow-prediction-Bhakra", "max_forks_repo_head_hexsha": "d440ec552032084991878877ba5154ea2c452264", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2019-06-02T17:48:48.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-13T01:29:16.000Z", "avg_line_length": 19.0, "max_line_length": 31, "alphanum_fraction": 0.6473684211, "include": true, "reason": "import numpy", "num_tokens": 56}
SUBROUTINE XLAENV( ISPEC, NVALUE ) * * -- LAPACK auxiliary routine (version 3.1) -- * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. * November 2006 * * .. Scalar Arguments .. INTEGER ISPEC, NVALUE * .. * * Purpose * ======= * * XLAENV sets certain machine- and problem-dependent quantities * which will later be retrieved by ILAENV. * * Arguments * ========= * * ISPEC (input) INTEGER * Specifies the parameter to be set in the COMMON array IPARMS. * = 1: the optimal blocksize; if this value is 1, an unblocked * algorithm will give the best performance. * = 2: the minimum block size for which the block routine * should be used; if the usable block size is less than * this value, an unblocked routine should be used. * = 3: the crossover point (in a block routine, for N less * than this value, an unblocked routine should be used) * = 4: the number of shifts, used in the nonsymmetric * eigenvalue routines * = 5: the minimum column dimension for blocking to be used; * rectangular blocks must have dimension at least k by m, * where k is given by ILAENV(2,...) and m by ILAENV(5,...) * = 6: the crossover point for the SVD (when reducing an m by n * matrix to bidiagonal form, if max(m,n)/min(m,n) exceeds * this value, a QR factorization is used first to reduce * the matrix to a triangular form) * = 7: the number of processors * = 8: another crossover point, for the multishift QR and QZ * methods for nonsymmetric eigenvalue problems. * = 9: maximum size of the subproblems at the bottom of the * computation tree in the divide-and-conquer algorithm * (used by xGELSD and xGESDD) * =10: ieee NaN arithmetic can be trusted not to trap * =11: infinity arithmetic can be trusted not to trap * * NVALUE (input) INTEGER * The value of the parameter specified by ISPEC. * * ===================================================================== * * .. Arrays in Common .. INTEGER IPARMS( 100 ) * .. * .. Common blocks .. COMMON / CLAENV / IPARMS * .. * .. Save statement .. SAVE / CLAENV / * .. * .. Executable Statements .. * IF( ISPEC.GE.1 .AND. ISPEC.LE.9 ) THEN IPARMS( ISPEC ) = NVALUE END IF * RETURN * * End of XLAENV * END
{"hexsha": "648c0c85b154787d8de22682e3e47d95afb6ca6b", "size": 2622, "ext": "f", "lang": "FORTRAN", "max_stars_repo_path": "external_src/oomph_flapack/xlaenv.f", "max_stars_repo_name": "pkeuchel/oomph-lib", "max_stars_repo_head_hexsha": "37c1c61425d6b9ea1c2ddceef63a68a228af6fa4", "max_stars_repo_licenses": ["RSA-MD"], "max_stars_count": 31, "max_stars_repo_stars_event_min_datetime": "2015-06-19T14:41:12.000Z", "max_stars_repo_stars_event_max_datetime": "2021-02-15T12:47:57.000Z", "max_issues_repo_path": "external_src/oomph_flapack/xlaenv.f", "max_issues_repo_name": "pkeuchel/oomph-lib", "max_issues_repo_head_hexsha": "37c1c61425d6b9ea1c2ddceef63a68a228af6fa4", "max_issues_repo_licenses": ["RSA-MD"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2020-01-02T05:21:16.000Z", "max_issues_repo_issues_event_max_datetime": "2020-01-07T20:04:05.000Z", "max_forks_repo_path": "external_src/oomph_flapack/xlaenv.f", "max_forks_repo_name": "pkeuchel/oomph-lib", "max_forks_repo_head_hexsha": "37c1c61425d6b9ea1c2ddceef63a68a228af6fa4", "max_forks_repo_licenses": ["RSA-MD"], "max_forks_count": 17, "max_forks_repo_forks_event_min_datetime": "2015-04-01T14:26:48.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-27T06:12:15.000Z", "avg_line_length": 36.4166666667, "max_line_length": 72, "alphanum_fraction": 0.5606407323, "num_tokens": 655}
function e = calcError(pf,rec,varargin) % RP and mean square error % % *calcError(pf,rec)* calculates reconstruction error between meassured % intensities and the recalcuated ODF or between two meassured pole % figures. It can be specified whether the RP % error or the mean square error is calculated. The scaling coefficients % are calculated by the function PoleFigure/calcNormalization % % Syntax % e = calcError(pf,pf2) % compares two different @PoleFigure with same @S2Grid % e = calcError(pf,rec) % compares @PoleFigure with the Recalculated @SO3Fun % % Input % pf,pf2 - @PoleFigure % rec - @SO3Fun % % Output % e - error % % Flags % RP - RP value (default) |pfmeas - pfcalc|./ pfcalc % l1 - l1 error |pfmeas - pfcalc| % l2 - l2 error |pfmeas - pfcalc|.^2 % % See also % SO3Fun/calcError PoleFigure/calcNormalization PoleFigure/scale argin_check(rec,{'SO3Fun','PoleFigure'}); % calc difference PoleFigure errorpf = calcErrorPF(pf,rec,varargin{:}); % calc error e = zeros(1,pf.numPF); for i = 1:pf.numPF e(i) = mean(errorpf.allI{i}(:)); % RP error if check_option(varargin,'l1') e(i) = e(i)/mean(abs(pf.allI{i}(:))); % L^1 error elseif check_option(varargin,'l2') e(i) = e(i)/mean((pf.allI{i}(:)).^2); % L^2 error end end % TODO: implement a nice default output %if nargout == 0 % disp('TODO') % clear e; %end
{"author": "mtex-toolbox", "repo": "mtex", "sha": "f0ce46a720935e9ae8106ef919340534bca1adcb", "save_path": "github-repos/MATLAB/mtex-toolbox-mtex", "path": "github-repos/MATLAB/mtex-toolbox-mtex/mtex-f0ce46a720935e9ae8106ef919340534bca1adcb/PoleFigureAnalysis/@PoleFigure/calcError.m"}
#!/usr/local/bin/python3 """ Requirements: - sklearn - numpy Python: - 3.7 Hierarchical clustering (HC) is a method of cluster analysis which seeks to build a hierarchy of clusters. The code contains Agglomerative approach for hierarchical clustering. Agglomerative: This is a "bottom-up" approach. Each observation starts in its own cluster, and pairs of clusters are merged as one moves up the hierarchy. """ import warnings import numpy as np from sklearn import datasets as ds from sklearn.cluster import AgglomerativeClustering from sklearn.metrics import homogeneity_score, jaccard_score from sklearn.metrics.cluster import adjusted_rand_score warnings.filterwarnings("ignore") def dist_matrix(data): """ Calculate euclidean distance matrix for the given data. Parameters ---------- data : np.array contains our dataset in numpy array [NxF] Returns ------- dist : np.array distance matrix containing euclidean distance between one point with all other points [NxN] """ dist = np.zeros(shape=(data.shape[0], data.shape[0])) for i in range(data.shape[0]): for j in range(data.shape[0]): dist[i][j] = np.sqrt(np.sum(pow((data[i] - data[j]), 2))) return dist def inter_cluster_dist_method(data, clusters, dist, a, b, method="max"): """ Min: Distance between two clusters is represented by the distance of the closest pair of data objects belonging to different clusters. Max: Distance between two clusters is represented by the distance of the farthest pair of data objects belonging to different clusters. Avg: Distance between two clusters is represented by the average distance of all pairs of data objects belonging to different clusters """ dist_list = [dist[i, j] for i in clusters[a] for j in clusters[b]] if method == "min": res_dist = min(dist_list) if method == "max": res_dist = max(dist_list) if method == "avg": res_dist = np.mean(dist_list) return res_dist def hierarchial_clustering(data, dist, method="max", num_clusters=5): """ This function runs hierarchial clustering on given data using given method. Parameters ---------- data : np.array contains our dataset in numpy array dist : np.array distance matrix containing euclidean distance between one point with all other points [NxN] method : str Method used for hierarchial clustering ['max', 'min', 'avg'] num_clusters : int Number of clusters Returns ------- total_clusters : list containing a list of clusters at each hierarchy cluster_label : np.array Cluster labels """ # Initialise cluster list clusters = [] for i in range(len(data)): clusters = clusters + [[i]] total_clusters = [] # Merging clusters based on minimum of their inter cluster distances for k in range(data.shape[0] - 1): min_dist = 10000 for i in range(len(clusters)): for j in range(len(clusters)): if i != j: cur_dist = inter_cluster_dist_method( data, clusters, dist, i, j, method ) if cur_dist < min_dist: i_index = i j_index = j min_dist = cur_dist new_cluster = clusters[i_index] + clusters[j_index] del clusters[i_index], clusters[j_index - 1] clusters.append(new_cluster) total_clusters.append(clusters[:]) final_cluster = total_clusters[len(total_clusters) - num_clusters] cluster_label = np.zeros(data.shape[0]).astype(int) label = 0 for cluster in final_cluster: for point in cluster: cluster_label[point] = label label += 1 return total_clusters, cluster_label if __name__ == "__main__": dataset = ds.load_iris() X, clusters = dataset["data"], dataset["target"] num_clusters = 3 X = np.array(X) clusters = np.array(clusters) print(X.shape, clusters.shape) dist = dist_matrix(X) # Max distance print("\nHierarchial Clustering through Maximum distance") max_total_clusters, max_clusters = hierarchial_clustering( X, dist, "max", num_clusters ) MaxHclustering = AgglomerativeClustering( n_clusters=num_clusters, affinity="euclidean", linkage="complete" ).fit(X) print( "Homogeneity Score between grouth truth and our Max HC implementation: ", homogeneity_score(max_clusters, clusters), ) print( "Homogeneity Score between grouth truth and Max HC library: ", homogeneity_score(MaxHclustering.labels_, clusters), ) print( "Homogeneity Score between Max HC library and our Max HC implementation: ", homogeneity_score(max_clusters, MaxHclustering.labels_), ) print( "Jaccard Score of grouth truth and our Max HC implementation: ", jaccard_score(clusters, max_clusters, average="weighted"), ) print( "Jaccard Score of grouth truth and Max HC library: ", jaccard_score(clusters, MaxHclustering.labels_, average="weighted"), ) print( "Jaccard Score of Max HC library and our Max HC implementation: ", jaccard_score(MaxHclustering.labels_, max_clusters, average="weighted"), ) print( "Rand Score of grouth truth and our Max HC implementation: ", adjusted_rand_score(clusters, max_clusters), ) print( "Rand Score of grouth truth and Max HC library: ", adjusted_rand_score(clusters, MaxHclustering.labels_), ) print( "Rand Score of Max HC library and our Max HC implementation: ", adjusted_rand_score(MaxHclustering.labels_, max_clusters), ) # Min distance print("\nHierarchial Clustering through Minimum distance") min_total_clusters, min_clusters = hierarchial_clustering( X, dist, "min", num_clusters ) MinHclustering = AgglomerativeClustering( n_clusters=num_clusters, affinity="euclidean", linkage="single" ).fit(X) print( "Homogeneity Score between grouth truth and our Min HC implementation: ", homogeneity_score(min_clusters, clusters), ) print( "Homogeneity Score between grouth truth and Min HC library: ", homogeneity_score(MinHclustering.labels_, clusters), ) print( "Homogeneity Score between Min HC library and our Min HC implementation: ", homogeneity_score(min_clusters, MinHclustering.labels_), ) print( "Jaccard Score of grouth truth and our Min HC implementation: ", jaccard_score(clusters, min_clusters, average="weighted"), ) print( "Jaccard Score of grouth truth and Min HC library: ", jaccard_score(clusters, MinHclustering.labels_, average="weighted"), ) print( "Jaccard Score of Min HC library and our Min HC implementation: ", jaccard_score(MinHclustering.labels_, min_clusters, average="weighted"), ) print( "Rand Score of grouth truth and our Min HC implementation: ", adjusted_rand_score(clusters, min_clusters), ) print( "Rand Score of grouth truth and Min HC library: ", adjusted_rand_score(clusters, MinHclustering.labels_), ) print( "Rand Score of Min HC library and our Min HC implementation: ", adjusted_rand_score(MinHclustering.labels_, min_clusters), )
{"hexsha": "330c1ffc40ce9baef22aab480c6634c9b7bcc2f2", "size": 7627, "ext": "py", "lang": "Python", "max_stars_repo_path": "machine_learning/hierarchial_clustering.py", "max_stars_repo_name": "jindal2309/Python", "max_stars_repo_head_hexsha": "894293574d3439b13ec848d223afec34cd9a075f", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "machine_learning/hierarchial_clustering.py", "max_issues_repo_name": "jindal2309/Python", "max_issues_repo_head_hexsha": "894293574d3439b13ec848d223afec34cd9a075f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "machine_learning/hierarchial_clustering.py", "max_forks_repo_name": "jindal2309/Python", "max_forks_repo_head_hexsha": "894293574d3439b13ec848d223afec34cd9a075f", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.3177966102, "max_line_length": 83, "alphanum_fraction": 0.6542546217, "include": true, "reason": "import numpy", "num_tokens": 1710}
# -*- coding: utf-8 -*- """ Logistic regression (yes, pretty basic) Created on Sun Jun 7 21:05:59 2020 @author: Gurpinder """ import numpy as np import matplotlib.pyplot as plt from scipy.optimize import fmin_tnc X = [] y = [] #Reading the data with open("ex2data1.txt") as f: lines = f.readlines() for line in lines: line = line.replace("\n", "") X.append([float(line.split(",")[0]) , float(line.split(",")[1]) ]) y.append([float(line.split(",")[2])]) # converting to vectors X = np.array(X) y = np.array(y) #sigmoid function def sigmoid(a): return 1/(1+ np.exp(-a)) ## Alternative way #sigVec = np.vectorize(sigmoid) ones = np.ones((len(X), 1)) X = np.append(ones, X, axis = 1) initial_theta = np.zeros(3) def costfunction(theta, X, y): m, n = X.shape first_term = -y.transpose().dot(np.log(sigmoid(X.dot(theta)))) second_term = (1-y.transpose()).dot(np.log(1 - sigmoid(X.dot(theta)))) return (1/m)*np.sum(first_term - second_term) def gradient(theta, X, y): m, n = X.shape theta = theta.reshape((3,1)) term = (sigmoid(X.dot(theta)) - y).transpose() return (1/m)*(term.dot(X)) #Result = fmin_ncg(costfunction, initial_theta, gradient, args=(X, y), full_output=True) Result = fmin_tnc(func= costfunction, x0=initial_theta, fprime=gradient, args=(X, y)) best_theta = Result[0] #plotting the decision boundary def plotDecision(theta, X, y): X_point = np.array([min(X[:,1])-2, max(X[:,1])+2]) plot_y = (-1/theta[2])*(theta[1]*X_point + theta[0]) positives = y[:,0] == 1 negatives = y[:,0] == 0 plt.figure(figsize = (8,5)) plt.plot(X[(positives),1], X[(positives),2], "r+", label="Admitted") plt.plot(X[(negatives),1], X[(negatives),2], "bo", label="Not Admitted") plt.xlabel("Exam 1 Score") plt.ylabel("Exam 2 Score") plt.legend(loc = "best") plt.title("Student Admissions based on 2 Exam Scores.") plt.plot(X_point, plot_y, "g-") plt.show()
{"hexsha": "14dcec5b009c2fd575f37b11298afa19aa602a2f", "size": 2100, "ext": "py", "lang": "Python", "max_stars_repo_path": "Logistic_Regression/Logistic_Regression.py", "max_stars_repo_name": "Gurpinder98/Fun_scripts", "max_stars_repo_head_hexsha": "32e3c512196a0db7326cbb06475ab30e8e083738", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Logistic_Regression/Logistic_Regression.py", "max_issues_repo_name": "Gurpinder98/Fun_scripts", "max_issues_repo_head_hexsha": "32e3c512196a0db7326cbb06475ab30e8e083738", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Logistic_Regression/Logistic_Regression.py", "max_forks_repo_name": "Gurpinder98/Fun_scripts", "max_forks_repo_head_hexsha": "32e3c512196a0db7326cbb06475ab30e8e083738", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.9259259259, "max_line_length": 89, "alphanum_fraction": 0.5847619048, "include": true, "reason": "import numpy,from scipy", "num_tokens": 609}
import os from glob import glob from tqdm import tqdm import numpy as np import cv2 import skimage.measure def i3d_prediction(model, features_folder, output_folder): feature_paths = glob(os.path.join(features_folder, '*')) feature_paths.sort() os.makedirs(output_folder, exist_ok=True) for feature_path in tqdm(feature_paths, desc="Making predictions", unit='prediction'): filename = os.path.basename(feature_path) filename_wo_ext, _ = os.path.splitext(filename) output_file_path = os.path.join(output_folder, f'{filename_wo_ext}.png') feature_array = np.load(feature_path) model.predict_segmentation( inp=feature_array, out_fname=output_file_path ) def region_prop_detections(detections_folder, output_folder): os.makedirs(output_folder, exist_ok=True) detections = glob(os.path.join(detections_folder, '*')) for det_path in tqdm(detections, desc='Region propping detections'): filename = os.path.basename(det_path) det = cv2.imread(det_path) det[det > 0] = 255 label = skimage.measure.label(det) props = skimage.measure.regionprops(label) for prp in props: if prp.bbox_area > 3: min_row, min_col, _, max_row, max_col, _ = prp.bbox det[min_row:max_row, min_col:max_col, :] = 255 output_path = os.path.join(output_folder, filename) cv2.imwrite(output_path, det) def get_contours(image_file): image_file = image_file.copy() image_gray = cv2.cvtColor(image_file.copy(), cv2.COLOR_BGR2GRAY) _, image_thresh = cv2.threshold(image_gray, 127, 255, 0) _, image_contours, _ = cv2.findContours(image_thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) return image_contours def parse_contours(contours): new_contours = [] for contour in contours: if cv2.contourArea(contour) > 0: x1, y1, w, h = cv2.boundingRect(contour) x2 = x1 + w y2 = y1 + h temp = { 'x1': x1, 'x2': x2, 'y1': y1, 'y2': y2, } new_contours.append(temp) return new_contours def save_contours(contours, output_file_path, is_ground_truth): with open(output_file_path, 'w') as f: for contour in contours: if is_ground_truth: string_to_write = f"UAV {contour['x1']} {contour['y1']} {contour['x2']} {contour['y2']}\n" else: string_to_write = f"UAV 1.0 {contour['x1']} {contour['y1']} {contour['x2']} {contour['y2']}\n" f.write(string_to_write) def generate_annotation_text_files(input_folder: str, output_folder: str, is_ground_truth: True): file_paths = glob(os.path.join(input_folder, '*')) os.makedirs(output_folder, exist_ok=True) desc_str = 'Generating text annotation files' if is_ground_truth: desc_str += ' for ground truth files' else: desc_str += ' for detection files' pbar = tqdm(total=len(file_paths), desc=desc_str, unit="image", dynamic_ncols=True) for file_path in file_paths: filename = os.path.basename(file_path) filename_without_ext, file_ext = os.path.splitext(filename) fl = cv2.imread(file_path) contours = get_contours(fl) contours = parse_contours(contours) if is_ground_truth: if len(contours) > 0: annotation_output_file_path = os.path.join(output_folder, f"{filename_without_ext}.txt") save_contours(contours, annotation_output_file_path, is_ground_truth) else: annotation_output_file_path = os.path.join(output_folder, f"{filename_without_ext}.txt") save_contours(contours, annotation_output_file_path, is_ground_truth) pbar.update() pbar.close()
{"hexsha": "6927ae4e2be45fa8b4a2ca80ec54ef05b5f6b642", "size": 3901, "ext": "py", "lang": "Python", "max_stars_repo_path": "test_model/libs/i3d_funcs.py", "max_stars_repo_name": "wpfhtl/Drone-Detection-1", "max_stars_repo_head_hexsha": "d3aeb2f731739475b1b63e74337876ea14de08ac", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 19, "max_stars_repo_stars_event_min_datetime": "2021-04-18T00:35:53.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T06:43:07.000Z", "max_issues_repo_path": "test_model/libs/i3d_funcs.py", "max_issues_repo_name": "wpfhtl/Drone-Detection-1", "max_issues_repo_head_hexsha": "d3aeb2f731739475b1b63e74337876ea14de08ac", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2021-06-20T07:25:35.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T06:58:51.000Z", "max_forks_repo_path": "test_model/libs/i3d_funcs.py", "max_forks_repo_name": "wpfhtl/Drone-Detection-1", "max_forks_repo_head_hexsha": "d3aeb2f731739475b1b63e74337876ea14de08ac", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2021-05-01T03:30:24.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-08T09:17:16.000Z", "avg_line_length": 33.9217391304, "max_line_length": 110, "alphanum_fraction": 0.64496283, "include": true, "reason": "import numpy", "num_tokens": 936}
! Generated by cart. DO NOT EDIT program main implicit none if (.not.run()) stop 1 contains function run() result(passed) use acceleration_test, only: & acceleration_acceleration => & test_acceleration use amount_rate_test, only: & amount_rate_amount_rate => & test_amount_rate use amount_temperature_rate_test, only: & amount_temperature_rate_amount_temperature_rate => & test_amount_temperature_rate use amount_temperature_test, only: & amount_temperature_amount_temperature => & test_amount_temperature use amount_test, only: & amount_amount => & test_amount use angle_test, only: & angle_angle => & test_angle use area_test, only: & area_area => & test_area use burnup_test, only: & burnup_burnup => & test_burnup use convective_heat_transfer_test, only: & convective_heat_transfer_convective_heat_transfer => & test_convective_heat_transfer use density_test, only: & density_density => & test_density use dynamic_viscosity_test, only: & dynamic_viscosity_dynamic_viscosity => & test_dynamic_viscosity use energy_per_amount_test, only: & energy_per_amount_energy_per_amount => & test_energy_per_amount use energy_per_temperature_amount_test, only: & energy_per_temperature_amount_energy_per_temperature_amount => & test_energy_per_temperature_amount use energy_test, only: & energy_energy => & test_energy use enthalpy_test, only: & enthalpy_enthalpy => & test_enthalpy use fluence_test, only: & fluence_fluence => & test_fluence use force_test, only: & force_force => & test_force use fracture_toughness_test, only: & fracture_toughness_fracture_toughness => & test_fracture_toughness use frequency_test, only: & frequency_frequency => & test_frequency use interquantity_test, only: & interquantity_interquantity_operators => & test_interquantity_operators use length_test, only: & length_length => & test_length use mass_rate_test, only: & mass_rate_mass_rate => & test_mass_rate use mass_test, only: & mass_mass => & test_mass use molar_mass_test, only: & molar_mass_molar_mass => & test_molar_mass use power_test, only: & power_power => & test_power use pressure_test, only: & pressure_pressure => & test_pressure use specific_heat_test, only: & specific_heat_specific_heat => & test_specific_heat use speed_test, only: & speed_speed => & test_speed use stress_intensity_factor_test, only: & stress_intensity_factor_stress_intensity_factor => & test_stress_intensity_factor use temperature_test, only: & temperature_temperature => & test_temperature use thermal_conductivity_test, only: & thermal_conductivity_thermal_conductivity => & test_thermal_conductivity use thermal_expansion_coefficient_test, only: & thermal_expansion_coefficient_thermal_expansion_coefficient => & test_thermal_expansion_coefficient use time_test, only: & time_time => & test_time use volume_test, only: & volume_volume => & test_volume use veggies, only: test_item_t, test_that, run_tests logical :: passed type(test_item_t) :: tests type(test_item_t) :: individual_tests(34) individual_tests(1) = acceleration_acceleration() individual_tests(2) = amount_rate_amount_rate() individual_tests(3) = amount_temperature_rate_amount_temperature_rate() individual_tests(4) = amount_temperature_amount_temperature() individual_tests(5) = amount_amount() individual_tests(6) = angle_angle() individual_tests(7) = area_area() individual_tests(8) = burnup_burnup() individual_tests(9) = convective_heat_transfer_convective_heat_transfer() individual_tests(10) = density_density() individual_tests(11) = dynamic_viscosity_dynamic_viscosity() individual_tests(12) = energy_per_amount_energy_per_amount() individual_tests(13) = energy_per_temperature_amount_energy_per_temperature_amount() individual_tests(14) = energy_energy() individual_tests(15) = enthalpy_enthalpy() individual_tests(16) = fluence_fluence() individual_tests(17) = force_force() individual_tests(18) = fracture_toughness_fracture_toughness() individual_tests(19) = frequency_frequency() individual_tests(20) = interquantity_interquantity_operators() individual_tests(21) = length_length() individual_tests(22) = mass_rate_mass_rate() individual_tests(23) = mass_mass() individual_tests(24) = molar_mass_molar_mass() individual_tests(25) = power_power() individual_tests(26) = pressure_pressure() individual_tests(27) = specific_heat_specific_heat() individual_tests(28) = speed_speed() individual_tests(29) = stress_intensity_factor_stress_intensity_factor() individual_tests(30) = temperature_temperature() individual_tests(31) = thermal_conductivity_thermal_conductivity() individual_tests(32) = thermal_expansion_coefficient_thermal_expansion_coefficient() individual_tests(33) = time_time() individual_tests(34) = volume_volume() tests = test_that(individual_tests) passed = run_tests(tests) end function end program
{"hexsha": "d7316fba3fff1afcfec95cea6db20b1efcbc0d8e", "size": 6605, "ext": "f90", "lang": "FORTRAN", "max_stars_repo_path": "test/main.f90", "max_stars_repo_name": "everythingfunctional/quaff", "max_stars_repo_head_hexsha": "72a4a4611e18b799196a5f962b4c653ace7a3671", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/main.f90", "max_issues_repo_name": "everythingfunctional/quaff", "max_issues_repo_head_hexsha": "72a4a4611e18b799196a5f962b4c653ace7a3671", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test/main.f90", "max_forks_repo_name": "everythingfunctional/quaff", "max_forks_repo_head_hexsha": "72a4a4611e18b799196a5f962b4c653ace7a3671", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.28125, "max_line_length": 92, "alphanum_fraction": 0.5962149886, "num_tokens": 1266}
""" Module to gather various high-level algorithms based on the kernel methods, such as kernel-based predictive models for classification and regression. """ from abc import abstractmethod from copy import deepcopy import numpy as np from sklearn.base import (BaseEstimator, ClassifierMixin, RegressorMixin, is_classifier, is_regressor) from sklearn.exceptions import NotFittedError from sklearn.svm import SVC, SVR from sklearn.utils.validation import check_X_y, check_array from kernelmethods import config as cfg from kernelmethods.base import KernelMatrix from kernelmethods.numeric_kernels import GaussianKernel from kernelmethods.ranking import find_optimal_kernel, get_estimator from kernelmethods.sampling import KernelBucket, make_kernel_bucket class BaseKernelMachine(BaseEstimator): """Generic class to return a drop-in sklearn estimator. Parameters ---------- k_func : KernelFunction The kernel function the kernel machine bases itself on learner_id : str Identifier for the estimator to be built based on the kernel function. Options: ``SVC`` and ``SVR``. Default: ``SVC`` (classifier version of SVM) normalized : flag Flag to indicate whether to keep the kernel matrix normalized Default: False """ def __init__(self, k_func=GaussianKernel(), learner_id='SVC', normalized=False): """ Constructor for the KernelMachine class. Parameters ---------- k_func : KernelFunction The kernel function the kernel machine bases itself on learner_id : str Identifier for the estimator to be built based on the kernel function. Options: ``SVC`` and ``SVR``. Default: ``SVC`` (classifier version of SVM) normalized : flag Flag to indicate whether to keep the kernel matrix normalized. Default: False """ self.k_func = k_func self.learner_id = learner_id self.normalized = normalized def fit(self, X, y, sample_weight=None): """Fit the chosen Estimator based on the user-defined kernel. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-like, shape (n_samples,) Target values (class labels in classification, real numbers in regression) sample_weight : array-like, shape (n_samples,) Per-sample weights. Rescale C per sample. Higher weights force the classifier to put more emphasis on these points. Returns ------- self : object Notes ------ If X and y are not C-ordered and contiguous arrays of np.float64 and X is not a scipy.sparse.csr_matrix, X and/or y may be copied. If X is a dense array, then the other methods will not support sparse matrices as input. """ if is_regressor(self): self._train_X, self._train_y = check_X_y(X, y, y_numeric=True) self._train_y = self._train_y.astype(np.float_) else: self._train_X, self._train_y = check_X_y(X, y) self._km = KernelMatrix(self.k_func, name='train_km', normalized=self.normalized) self._km.attach_to(self._train_X) self._estimator, self.param_grid = get_estimator(self.learner_id) self._estimator.fit(X=self._km.full, y=self._train_y, sample_weight=sample_weight) if is_classifier(self): self.classes_ = self._estimator.classes_ return self def predict(self, X): """ Make predictions on the new samplets in X. For an one-class model, +1 or -1 is returned. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) Returns ------- y_pred : array, shape (n_samples,) Class labels for samples in X. """ if not hasattr(self, '_km'): raise NotFittedError("Can't predict. Not fitted yet. Run .fit() first!") test_X = check_array(X) # this is a fresh new KM self._km = KernelMatrix(self.k_func, name='test_km', normalized=self.normalized) # sample_one must be test data to get the right shape for sklearn X self._km.attach_to(sample_one=test_X, sample_two=self._train_X) predicted_y = self._estimator.predict(self._km.full) return np.asarray(predicted_y, dtype=self._train_y.dtype) def get_params(self, deep=True): """returns all the relevant parameters for this estimator!""" return {'k_func' : self.k_func, 'normalized': self.normalized, 'learner_id': self.learner_id} def set_params(self, **parameters): """Param setter""" for parameter, value in parameters.items(): if parameter in ('k_func', 'learner_id', 'normalized'): setattr(self, parameter, value) return self def _more_tags(self): """Handling specific cases with tags""" from kernelmethods.numeric_kernels import Chi2Kernel, SigmoidKernel, \ HadamardKernel if isinstance(self.k_func, Chi2Kernel): return {'requires_positive_X': True} elif isinstance(self.k_func, (SigmoidKernel, HadamardKernel)): return {'poor_score': True} else: return dict() class KernelMachine(BaseKernelMachine, ClassifierMixin): """Classifier version of the KernelMachine""" class KernelMachineRegressor(BaseKernelMachine, RegressorMixin): """Regressor version of the KernelMachine Parameters ---------- k_func : KernelFunction The kernel function the kernel machine bases itself on learner_id : str Identifier for the estimator to be built based on the kernel function. Options: ``SVR``. Default: ``SVR`` (regressor version of SVM) normalized : flag Flag to indicate whether to keep the kernel matrix normalized Default: False """ def __init__(self, k_func=GaussianKernel(), learner_id='SVR', normalized=False): """ Constructor for the regressor version of the KernelMachine Parameters ---------- k_func : KernelFunction The kernel function the kernel machine bases itself on learner_id : str Identifier for the estimator to be built based on the kernel function. Options: ``SVR`` Default: ``SVR`` (regressor version of SVM) normalized : flag Flag to indicate whether to keep the kernel matrix normalized. Default: False """ self.k_func = k_func self.learner_id = learner_id self.normalized = normalized class BaseOptimalKernelMachine(BaseEstimator): """ An estimator to learn the optimal kernel for a given sample and build a support vector regressor based on this custom kernel. This class is wrapped around the sklearn SVR estimator to function as its drop-in replacement, whose implementation is in turn based on LIBSVM. Parameters ---------- k_bucket : KernelBucket or str An instance of KernelBucket that contains all the kernels to be compared, or a string identifying the sampling_strategy which populates a KernelBucket. method : str Scoring method to rank different kernels C : float, optional (default=1.0) Penalty parameter C of the error term. epsilon : float, optional (default=0.1) Epsilon in the epsilon-SVR model. It specifies the epsilon-tube within which no penalty is associated in the training loss function with points predicted within a distance epsilon from the actual value. tol : float, optional (default=1e-3) Tolerance for stopping criterion. shrinking : boolean, optional (default=True) Whether to use the shrinking heuristic. Attributes ---------- support_ : array-like, shape = [n_SV] Indices of support vectors. support_vectors_ : array-like, shape = [nSV, n_features] Support vectors. dual_coef_ : array, shape = [1, n_SV] Coefficients of the support vector in the decision function. coef_ : array, shape = [1, n_features] Weights assigned to the features (coefficients in the primal problem). This is only available in the case of a linear kernel. `coef_` is readonly property derived from `dual_coef_` and `support_vectors_`. intercept_ : array, shape = [1] Constants in decision function. """ @abstractmethod def _find_optimal_kernel(self): """Method to find the optimal kernel Given a kernel bucket, a training sample and a ranking method. To be defined by the child class, appropriate for their task i.e. classification or regression """ def fit(self, X, y, sample_weight=None): """Estimate the optimal kernel, and fit a SVM based on the custom kernel. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) Training vectors, where n_samples is the number of samples and n_features is the number of features. y : array-like, shape (n_samples,) Target values (class labels in classification, real numbers in regression) sample_weight : array-like, shape (n_samples,) Per-sample weights. Rescale C per sample. Higher weights force the classifier to put more emphasis on these points. Returns ------- self : object Notes ------ If X and y are not C-ordered and contiguous arrays of np.float64 and X is not a scipy.sparse.csr_matrix, X and/or y may be copied. If X is a dense array, then the other methods will not support sparse matrices as input. """ if isinstance(self.k_bucket, str): try: # using a new internal variable to retain user supplied param self._k_bucket = make_kernel_bucket(self.k_bucket) except: raise ValueError('Input for k_func can only an instance of ' 'KernelBucket or a sampling strategy to generate ' 'one with make_kernel_bucket.' 'sampling strategy must be one of {}' ''.format(cfg.kernel_bucket_strategies)) elif isinstance(self.k_bucket, KernelBucket): self._k_bucket = deepcopy(self.k_bucket) else: raise ValueError('Input for k_func can only an instance of ' 'KernelBucket or a sampling strategy to generate ' 'one with make_kernel_bucket') self._train_X, self._train_y = check_X_y(X, y, y_numeric=True) self.opt_kernel_ = self._find_optimal_kernel() super().fit(X=self.opt_kernel_.full, y=self._train_y, sample_weight=sample_weight) # temporary hack to pass sklearn estimator checks till a bug is fixed # for more see: https://github.com/scikit-learn/scikit-learn/issues/14712 self.n_iter_ = 1 return self def predict(self, X): """ Perform classification on samples in X. For an one-class model, +1 or -1 is returned. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) Returns ------- y_pred : array, shape (n_samples,) Class labels for samples in X. """ if not hasattr(self, 'opt_kernel_'): raise NotFittedError("Can't predict. Not fitted yet. Run .fit() first!") X = check_array(X) # sample_one must be test data to get the right shape for sklearn X self.opt_kernel_.attach_to(sample_one=X, sample_two=self._train_X) test_train_KM = self.opt_kernel_.full predicted_y = super().predict(test_train_KM) # data type coversion is done in child class, esp. for classification # return np.asarray(predicted_y, dtype=np.intp) return predicted_y @abstractmethod def get_params(self, deep=True): """returns all the relevant parameters for this estimator!""" # example code, for future reference return {'k_bucket' : self.k_bucket, 'method' : self.method, 'C' : self.C, 'epsilon' : self.epsilon, 'shrinking': self.shrinking, 'tol' : self.tol} @abstractmethod def set_params(self, **parameters): """Param setter""" # example code, for future reference for parameter, value in parameters.items(): if parameter in ('k_bucket', 'method', 'C', 'epsilon', 'shrinking', 'tol'): setattr(self, parameter, value) return self class OptimalKernelSVR(BaseOptimalKernelMachine, SVR): """ An estimator to learn the optimal kernel for a given sample and build a support vector regressor based on this custom kernel. This class is wrapped around the sklearn SVR estimator to function as its drop-in replacement, whose implementation is in turn based on LIBSVM. Parameters ---------- k_bucket : KernelBucket or str An instance of KernelBucket that contains all the kernels to be compared, or a string identifying the sampling_strategy which populates a KernelBucket. method : str Scoring method to rank different kernels C : float, optional (default=1.0) Penalty parameter C of the error term. epsilon : float, optional (default=0.1) Epsilon in the epsilon-SVR model. It specifies the epsilon-tube within which no penalty is associated in the training loss function with points predicted within a distance epsilon from the actual value. tol : float, optional (default=1e-3) Tolerance for stopping criterion. shrinking : boolean, optional (default=True) Whether to use the shrinking heuristic. Attributes ---------- support_ : array-like, shape = [n_SV] Indices of support vectors. support_vectors_ : array-like, shape = [nSV, n_features] Support vectors. dual_coef_ : array, shape = [1, n_SV] Coefficients of the support vector in the decision function. coef_ : array, shape = [1, n_features] Weights assigned to the features (coefficients in the primal problem). This is only available in the case of a linear kernel. `coef_` is readonly property derived from `dual_coef_` and `support_vectors_`. intercept_ : array, shape = [1] Constants in decision function. """ def __init__(self, k_bucket='exhaustive', method='cv_risk', C=1.0, epsilon=0.1, shrinking=True, tol=1e-3): """ Parameters ---------- k_bucket : KernelBucket or str An instance of KernelBucket that contains all the kernels to be compared, or a string identifying sampling strategy to populate a KernelBucket. method : str Scoring method to rank different kernels C : float, optional (default=1.0) Penalty parameter C of the error term. epsilon : float, optional (default=0.1) Epsilon in the epsilon-SVR model. It specifies the epsilon-tube within which no penalty is associated in the training loss function with points predicted within a distance epsilon from the actual value. shrinking : boolean, optional (default=True) Whether to use the shrinking heuristic. tol : float, optional (default=1e-3) Tolerance for stopping criterion. """ # not init'ing SVC/SVR with kernel='precomputed' to avoid issues with # cross_val_score and safe_split super().__init__(C=C, epsilon=epsilon, shrinking=shrinking, tol=tol) self.k_bucket = k_bucket self.method = method self.C = C self.epsilon = epsilon self.shrinking = shrinking self.tol = tol def _find_optimal_kernel(self): """Method to find the optimal kernel""" self._opt_ker_search_est_name = 'SVR' return find_optimal_kernel(self._k_bucket, self._train_X, self._train_y, method=self.method, estimator_name=self._opt_ker_search_est_name) def get_params(self, deep=True): """returns all the relevant parameters for this estimator!""" return {'k_bucket' : self.k_bucket, 'method' : self.method, 'C' : self.C, 'epsilon' : self.epsilon, 'shrinking': self.shrinking, 'tol' : self.tol} def set_params(self, **parameters): """Param setter""" for parameter, value in parameters.items(): if parameter in ('k_bucket', 'method', 'C', 'epsilon', 'shrinking', 'tol'): setattr(self, parameter, value) return self class OptimalKernelSVC(BaseOptimalKernelMachine, SVC): """ An estimator to learn the optimal kernel for a given sample and build a support vector classifier based on this custom kernel. This class is wrapped around the sklearn SVC estimator to function as its drop-in replacement, whose implementation is in turn based on LIBSVM. Parameters ---------- k_bucket : KernelBucket or str An instance of KernelBucket that contains all the kernels to be compared, or a string identifying the sampling_strategy which populates a KernelBucket. method : str Scoring method to rank different kernels C : float, optional (default=1.0) Penalty parameter C of the error term. tol : float, optional (default=1e-3) Tolerance for stopping criterion. shrinking : boolean, optional (default=True) Whether to use the shrinking heuristic. Attributes ---------- support_ : array-like, shape = [n_SV] Indices of support vectors. support_vectors_ : array-like, shape = [nSV, n_features] Support vectors. dual_coef_ : array, shape = [1, n_SV] Coefficients of the support vector in the decision function. coef_ : array, shape = [1, n_features] Weights assigned to the features (coefficients in the primal problem). This is only available in the case of a linear kernel. `coef_` is readonly property derived from `dual_coef_` and `support_vectors_`. intercept_ : array, shape = [1] Constants in decision function. """ def __init__(self, k_bucket='exhaustive', method='cv_risk', C=1.0, shrinking=True, tol=1e-3): """ SVC classifier trained with the sample-wise optimal kernel Parameters ---------- k_bucket : KernelBucket or str An instance of KernelBucket that contains all the kernels to be compared, or a string identifying sampling strategy to populate a KernelBucket. method : str Scoring method to rank different kernels C : float, optional (default=1.0) Penalty parameter C of the error term. shrinking : boolean, optional (default=True) Whether to use the shrinking heuristic. tol : float, optional (default=1e-3) Tolerance for stopping criterion. """ # not init'ing SVC/SVR with kernel='precomputed' to avoid issues with # cross_val_score and safe_split super().__init__(C=C, shrinking=shrinking, tol=tol) self.k_bucket = k_bucket self.method = method self.C = C self.shrinking = shrinking self.tol = tol def _find_optimal_kernel(self): """Method to find the optimal kernel""" self._opt_ker_search_est_name = 'SVC' return find_optimal_kernel(self._k_bucket, self._train_X, self._train_y, method=self.method, estimator_name=self._opt_ker_search_est_name) def predict(self, X): """ Perform classification on samples in X. For an one-class model, +1 or -1 is returned. Parameters ---------- X : {array-like, sparse matrix}, shape (n_samples, n_features) Returns ------- y_pred : array, shape (n_samples,) Class labels for samples in X. """ predicted_y = super().predict(X) # casting output type to integers return np.asarray(predicted_y, dtype=np.intp) def get_params(self, deep=True): """returns all the relevant parameters for this estimator!""" return {'k_bucket' : self.k_bucket, 'method' : self.method, 'C' : self.C, 'shrinking': self.shrinking, 'tol' : self.tol} def set_params(self, **parameters): """Param setter""" for parameter, value in parameters.items(): if parameter in ('k_bucket', 'method', 'C', 'shrinking', 'tol'): setattr(self, parameter, value) return self
{"hexsha": "20cd02eb193d6753b226abf37bbf5f0b24c81116", "size": 22358, "ext": "py", "lang": "Python", "max_stars_repo_path": "kernelmethods/algorithms.py", "max_stars_repo_name": "vishalbelsare/kernelmethods", "max_stars_repo_head_hexsha": "f49eae7057e6223fe1bae52ca4f308af807fe347", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 43, "max_stars_repo_stars_event_min_datetime": "2019-08-07T21:23:31.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-21T18:12:13.000Z", "max_issues_repo_path": "kernelmethods/algorithms.py", "max_issues_repo_name": "eecheonwu/kernelmethods", "max_issues_repo_head_hexsha": "a52c96faf2bc24d0daae6eefa5314db87d203136", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 6, "max_issues_repo_issues_event_min_datetime": "2020-05-28T16:08:13.000Z", "max_issues_repo_issues_event_max_datetime": "2020-07-15T20:36:36.000Z", "max_forks_repo_path": "kernelmethods/algorithms.py", "max_forks_repo_name": "eecheonwu/kernelmethods", "max_forks_repo_head_hexsha": "a52c96faf2bc24d0daae6eefa5314db87d203136", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 10, "max_forks_repo_forks_event_min_datetime": "2019-08-28T23:28:27.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-05T06:53:20.000Z", "avg_line_length": 31.7134751773, "max_line_length": 85, "alphanum_fraction": 0.607880848, "include": true, "reason": "import numpy", "num_tokens": 4678}
"""Helios Force-Directed Layout using octree References ---------- [1] Fruchterman, T. M. J., & Reingold, E. M. (1991). Graph Drawing by Force-Directed Placement. Software: Practice and Experience, 21(11). [2] Y. Hu, “Efficient, High-Quality Force-Directed Graph Drawing,” The Mathematica Journal, p. 35, 2006. """ import numpy as np import heliosFR from fury.stream.tools import IntervalTimer from helios.layouts.base import NetworkLayoutAsync class HeliosFr(NetworkLayoutAsync): """A 2D/3D Force-directed layout method This method is a wrapper for the helios force-directed algorithm, heliosFR. HeliosFr is a force-directed layout algorithm that is based on oct-trees. The algorithm is designed to work with a large number of nodes and edges. References ---------- [1] Fruchterman, T. M. J., & Reingold, E. M. (1991). Graph Drawing by Force-Directed Placement. Software: Practice and Experience, 21(11). """ def __init__( self, edges, network_draw, viscosity=0.3, a=0.0006, b=1, max_workers=8, update_interval_workers=0, velocities=None ): """ Parameters ---------- edges : ndarray network_draw : NetworkDraw viscosity : float, optional a : float, optional b : float, optional max_workers : int, optional number of threads update_interval_workers : float, optional When you set this to a value greater than zero the helios-fr will wait to perform each step. This can be used to reduce the CPU consumption Attributes ---------- network_draw : NetworkDraw The NetworkDraw Instance """ self._started = False self._network_draw = network_draw self._interval_timer = None self._nodes_count = network_draw.positions.shape[0] self._update_interval_workers = update_interval_workers self._positions = np.ascontiguousarray( network_draw.positions, dtype=np.float32) self._edges = np.ascontiguousarray(edges, dtype=np.uint64) if velocities is None: velocities = np.zeros((self._nodes_count, 3), dtype=np.float32) self._layout = heliosFR.FRLayout( self._edges, self._positions, velocities, a, b, viscosity, maxWorkers=max_workers, updateInterval=self._update_interval_workers) def start(self, ms=15): """Starts the helios force-directed layout using others threads (async). Parameters ---------- ms : float, optional Interval in milleseconds to update the node and edge positions in the network visualization. """ if self._started: return self._layout.start() self._started = True if ms > 0: if ms < self._update_interval_workers: ms = self._update_interval_workers self._interval_timer = IntervalTimer( ms/1000, self.update) def stop(self): """This will stop the threads running the helios force-directed algorithm """ if not self._started: return if self._interval_timer is not None: self._interval_timer.stop() self._interval_timer = None self._layout.stop() self._started = False def steps(self, iterations): """A Sync version of the helios force-directed algorithm. Parameters ---------- iterations : int """ self._layout.iterate(iterations=iterations) self.update()
{"hexsha": "5dcd43607dc6cfb7bf8d5387192594bf7b0a3d3b", "size": 3734, "ext": "py", "lang": "Python", "max_stars_repo_path": "helios/layouts/force_directed.py", "max_stars_repo_name": "fury-gl/helios", "max_stars_repo_head_hexsha": "14e39e0350b4b9666775ba0c4840d2e9887678c2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2021-10-13T14:38:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-10-16T19:40:14.000Z", "max_issues_repo_path": "helios/layouts/force_directed.py", "max_issues_repo_name": "fury-gl/helios", "max_issues_repo_head_hexsha": "14e39e0350b4b9666775ba0c4840d2e9887678c2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 14, "max_issues_repo_issues_event_min_datetime": "2021-07-04T19:00:57.000Z", "max_issues_repo_issues_event_max_datetime": "2021-10-16T18:35:45.000Z", "max_forks_repo_path": "helios/layouts/force_directed.py", "max_forks_repo_name": "fury-gl/helios", "max_forks_repo_head_hexsha": "14e39e0350b4b9666775ba0c4840d2e9887678c2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2021-06-06T14:43:59.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-17T19:03:54.000Z", "avg_line_length": 28.7230769231, "max_line_length": 80, "alphanum_fraction": 0.6106052491, "include": true, "reason": "import numpy", "num_tokens": 827}
import numpy as np, pandas as pd from scipy import stats """ Notes on Analysis: - we have mean, se, & worst on radius, texture, perimeter, area, smoothness, compactness, concavity, concave points, symmetry, fractal dimensions 1st preprocessing: normalize each columns using z-score """ print("Import data") df = pd.read_csv("data.csv") print("get z-score for each") new_data = { 'id': df['id'], 'diagnosis': df['diagnosis'] } print("create new attributes by z-score") features = set(df.columns.to_list()) - set(["id", "diagnosis"]) for f in features: zscores = stats.zscore(df[f]) new_data[f] = np.array(zscores > 0, dtype=int) print("export processed data") ndf = pd.DataFrame.from_dict(new_data) ndf.to_csv("p_data.csv", index=False)
{"hexsha": "0da2013ae98f721642c9b166bc24b9b3e83bef63", "size": 750, "ext": "py", "lang": "Python", "max_stars_repo_path": "preprocessing.py", "max_stars_repo_name": "jayliu99/bcbn", "max_stars_repo_head_hexsha": "6ec0977299c66c224877ec953b64d34f9b74c6f6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "preprocessing.py", "max_issues_repo_name": "jayliu99/bcbn", "max_issues_repo_head_hexsha": "6ec0977299c66c224877ec953b64d34f9b74c6f6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "preprocessing.py", "max_forks_repo_name": "jayliu99/bcbn", "max_forks_repo_head_hexsha": "6ec0977299c66c224877ec953b64d34f9b74c6f6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.4375, "max_line_length": 89, "alphanum_fraction": 0.7093333333, "include": true, "reason": "import numpy,from scipy", "num_tokens": 196}
import cv2 import time import numpy as np import pose_module as pm import pandas as pd import matplotlib.pyplot as plt import seaborn as sns class Video: def __init__(self, video_path: str): """ :param video_path: path of video to analyse Object video has poseDetector inner or nested class, and a dataframe as attribute. """ self.df_results = pd.DataFrame() self.video = video_path def run_analysis(self, show_video=True, track_angles=None, track_heights=None, waitkey=120, export=False): """ :param show_video: (boolean) if True (def) shows video :param plot: (boolean) if True (def) plots scatterplot of [track_angle] :param track_angle: (ls) list of body joint to track angle of. :param track_heights: (ls) list of body joint to track heights of. :return: video and dataframe. """ self.track_angles = track_angles self.track_heights = track_heights # Create detector instance: self.detector = pm.poseDetector() valid_body_string = self.detector.pose_lm_dict.keys() if self.track_angles is None: self.track_angles = ['right_knee', 'right_elbow'] if self.track_heights is None: self.track_heights = ['right_foot', 'right_shoulder'] # add columns to df_results for i in self.track_angles: self.df_results[f'{i}_angle'] = np.NAN for j in self.track_heights: self.df_results[f'{j}_height'] = np.NAN # Create video capture object: """for pc devices add number, for ex web cam real time video = 0""" cap = cv2.VideoCapture(self.video) pTime = 0 while cap.isOpened(): """ isOpened() method returns a boolean that indicates whether or not the video stream is valid""" frame, img = cap.read() """.read() method returns a tuple, where the first element is a boolean and the next element is the actual video frame. When the first element is True, it indicates the video stream contains a frame to read.""" if frame: img = self.detector.find_pose(img) # List landmark positions lmlist = self.detector.find_position(img) # calculates frames by second (fps) cTime = time.time() fps = 1 / (cTime - pTime) pTime = cTime # ptime = 0 antes del while # draws fps on image: cv2.putText(img, str(int(fps)), (70, 50), cv2.FONT_HERSHEY_SIMPLEX, 3, (255, 0, 0), 3) frame_row = {} if len(lmlist) != 0: for a in self.track_angles: if a not in valid_body_string: raise Exception( f"Body part not added to code analysis! Only can use one of {valid_body_string}") id_angle = self.detector.pose_lm_dict[a] angle_value = self.detector.find_angle(img, (id_angle - 2), id_angle, (id_angle + 2)) frame_row[f'{a}_angle'] = angle_value # add to results foot and shoulders heights log (in lmlist[id][2] 2 is for cy) : for h in self.track_heights: if h not in valid_body_string: raise Exception( f'Body part not added to code analysis! Only can use one of {valid_body_string}') id_height = self.detector.pose_lm_dict[h] height_value = self.detector.lmlist[id_height][2] frame_row[f'{h}_height'] = height_value # print(frame_row) self.df_results = self.df_results.append(frame_row, ignore_index=True) if show_video: cv2.imshow("image", img) cv2.waitKey(waitkey) # todo: Nice to have stick guy replicating image's human movement # detector.create_landmark_graph() # exit code by pressing "q" key: if cv2.waitKey(1) & 0xFF == ord('q'): break else: # else == if frame is false --> terminates video if export: self.df_results.to_csv('outputs/df_results.csv', index=False) print('Results Dataframe exported as csv file') print("Run Analysis Finished.") return self.df_results # Release the video capture object: "Closes video file or capturing device." cap.release() # destroy all windows at any time. It doesn’t take any parameters and doesn’t return anything. cv2.destroyAllWindows() def plot_df_results(self, export = False): """ Plot results from appended DataFrame :param export: if True, save fig as png to current folder :return: plots """ df = pd.melt(self.df_results, value_vars=self.df_results.columns,ignore_index=False).rename(columns={"variable":'type'}) plt.figure(figsize=(20,20)) #todo:add second y axis (separate angles and heights) sns.scatterplot(data=df, x=df.index, y='value', hue="type") plt.xlabel('Video Frames') plt.ylabel('Values [mixed heights and angles]') if export: plt.savefig('outputs/video_analysis_plots.png') plt.show()
{"hexsha": "9141e205a6eb77b5cdd6e57a3483746e5abeca4f", "size": 5588, "ext": "py", "lang": "Python", "max_stars_repo_path": "video_pose.py", "max_stars_repo_name": "lucamagnasco/human_pose_test", "max_stars_repo_head_hexsha": "c2041fa35f9150c262e91b4b1fc342f53518d4e9", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2022-03-02T22:33:17.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-02T22:33:17.000Z", "max_issues_repo_path": "video_pose.py", "max_issues_repo_name": "lucamagnasco/human_pose_test", "max_issues_repo_head_hexsha": "c2041fa35f9150c262e91b4b1fc342f53518d4e9", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "video_pose.py", "max_forks_repo_name": "lucamagnasco/human_pose_test", "max_forks_repo_head_hexsha": "c2041fa35f9150c262e91b4b1fc342f53518d4e9", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 42.6564885496, "max_line_length": 132, "alphanum_fraction": 0.5706871868, "include": true, "reason": "import numpy", "num_tokens": 1182}
module Mod_TempeDriver use typre use MPI use Mod_BroadCastBuffer use Mod_Listen use Mod_caseVariables use Mod_PhysicalProblemDriver use Mod_PhysicalProblem use Mod_DistributedContainer use Mod_DC_ip use Mod_DC_rp use Mod_InChannel use Mod_MasterVariables use Mod_Temperature implicit none private public :: TempeDriver, TempeDriver_Const type, extends(DriverInterface) :: tempeDriver type(TemperatureProblem) :: TempeProblem !Couplings type(InChannelGroupInfo) :: InNstincInfo real(rp) :: acden,acsph,actco contains procedure :: Lev1Reapro => tempe_Lev1Reapro procedure :: Lev1ReaproMPI => tempe_Lev1ReaproMPI procedure :: SetOutChannels => tempe_SetOutChannels procedure :: SetInChannels => tempe_SetInChannels procedure :: UpdateChannels => tempe_UpdateChannels procedure :: Turnon => tempe_Turnon procedure :: GetTimeStep => tempe_GetTimeStep procedure :: SetTimeStep => tempe_SetTimeStep procedure :: GetRefinementCriteria => tempe_GetRefinementCriteria procedure :: PreRefine => tempe_PreRefine procedure :: Refine => tempe_Refine procedure :: Rebalance => tempe_Rebalance procedure :: Begste => tempe_Begste procedure :: MeshProjections => tempe_MeshProjections procedure :: MeshAdvections => tempe_MeshAdvections procedure :: Doiter => tempe_Doiter procedure :: Convergence => tempe_Convergence procedure :: Endste => tempe_Endste procedure :: Output => tempe_Output procedure :: Turnof => tempe_Turnof procedure :: WriteTimes => tempe_WriteTimes procedure :: GetPhysicalProblem => tempe_GetPhysicalProblem end type TempeDriver interface TempeDriver_Const procedure constructor end interface contains function constructor() class(TempeDriver), pointer :: constructor allocate(constructor) end function constructor subroutine tempe_Lev1Reapro(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c type(BroadCastBuffer) :: bb !Things that we want from outside if(a%Listener%words(1)=='EXTER') then if(a%Listener%words(2) == 'NSTIN') then call InChannelGroupInfoFromListener(a%Listener,a%InNstincInfo) endif end if end subroutine subroutine tempe_Lev1ReaproMPI(a,c,bb) class(TempeDriver) :: a type(caseVariables) :: c type(BroadCastBuffer) :: bb call InChannelGroupInfoAddToBuffer(a%InNstincInfo,bb) end subroutine subroutine tempe_SetOutChannels(a,task) class(tempeDriver) :: a character(*) :: task class(DistributedContainer), pointer :: myDC => NULL() type(InChannel), pointer :: myInChannel => NULL() real(rp), pointer :: tempe(:) => NULL() type(r2p), pointer :: tesgs(:) => NULL() real(rp) :: acden, acsph , actco , acrea , acsou real(rp), pointer :: dissipation(:) => NULL() !----------------------------------------------------------- !First the OutChannels !Temperature call a%TempeProblem%GetTemperatureArray(tempe) call RPToList(tempe,'TEMPE',task,a%OutChannelList) !Temperature Subgrid Scales call a%TempeProblem%GetTemperatureSGS(tesgs) if(associated(tesgs)) call RPToList(tesgs,'TEMPE_SGS',task,a%OutChannelList) call a%TempeProblem%GetPhysicalParameters(1,a%acden,a%acsph,a%actco,acrea,acsou) call RPToList(a%acden,'DENSITY',task,a%OutChannelList) call RPToList(a%acsph,'SPECIFIC_HEAT',task,a%OutChannelList) call RPToList(a%actco,'THERMAL_CONDUCTIVITY',task,a%OutChannelList) !TempeDissipation call a%TempeProblem%GetDissipationArray(Dissipation) if(associated(Dissipation)) call RPToList(Dissipation,'DISSIPATION',task,a%OutChannelList) end subroutine subroutine tempe_SetInChannels(a) class(TempeDriver) :: a !-------------------------------------------------------- !Secondly the InChannels !Veloc info to channel list if (a%InNstincInfo%IsOn) then call a%AddToInChannelList('VELOC','VELOC','INTERPOLABLE',a%InNstincInfo) if (a%TempeProblem%kfl_CouplingThreeField==1) call a%AddToInChannelList('SIGMA','SIGMA','INTERPOLABLE',a%InNstincInfo) call a%AddToInChannelList('VELOC_SGS','VELOC_SGS','SKIP_IF_INTERPOLATE',a%InNstincInfo,'OPTIONAL') endif end subroutine subroutine tempe_UpdateChannels(a) implicit none class(tempeDriver) :: a class(DistributedContainer), pointer :: myDC => NULL() real(rp), pointer :: veloc(:,:) => NULL() type(r3p), pointer :: vesgs(:) => NULL() real(rp), pointer :: sigma(:,:) => NULL() integer(ip), pointer :: kfl_trasg => NULL() if (a%InNstincInfo%IsOn) then call a%GetFromInChannelList('VELOC',myDC) call ExtractRP(myDC,veloc) call a%TempeProblem%SetVelocityArray(veloc) if (a%TempeProblem%kfl_CouplingThreeField==1) then call a%GetFromInChannelList('SIGMA',myDC) call ExtractRP(myDC,sigma) if (associated(sigma)) call a%TempeProblem%SetSigmaNSArray(sigma) endif call a%GetFromInChannelList('VELOC_SGS',myDC) call ExtractRP(myDC,vesgs) if (associated(vesgs)) call a%TempeProblem%SetVelocitySGS(vesgs) endif end subroutine subroutine tempe_Turnon(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_Turnon(a,c,a%TempeProblem) end subroutine subroutine tempe_GetTimeStep(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_GetTimeStep(a,c,a%TempeProblem) end subroutine tempe_GetTimeStep subroutine tempe_SetTimeStep(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_SetTimeStep(a,c,a%TempeProblem) end subroutine tempe_SetTimeStep subroutine tempe_GetRefinementCriteria(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_GetRefinementCriteria(a,c,a%TempeProblem) end subroutine tempe_GetRefinementCriteria subroutine tempe_PreRefine(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_PreRefine(a,c,a%TempeProblem) end subroutine tempe_PreRefine subroutine tempe_Refine(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_Refine(a,c,a%TempeProblem) end subroutine tempe_Refine subroutine tempe_Rebalance(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_Rebalance(a,c,a%TempeProblem) end subroutine tempe_Rebalance subroutine tempe_Begste(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_Begste(a,c,a%TempeProblem) end subroutine tempe_Begste subroutine tempe_MeshAdvections(a,c,itask) implicit none class(TempeDriver) :: a type(caseVariables) :: c integer(ip) :: itask !PhysicalProblem operations call physical_MeshAdvections(a,c,a%TempeProblem,itask) end subroutine tempe_MeshAdvections subroutine tempe_MeshProjections(a,c,itask) implicit none class(TempeDriver) :: a type(caseVariables) :: c integer(ip) :: itask !PhysicalProblem operations call physical_MeshProjections(a,c,a%TempeProblem,itask) end subroutine tempe_MeshProjections subroutine tempe_Doiter(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_Doiter(a,c,a%TempeProblem) end subroutine tempe_Doiter subroutine tempe_Convergence(a,c,glres) implicit none class(TempeDriver) :: a type(caseVariables) :: c real(rp) :: glres !PhysicalProblem operations call physical_Convergence(a,c,a%TempeProblem,glres) end subroutine tempe_Convergence subroutine tempe_Endste(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_Endste(a,c,a%TempeProblem) end subroutine tempe_Endste subroutine tempe_Output(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_Output(a,c,a%TempeProblem) end subroutine tempe_Output subroutine tempe_Turnof(a,c) implicit none class(TempeDriver) :: a type(caseVariables) :: c !PhysicalProblem operations call physical_Turnof(a,c,a%TempeProblem) end subroutine tempe_Turnof subroutine tempe_WriteTimes(a) implicit none class(TempeDriver) :: a !PhysicalProblem operations call physical_WriteTimes(a,a%TempeProblem) end subroutine tempe_WriteTimes subroutine tempe_GetPhysicalProblem(a,PhysicalPro) implicit none class(TempeDriver), target :: a class(PhysicalProblem), pointer :: PhysicalPro PhysicalPro => a%TempeProblem end subroutine end module
{"hexsha": "015108b48aff4c029ffa0b442d5b3f3ed7de235b", "size": 10185, "ext": "f90", "lang": "FORTRAN", "max_stars_repo_path": "Sources/master/Drivers/PhysicalProblems/Mod_TempeDriver.f90", "max_stars_repo_name": "ciaid-colombia/InsFEM", "max_stars_repo_head_hexsha": "be7eb35baa75c31e3b175e95286549ccd84f8d40", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-11-24T08:19:54.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-24T08:19:54.000Z", "max_issues_repo_path": "Sources/master/Drivers/PhysicalProblems/Mod_TempeDriver.f90", "max_issues_repo_name": "ciaid-colombia/InsFEM", "max_issues_repo_head_hexsha": "be7eb35baa75c31e3b175e95286549ccd84f8d40", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Sources/master/Drivers/PhysicalProblems/Mod_TempeDriver.f90", "max_forks_repo_name": "ciaid-colombia/InsFEM", "max_forks_repo_head_hexsha": "be7eb35baa75c31e3b175e95286549ccd84f8d40", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.6075581395, "max_line_length": 127, "alphanum_fraction": 0.6378006873, "num_tokens": 2592}
function decompose(_dataset::AbstractVTKStructuredData, target::String = "Faces", decompose_cell_data = false) dataset = VTKStructuredData(_dataset) _dim = dim(dataset) if decompose_cell_data if target == "Faces" if _dim == 2 return decompose_to_faces_2d_with_cell_data(dataset) elseif _dim == 3 return decompose_to_faces_3d_with_cell_data(dataset) else throw("Unsupported dimension.") end elseif target == "Lines" if _dim == 2 return decompose_to_lines_2d_with_cell_data(dataset) elseif _dim == 3 return decompose_to_lines_3d_with_cell_data(dataset) else throw("Unsupported dimension.") end else throw("Unsupported target.") end else if target == "Faces" if _dim == 2 return decompose_to_faces_2d_no_cell_data(dataset) elseif _dim == 3 return decompose_to_faces_3d_no_cell_data(dataset) else throw("Unsupported dimension.") end elseif target == "Lines" if _dim == 2 return decompose_to_lines_2d_no_cell_data(dataset) elseif _dim == 3 return decompose_to_lines_3d_no_cell_data(dataset) else throw("Unsupported dimension.") end else throw("Unsupported target.") end end end function decompose_to_faces_2d_with_cell_data(dataset::VTKStructuredData) cextents = cell_extents(dataset) _num_of_points = num_of_points(dataset) _num_of_cells = num_of_cells(dataset) _dim = dim(dataset) point_coords = reshape(dataset.point_coords, (_dim, _num_of_points)) point_data = empty(dataset.point_data) for m in keys(dataset.point_data) _var_dim = var_dim(dataset, m, "Point") if _var_dim == 1 point_data[m] = reshape(dataset.point_data[m], (_num_of_points,)) else point_data[m] = reshape(dataset.point_data[m], (_var_dim, _num_of_points)) end end _cell_data = empty(dataset.cell_data) faces = Vector{Int}[] _cell_types = fill(9, _num_of_cells) for cind in Iterators.product(1:cextents[1], 1:cextents[2]) push!(faces, cell_connectivity(dataset, cind)) end for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 _cell_data[m] = reshape(dataset.cell_data[m], (_num_of_cells,)) else _cell_data[m] = reshape(dataset.cell_data[m], (_var_dim, _num_of_cells)) end end return VTKPolyData(point_coords, _cell_types, faces, point_data, _cell_data) end function decompose_to_faces_3d_with_cell_data(dataset::VTKStructuredData) cextents = cell_extents(dataset) _num_of_points = num_of_points(dataset) _dim = dim(dataset) point_coords = reshape(dataset.point_coords, (_dim, _num_of_points)) point_data = empty(dataset.point_data) for m in keys(dataset.point_data) _var_dim = var_dim(dataset, m, "Point") if _var_dim == 1 point_data[m] = reshape(dataset.point_data[m], (_num_of_points,)) else point_data[m] = reshape(dataset.point_data[m], (_var_dim, _num_of_points)) end end _cell_data = empty(dataset.cell_data) faces = Vector{Int}[] for m in keys(dataset.cell_data) _cell_data[m] = Float64[] end for cind in Iterators.product(1:cextents[1], 1:cextents[2], 1:cextents[3]) hexa_cc = cell_connectivity(dataset, cind) push!(faces, [hexa_cc[1], hexa_cc[2], hexa_cc[3], hexa_cc[4]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[3] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1:2]...,cind[3]-1]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[3] != 1 _cd = (dataset.cell_data[m][:, cind...] + dataset.cell_data[m][:, cind[1:2]...,cind[3]-1]) / 2 else _cd = dataset.cell_data[m][:, cind...] end append!(_cell_data[m], _cd) end end push!(faces, [hexa_cc[1], hexa_cc[2], hexa_cc[6], hexa_cc[5]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[2] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1],cind[2]-1,cind[3]]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[3] != 1 _cd = (dataset.cell_data[m][:, cind...] + dataset.cell_data[m][:, cind[1],cind[2]-1,cind[3]]) / 2 else _cd = dataset.cell_data[m][:, cind...] end append!(_cell_data[m], _cd) end end push!(faces, [hexa_cc[4], hexa_cc[1], hexa_cc[5], hexa_cc[8]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[1] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1]-1,cind[2:3]...]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[3] != 1 _cd = (dataset.cell_data[m][:, cind...] + dataset.cell_data[m][:, cind[1]-1,cind[2:3]...]) / 2 else _cd = dataset.cell_data[m][:, cind...] end append!(_cell_data[m], _cd) end end if cind[1] == cextents[1] push!(faces, [hexa_cc[2], hexa_cc[3], hexa_cc[7], hexa_cc[6]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 _cd = dataset.cell_data[m][cind...] push!(_cell_data[m], _cd) else _cd = dataset.cell_data[m][:, cind...] append!(_cell_data[m], _cd) end end end if cind[2] == cextents[2] push!(faces, [hexa_cc[4], hexa_cc[3], hexa_cc[7], hexa_cc[8]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 _cd = dataset.cell_data[m][cind...] push!(_cell_data[m], _cd) else _cd = dataset.cell_data[m][:, cind...] append!(_cell_data[m], _cd) end end end if cind[3] == cextents[3] push!(faces, [hexa_cc[5], hexa_cc[6], hexa_cc[7], hexa_cc[8]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 _cd = dataset.cell_data[m][cind...] push!(_cell_data[m], _cd) else _cd = dataset.cell_data[m][:, cind...] append!(_cell_data[m], _cd) end end end end _cell_types = fill(9, length(faces)) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 _cell_data[m] = reshape(_cell_data[m], (length(faces),)) else _cell_data[m] = reshape(_cell_data[m], (_var_dim, length(faces))) end end return VTKPolyData(point_coords, _cell_types, faces, point_data, _cell_data) end function decompose_to_lines_2d_with_cell_data(dataset::VTKStructuredData) cextents = cell_extents(dataset) _num_of_points = num_of_points(dataset) point_coords = reshape(dataset.point_coords, (_dim, _num_of_points)) point_data = empty(dataset.point_data) for m in keys(dataset.point_data) _var_dim = var_dim(dataset, m, "Point") if _var_dim == 1 point_data[m] = reshape(dataset.point_data[m], (_num_of_points,)) else point_data[m] = reshape(dataset.point_data[m], (_var_dim, _num_of_points)) end end _cell_data = empty(dataset.cell_data) lines = Vector{Int}[] for m in keys(dataset.cell_data) _cell_data[m] = Float64[] end for cind in Iterators.product(1:cextents[1], 1:cextents[2]) quad_cc = cell_connectivity(dataset, cind) push!(lines, [quad_cc[1], quad_cc[2]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[2] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1], cind[2]-1]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[2] != 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1],cind[2]-1]) / 2 else _cd = dataset.cell_data[m][:,cind...] end append!(_cell_data[m], _cd) end end push!(lines, [quad_cc[1], quad_cc[4]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[1] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1]-1, cind[2]]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[1] != 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1]-1,cind[2]]) / 2 else _cd = dataset.cell_data[m][:,cind...] end append!(_cell_data[m], _cd) end end if cind[1] == cextents[1] push!(lines, [quad_cc[2], quad_cc[3]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 _cd = dataset.cell_data[m][cind...] push!(_cell_data[m], _cd) else _cd = dataset.cell_data[m][:,cind...] append!(_cell_data[m], _cd) end end end if cind[2] == cextents[2] push!(lines, [quad_cc[3], quad_cc[4]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 _cd = dataset.cell_data[m][cind...] push!(_cell_data[m], _cd) else _cd = dataset.cell_data[m][:,cind...] append!(_cell_data[m], _cd) end end end _cell_types = fill(3, length(lines)) end for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 _cell_data[m] = reshape(dataset.cell_data[m], (length(lines),)) else _cell_data[m] = reshape(dataset.cell_data[m], (_var_dim, length(lines))) end end return VTKPolyData(point_coords, _cell_types, lines, point_data, _cell_data) end function decompose_to_lines_3d_with_cell_data(dataset::VTKStructuredData) cextents = cell_extents(dataset) _num_of_points = num_of_points(dataset) point_coords = reshape(dataset.point_coords, (_dim, _num_of_points)) point_data = empty(dataset.point_data) for m in keys(dataset.point_data) _var_dim = var_dim(dataset, m, "Point") if _var_dim == 1 point_data[m] = reshape(dataset.point_data[m], (_num_of_points,)) else point_data[m] = reshape(dataset.point_data[m], (_var_dim, _num_of_points)) end end _cell_data = empty(dataset.cell_data) lines = Vector{Int}[] for m in keys(dataset.cell_data) _cell_data[m] = Float64[] end for cind in Iterators.product(1:cextents[1], 1:cextents[2], 1:cextents[3]) hexa_cc = cell_connectivity(dataset, cind) push!(lines, [hexa_cc[1], hexa_cc[2]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[2] != 1 && cind[3] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1:2]...,cind[3]-1] + dataset.cell_data[m][cind[1],cind[2]-1,cind[3]] + dataset.cell_data[m][cind[1],cind[2]-1,cind[3]-1]) / 4 elseif cind[2] == 1 && cind[3] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1:2]...,cind[3]-1]) / 2 elseif cind[2] != 1 && cind[3] == 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1], cind[2]-1,cind[3]]) / 2 elseif cind[2] == cind[3] == 1 _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[2] != 1 && cind[3] != 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1:2]...,cind[3]-1] + dataset.cell_data[m][:,cind[1],cind[2]-1,cind[3]] + dataset.cell_data[m][:,cind[1],cind[2]-1,cind[3]-1]) / 4 elseif cind[2] == 1 && cind[3] != 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1:2]...,cind[3]-1]) / 2 elseif cind[2] != 1 && cind[3] == 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1], cind[2]-1,cind[3]]) / 2 elseif cind[2] == cind[3] == 1 _cd = dataset.cell_data[m][:,cind...] end append!(_cell_data[m], _cd) end end push!(lines, [hexa_cc[1], hexa_cc[4]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[1] != 1 && cind[3] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1:2]...,cind[3]-1] + dataset.cell_data[m][cind[1]-1,cind[2],cind[3]] + dataset.cell_data[m][cind[1]-1,cind[2],cind[3]-1]) / 4 elseif cind[1] == 1 && cind[3] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1:2]...,cind[3]-1]) / 2 elseif cind[1] != 1 && cind[3] == 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1]-1, cind[2],cind[3]]) / 2 elseif cind[1] == cind[3] == 1 _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[1] != 1 && cind[3] != 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1:2]...,cind[3]-1] + dataset.cell_data[m][:,cind[1]-1,cind[2],cind[3]] + dataset.cell_data[m][:,cind[1]-1,cind[2],cind[3]-1]) / 4 elseif cind[1] == 1 && cind[3] != 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1:2]...,cind[3]-1]) / 2 elseif cind[1] != 1 && cind[3] == 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1]-1, cind[2],cind[3]]) / 2 elseif cind[1] == cind[3] == 1 _cd = dataset.cell_data[m][:,cind...] end append!(_cell_data[m], _cd) end end push!(lines, [hexa_cc[1], hexa_cc[5]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[1] != 1 && cind[2] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1]-1,cind[2:3]...] + dataset.cell_data[m][cind[1],cind[2]-1,cind[3]] + dataset.cell_data[m][cind[1]-1,cind[2]-1,cind[3]]) / 4 elseif cind[1] == 1 && cind[2] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1],cind[2]-1,cind[3]]) / 2 elseif cind[1] != 1 && cind[2] == 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1]-1,cind[2],cind[3]]) / 2 elseif cind[1] == cind[2] == 1 _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[1] != 1 && cind[2] != 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1]-1,cind[2:3]...] + dataset.cell_data[m][:,cind[1],cind[2]-1,cind[3]] + dataset.cell_data[m][:,cind[1]-1,cind[2]-1,cind[3]]) / 4 elseif cind[1] == 1 && cind[2] != 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1],cind[2]-1,cind[3]]) / 2 elseif cind[1] != 1 && cind[2] == 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1]-1,cind[2],cind[3]]) / 2 elseif cind[1] == cind[2] == 1 _cd = dataset.cell_data[m][:,cind...] end append!(_cell_data[m], _cd) end end if cind[1] == cextents[1] push!(lines, [hexa_cc[2], hexa_cc[3]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[3] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1:2]..., cind[3]-1]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[3] != 1 _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1:2]...,cind[3]-1]) / 2 else _cd = dataset.cell_data[m][:,cind...] end append!(_cell_data[m], _cd) end end push!(lines, [hexa_cc[3], hexa_cc[7]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[2] != cextents[2] _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1], cind[2]+1, cind[3]]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[2] != cextents[2] _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1],cind[2]+1,cind[3]]) / 2 else _cd = dataset.cell_data[m][:,cind...] end append!(_cell_data[m], _cd) end end push!(lines, [hexa_cc[6], hexa_cc[7]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[3] != cextents[3] _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1:2]..., cind[3]+1]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[3] != cextents[3] _cd = (dataset.cell_data[m][:,cind...] + dataset.cell_data[m][:,cind[1:2]...,cind[3]+1]) / 2 else _cd = dataset.cell_data[m][:,cind...] end append!(_cell_data[m], _cd) end end push!(lines, [hexa_cc[2], hexa_cc[6]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[2] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1], cind[2]-1, cind[3]]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[2] != 1 _cd = (dataset.cell_data[m][:, cind...] + dataset.cell_data[m][:, cind[1], cind[2]-1, cind[3]]) / 2 else _cd = dataset.cell_data[m][:, cind...] end append!(_cell_data[m], _cd) end end end if cind[2] == cextents[2] push!(lines, [hexa_cc[3], hexa_cc[4]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[3] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1:2]..., cind[3]-1]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[3] != 1 _cd = (dataset.cell_data[m][:, cind...] + dataset.cell_data[m][:, cind[1:2]..., cind[3]-1]) / 2 else _cd = dataset.cell_data[m][:, cind...] end append!(_cell_data[m], _cd) end end push!(lines, [hexa_cc[7], hexa_cc[8]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[3] != cextents[3] _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1:2]..., cind[3]+1]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[3] != cextents[3] _cd = (dataset.cell_data[m][:, cind...] + dataset.cell_data[m][:, cind[1:2]..., cind[3]+1]) / 2 else _cd = dataset.cell_data[m][:, cind...] end append!(_cell_data[m], _cd) end end push!(lines, [hexa_cc[4], hexa_cc[8]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[1] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1]-1, cind[2:3]...]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[1] != 1 _cd = (dataset.cell_data[m][:, cind...] + dataset.cell_data[m][:, cind[1]-1, cind[2:3]...]) / 2 else _cd = dataset.cell_data[m][:, cind...] end append!(_cell_data[m], _cd) end end end if cind[3] == cextents[3] push!(lines, [hexa_cc[5], hexa_cc[8]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[1] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1]-1, cind[2:3]...]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[1] != 1 _cd = (dataset.cell_data[m][:, cind...] + dataset.cell_data[m][:, cind[1]-1, cind[2:3]...]) / 2 else _cd = dataset.cell_data[m][:, cind...] end append!(_cell_data[m], _cd) end end push!(lines, [hexa_cc[5], hexa_cc[6]]) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 if cind[2] != 1 _cd = (dataset.cell_data[m][cind...] + dataset.cell_data[m][cind[1], cind[2]-1, cind[3]]) / 2 else _cd = dataset.cell_data[m][cind...] end push!(_cell_data[m], _cd) else if cind[2] != 1 _cd = (dataset.cell_data[m][:, cind...] + dataset.cell_data[m][:, cind[1], cind[2]-1, cind[3]]) / 2 else _cd = dataset.cell_data[m][:, cind...] end append!(_cell_data[m], _cd) end end end end _cell_types = fill(3, length(lines)) for m in keys(dataset.cell_data) _var_dim = var_dim(dataset, m, "Cell") if _var_dim == 1 _cell_data[m] = reshape(dataset.cell_data[m], (length(lines),)) else _cell_data[m] = reshape(dataset.cell_data[m], (_var_dim, length(lines))) end end return VTKPolyData(point_coords, _cell_types, lines, point_data, _cell_data) end function decompose_to_faces_2d_no_cell_data(dataset::VTKStructuredData) cextents = cell_extents(dataset) _num_of_points = num_of_points(dataset) _num_of_cells = num_of_cells(dataset) _dim = dim(dataset) point_coords = reshape(dataset.point_coords, (_dim, _num_of_points)) point_data = empty(dataset.point_data) for m in keys(dataset.point_data) _var_dim = var_dim(dataset, m, "Point") if _var_dim == 1 point_data[m] = reshape(dataset.point_data[m], (_num_of_points,)) else point_data[m] = reshape(dataset.point_data[m], (_var_dim, _num_of_points)) end end _cell_data = empty(dataset.cell_data) faces = Vector{Int}[] _cell_types = fill(9, _num_of_cells) for cind in Iterators.product(1:cextents[1], 1:cextents[2]) push!(faces, cell_connectivity(dataset, cind)) end return VTKPolyData(point_coords, _cell_types, faces, point_data, _cell_data) end function decompose_to_faces_3d_no_cell_data(dataset::VTKStructuredData) cextents = cell_extents(dataset) _num_of_points = num_of_points(dataset) _dim = dim(dataset) point_coords = reshape(dataset.point_coords, (_dim, _num_of_points)) point_data = empty(dataset.point_data) for m in keys(dataset.point_data) _var_dim = var_dim(dataset, m, "Point") if _var_dim == 1 point_data[m] = reshape(dataset.point_data[m], (_num_of_points,)) else point_data[m] = reshape(dataset.point_data[m], (_var_dim, _num_of_points)) end end _cell_data = empty(dataset.cell_data) faces = Vector{Int}[] for cind in Iterators.product(1:cextents[1], 1:cextents[2], 1:cextents[3]) hexa_cc = cell_connectivity(dataset, cind) push!(faces, [hexa_cc[1], hexa_cc[2], hexa_cc[3], hexa_cc[4]]) push!(faces, [hexa_cc[1], hexa_cc[2], hexa_cc[6], hexa_cc[5]]) push!(faces, [hexa_cc[4], hexa_cc[1], hexa_cc[5], hexa_cc[8]]) if cind[1] == cextents[1] push!(faces, [hexa_cc[2], hexa_cc[3], hexa_cc[7], hexa_cc[6]]) end if cind[2] == cextents[2] push!(faces, [hexa_cc[4], hexa_cc[3], hexa_cc[7], hexa_cc[8]]) end if cind[3] == cextents[3] push!(faces, [hexa_cc[5], hexa_cc[6], hexa_cc[7], hexa_cc[8]]) end end _cell_types = fill(9, length(faces)) return VTKPolyData(point_coords, _cell_types, faces, point_data, _cell_data) end function decompose_to_lines_2d_no_cell_data(dataset::VTKStructuredData) cextents = cell_extents(dataset) _num_of_points = num_of_points(dataset) point_coords = reshape(dataset.point_coords, (_dim, _num_of_points)) point_data = empty(dataset.point_data) for m in keys(dataset.point_data) _var_dim = var_dim(dataset, m, "Point") if _var_dim == 1 point_data[m] = reshape(dataset.point_data[m], (_num_of_points,)) else point_data[m] = reshape(dataset.point_data[m], (_var_dim, _num_of_points)) end end _cell_data = empty(dataset.cell_data) lines = Vector{Int}[] for cind in Iterators.product(1:cextents[1], 1:cextents[2]) quad_cc = cell_connectivity(dataset, cind) push!(lines, [quad_cc[1], quad_cc[2]]) push!(lines, [quad_cc[1], quad_cc[4]]) if cind[1] == cextents[1] push!(lines, [quad_cc[2], quad_cc[3]]) end if cind[2] == cextents[2] push!(lines, [quad_cc[3], quad_cc[4]]) end _cell_types = fill(3, length(lines)) end return VTKPolyData(point_coords, _cell_types, lines, point_data, _cell_data) end function decompose_to_lines_3d_no_cell_data(dataset::VTKStructuredData) cextents = cell_extents(dataset) _num_of_points = num_of_points(dataset) point_coords = reshape(dataset.point_coords, (_dim, _num_of_points)) point_data = empty(dataset.point_data) for m in keys(dataset.point_data) _var_dim = var_dim(dataset, m, "Point") if _var_dim == 1 point_data[m] = reshape(dataset.point_data[m], (_num_of_points,)) else point_data[m] = reshape(dataset.point_data[m], (_var_dim, _num_of_points)) end end _cell_data = empty(dataset.cell_data) lines = Vector{Int}[] for cind in Iterators.product(1:cextents[1], 1:cextents[2], 1:cextents[3]) hexa_cc = cell_connectivity(dataset, cind) push!(lines, [hexa_cc[1], hexa_cc[2]]) push!(lines, [hexa_cc[1], hexa_cc[4]]) push!(lines, [hexa_cc[1], hexa_cc[5]]) if cind[1] == cextents[1] push!(lines, [hexa_cc[2], hexa_cc[3]]) push!(lines, [hexa_cc[3], hexa_cc[7]]) push!(lines, [hexa_cc[6], hexa_cc[7]]) push!(lines, [hexa_cc[2], hexa_cc[6]]) end if cind[2] == cextents[2] push!(lines, [hexa_cc[3], hexa_cc[4]]) push!(lines, [hexa_cc[7], hexa_cc[8]]) push!(lines, [hexa_cc[4], hexa_cc[8]]) end if cind[3] == cextents[3] push!(lines, [hexa_cc[5], hexa_cc[8]]) push!(lines, [hexa_cc[5], hexa_cc[6]]) end end _cell_types = fill(3, length(lines)) return VTKPolyData(point_coords, _cell_types, lines, point_data, _cell_data) end
{"hexsha": "018705362da80b5a1ddfdc14ef79e0143c7a7f09", "size": 33531, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "src/decompose_struct.jl", "max_stars_repo_name": "mohamed82008/VTKDataTypes.jl", "max_stars_repo_head_hexsha": "f1434139863b5d2c6b46f0c0d133dca56993c1b3", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2017-07-07T05:33:03.000Z", "max_stars_repo_stars_event_max_datetime": "2020-10-15T05:44:51.000Z", "max_issues_repo_path": "src/decompose_struct.jl", "max_issues_repo_name": "mohamed82008/VTKDataTypes.jl", "max_issues_repo_head_hexsha": "f1434139863b5d2c6b46f0c0d133dca56993c1b3", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 5, "max_issues_repo_issues_event_min_datetime": "2017-07-06T21:21:18.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-04T19:03:03.000Z", "max_forks_repo_path": "src/decompose_struct.jl", "max_forks_repo_name": "mohamed82008/VTKDataTypes.jl", "max_forks_repo_head_hexsha": "f1434139863b5d2c6b46f0c0d133dca56993c1b3", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2017-10-31T17:21:33.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-15T14:26:03.000Z", "avg_line_length": 40.3987951807, "max_line_length": 110, "alphanum_fraction": 0.4712355731, "num_tokens": 9015}
[STATEMENT] lemma InvariantsAfterAddClause: fixes state::State and clause :: Clause and Vbl :: "Variable set" assumes "InvariantConsistent (getM state)" "InvariantUniq (getM state)" "InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state)" and "InvariantWatchListsUniq (getWatchList state)" and "InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state)" "InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)" and "InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state)" and "InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)" "InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state)" "InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state)" "InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state)" "InvariantUniqQ (getQ state)" "InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state))" "currentLevel (getM state) = 0" "(getConflictFlag state) \<or> (getQ state) = []" "InvariantVarsM (getM state) F0 Vbl" "InvariantVarsQ (getQ state) F0 Vbl" "InvariantVarsF (getF state) F0 Vbl" "finite Vbl" "vars clause \<subseteq> vars F0" shows "let state' = (addClause clause state) in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> ((getConflictFlag state') \<or> (getQ state') = []) " [PROOF STATE] proof (prove) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] proof- [PROOF STATE] proof (state) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] let ?clause' = "remdups (removeFalseLiterals clause (elements (getM state)))" [PROOF STATE] proof (state) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have *: "\<forall> l. l el ?clause' \<longrightarrow> \<not> literalFalse l (elements (getM state))" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) [PROOF STEP] unfolding removeFalseLiterals_def [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<forall>l. l el remdups (filter (\<lambda>l. \<not> literalFalse l (elements (getM state))) clause) \<longrightarrow> \<not> literalFalse l (elements (getM state)) [PROOF STEP] by auto [PROOF STATE] proof (state) this: \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "vars ?clause' \<subseteq> vars clause" [PROOF STATE] proof (prove) goal (1 subgoal): 1. vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars clause [PROOF STEP] using varsSubsetValuation[of "?clause'" "clause"] [PROOF STATE] proof (prove) using this: set (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> set clause \<Longrightarrow> vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars clause goal (1 subgoal): 1. vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars clause [PROOF STEP] unfolding removeFalseLiterals_def [PROOF STATE] proof (prove) using this: set (remdups (filter (\<lambda>l. \<not> literalFalse l (elements (getM state))) clause)) \<subseteq> set clause \<Longrightarrow> vars (remdups (filter (\<lambda>l. \<not> literalFalse l (elements (getM state))) clause)) \<subseteq> vars clause goal (1 subgoal): 1. vars (remdups (filter (\<lambda>l. \<not> literalFalse l (elements (getM state))) clause)) \<subseteq> vars clause [PROOF STEP] by auto [PROOF STATE] proof (state) this: vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars clause goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] hence "vars ?clause' \<subseteq> vars F0" [PROOF STATE] proof (prove) using this: vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars clause goal (1 subgoal): 1. vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars F0 [PROOF STEP] using \<open>vars clause \<subseteq> vars F0\<close> [PROOF STATE] proof (prove) using this: vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars clause vars clause \<subseteq> vars F0 goal (1 subgoal): 1. vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars F0 [PROOF STEP] by simp [PROOF STATE] proof (state) this: vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars F0 goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] proof (cases "clauseTrue ?clause' (elements (getM state))") [PROOF STATE] proof (state) goal (2 subgoals): 1. clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] case True [PROOF STATE] proof (state) this: clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (2 subgoals): 1. clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] unfolding addClause_def [PROOF STATE] proof (prove) using this: clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. let state' = let clause' = remdups (removeFalseLiterals clause (elements (getM state))) in if clauseTrue clause' (elements (getM state)) then state else if clause' = [] then state\<lparr>getSATFlag := FALSE\<rparr> else if length clause' = 1 then Let (assertLiteral (hd clause') False state) exhaustiveUnitPropagate else if clauseTautology clause' then state else let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [clause']\<rparr>; state'' = setWatch1 clauseIndex (clause' ! 0) state'; state''' = setWatch2 clauseIndex (clause' ! 1) state'' in state''' in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] by simp [PROOF STATE] proof (state) this: let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) goal (1 subgoal): 1. \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] case False [PROOF STATE] proof (state) this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] proof (cases "?clause' = []") [PROOF STATE] proof (state) goal (2 subgoals): 1. remdups (removeFalseLiterals clause (elements (getM state))) = [] \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] case True [PROOF STATE] proof (state) this: remdups (removeFalseLiterals clause (elements (getM state))) = [] goal (2 subgoals): 1. remdups (removeFalseLiterals clause (elements (getM state))) = [] \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) = [] goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) = [] InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using \<open>\<not> clauseTrue ?clause' (elements (getM state))\<close> [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) = [] InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] unfolding addClause_def [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) = [] InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. let state' = let clause' = remdups (removeFalseLiterals clause (elements (getM state))) in if clauseTrue clause' (elements (getM state)) then state else if clause' = [] then state\<lparr>getSATFlag := FALSE\<rparr> else if length clause' = 1 then Let (assertLiteral (hd clause') False state) exhaustiveUnitPropagate else if clauseTautology clause' then state else let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [clause']\<rparr>; state'' = setWatch1 clauseIndex (clause' ! 0) state'; state''' = setWatch2 clauseIndex (clause' ! 1) state'' in state''' in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] by simp [PROOF STATE] proof (state) this: let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) goal (1 subgoal): 1. remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] case False [PROOF STATE] proof (state) this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] proof (cases "length ?clause' = 1") [PROOF STATE] proof (state) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] case True [PROOF STATE] proof (state) this: length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1 goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] let ?state' = "assertLiteral (hd ?clause') False state" [PROOF STATE] proof (state) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "addClause clause state = exhaustiveUnitPropagate ?state'" [PROOF STATE] proof (prove) goal (1 subgoal): 1. addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>\<not> clauseTrue ?clause' (elements (getM state))\<close> [PROOF STATE] proof (prove) using this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>\<not> ?clause' = []\<close> [PROOF STATE] proof (prove) using this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>length ?clause' = 1\<close> [PROOF STATE] proof (prove) using this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1 goal (1 subgoal): 1. addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] unfolding addClause_def [PROOF STATE] proof (prove) using this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1 goal (1 subgoal): 1. (let clause' = remdups (removeFalseLiterals clause (elements (getM state))) in if clauseTrue clause' (elements (getM state)) then state else if clause' = [] then state\<lparr>getSATFlag := FALSE\<rparr> else if length clause' = 1 then Let (assertLiteral (hd clause') False state) exhaustiveUnitPropagate else if clauseTautology clause' then state else let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [clause']\<rparr>; state'' = setWatch1 clauseIndex (clause' ! 0) state'; state''' = setWatch2 clauseIndex (clause' ! 1) state'' in state''') = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] by (simp add: Let_def) [PROOF STATE] proof (state) this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] from \<open>?clause' \<noteq> []\<close> [PROOF STATE] proof (chain) picking this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] [PROOF STEP] have "hd ?clause' \<in> set ?clause'" [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) [PROOF STEP] using hd_in_set[of "?clause'"] [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<Longrightarrow> hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) [PROOF STEP] by simp [PROOF STATE] proof (state) this: hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] with * [PROOF STATE] proof (chain) picking this: \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) [PROOF STEP] have "\<not> literalFalse (hd ?clause') (elements (getM state))" [PROOF STATE] proof (prove) using this: \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. \<not> literalFalse (hd (remdups (removeFalseLiterals clause (elements (getM state))))) (elements (getM state)) [PROOF STEP] by simp [PROOF STATE] proof (state) this: \<not> literalFalse (hd (remdups (removeFalseLiterals clause (elements (getM state))))) (elements (getM state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] hence "consistent (elements ((getM state) @ [(hd ?clause', False)]))" [PROOF STATE] proof (prove) using this: \<not> literalFalse (hd (remdups (removeFalseLiterals clause (elements (getM state))))) (elements (getM state)) goal (1 subgoal): 1. consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: \<not> literalFalse (hd (remdups (removeFalseLiterals clause (elements (getM state))))) (elements (getM state)) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])) [PROOF STEP] unfolding InvariantConsistent_def [PROOF STATE] proof (prove) using this: \<not> literalFalse (hd (remdups (removeFalseLiterals clause (elements (getM state))))) (elements (getM state)) consistent (elements (getM state)) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])) [PROOF STEP] using consistentAppendElement[of "elements (getM state)" "hd ?clause'"] [PROOF STATE] proof (prove) using this: \<not> literalFalse (hd (remdups (removeFalseLiterals clause (elements (getM state))))) (elements (getM state)) consistent (elements (getM state)) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>consistent (elements (getM state)); \<not> literalFalse (hd (remdups (removeFalseLiterals clause (elements (getM state))))) (elements (getM state))\<rbrakk> \<Longrightarrow> consistent (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]) goal (1 subgoal): 1. consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])) [PROOF STEP] by simp [PROOF STATE] proof (state) this: consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] hence "consistent (elements (getM ?state'))" [PROOF STATE] proof (prove) using this: consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])) goal (1 subgoal): 1. consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) [PROOF STEP] using assertLiteralEffect[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) [PROOF STEP] by simp [PROOF STATE] proof (state) this: consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] from \<open>\<not> clauseTrue ?clause' (elements (getM state))\<close> [PROOF STATE] proof (chain) picking this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) [PROOF STEP] have "uniq (elements (getM ?state'))" [PROOF STATE] proof (prove) using this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) [PROOF STEP] using assertLiteralEffect[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) [PROOF STEP] using \<open>hd ?clause' \<in> set ?clause'\<close> [PROOF STATE] proof (prove) using this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) [PROOF STEP] unfolding InvariantUniq_def [PROOF STATE] proof (prove) using this: \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) InvariantConsistent (getM state) uniq (elements (getM state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) [PROOF STEP] by (simp add: uniqAppendIff clauseTrueIffContainsTrueLiteral) [PROOF STATE] proof (state) this: uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantWatchListsContainOnlyClausesFromF (getWatchList ?state') (getF ?state')" and "InvariantWatchListsUniq (getWatchList ?state')" and "InvariantWatchListsCharacterization (getWatchList ?state') (getWatch1 ?state') (getWatch2 ?state')" "InvariantWatchesEl (getF ?state') (getWatch1 ?state') (getWatch2 ?state')" and "InvariantWatchesDiffer (getF ?state') (getWatch1 ?state') (getWatch2 ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. (InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) &&& InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) &&& (InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) &&& InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) &&& InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. (InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) &&& InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) &&& (InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) &&& InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) &&& InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using WatchInvariantsAfterAssertLiteral[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') goal (1 subgoal): 1. (InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) &&& InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) &&& (InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) &&& InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) &&& InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantWatchCharacterization (getF ?state') (getWatch1 ?state') (getWatch2 ?state') (getM ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using InvariantWatchCharacterizationAfterAssertLiteral[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') goal (1 subgoal): 1. InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using \<open>uniq (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using \<open>consistent (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] unfolding InvariantConsistent_def [PROOF STATE] proof (prove) using this: consistent (elements (getM state)) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] unfolding InvariantUniq_def [PROOF STATE] proof (prove) using this: consistent (elements (getM state)) uniq (elements (getM state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); uniq (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using assertLiteralEffect[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: consistent (elements (getM state)) uniq (elements (getM state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); uniq (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] by (simp add: Let_def) [PROOF STATE] proof (state) this: InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantConflictFlagCharacterization (getConflictFlag ?state') (getF ?state') (getM ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using InvariantConflictFlagCharacterizationAfterAssertLiteral[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') goal (1 subgoal): 1. InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using \<open>consistent (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] unfolding InvariantConsistent_def [PROOF STATE] proof (prove) using this: consistent (elements (getM state)) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using assertLiteralEffect[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: consistent (elements (getM state)) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] by (simp add: Let_def) [PROOF STATE] proof (state) this: InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantConflictClauseCharacterization (getConflictFlag ?state') (getConflictClause ?state') (getF ?state') (getM ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using InvariantConflictClauseCharacterizationAfterAssertLiteral[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchListsUniq (getWatchList state); InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') goal (1 subgoal): 1. InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] by (simp add: Let_def) [PROOF STATE] proof (state) this: InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] let ?state'' = "?state'\<lparr> getM := (getM ?state') @ [(hd ?clause', False)] \<rparr>" [PROOF STATE] proof (state) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantQCharacterization (getConflictFlag ?state') (getQ ?state') (getF ?state') (getM ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] proof (cases "getConflictFlag state") [PROOF STATE] proof (state) goal (2 subgoals): 1. getConflictFlag state \<Longrightarrow> InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) 2. \<not> getConflictFlag state \<Longrightarrow> InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] case True [PROOF STATE] proof (state) this: getConflictFlag state goal (2 subgoals): 1. getConflictFlag state \<Longrightarrow> InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) 2. \<not> getConflictFlag state \<Longrightarrow> InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] hence "getConflictFlag ?state'" [PROOF STATE] proof (prove) using this: getConflictFlag state goal (1 subgoal): 1. getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: getConflictFlag state InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using assertLiteralConflictFlagEffect[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: getConflictFlag state InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in getConflictFlag state' = (getConflictFlag state \<or> (\<exists>clausea. clausea el getF state \<and> opposite (hd (remdups (removeFalseLiterals clause (elements (getM state))))) el clausea \<and> clauseFalse clausea (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]))) goal (1 subgoal): 1. getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>uniq (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: getConflictFlag state InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in getConflictFlag state' = (getConflictFlag state \<or> (\<exists>clausea. clausea el getF state \<and> opposite (hd (remdups (removeFalseLiterals clause (elements (getM state))))) el clausea \<and> clauseFalse clausea (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>consistent (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: getConflictFlag state InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in getConflictFlag state' = (getConflictFlag state \<or> (\<exists>clausea. clausea el getF state \<and> opposite (hd (remdups (removeFalseLiterals clause (elements (getM state))))) el clausea \<and> clauseFalse clausea (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] unfolding InvariantConsistent_def [PROOF STATE] proof (prove) using this: getConflictFlag state consistent (elements (getM state)) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in getConflictFlag state' = (getConflictFlag state \<or> (\<exists>clausea. clausea el getF state \<and> opposite (hd (remdups (removeFalseLiterals clause (elements (getM state))))) el clausea \<and> clauseFalse clausea (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] unfolding InvariantUniq_def [PROOF STATE] proof (prove) using this: getConflictFlag state consistent (elements (getM state)) uniq (elements (getM state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); uniq (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in getConflictFlag state' = (getConflictFlag state \<or> (\<exists>clausea. clausea el getF state \<and> opposite (hd (remdups (removeFalseLiterals clause (elements (getM state))))) el clausea \<and> clauseFalse clausea (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using assertLiteralEffect[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: getConflictFlag state consistent (elements (getM state)) uniq (elements (getM state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); uniq (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in getConflictFlag state' = (getConflictFlag state \<or> (\<exists>clausea. clausea el getF state \<and> opposite (hd (remdups (removeFalseLiterals clause (elements (getM state))))) el clausea \<and> clauseFalse clausea (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) goal (2 subgoals): 1. getConflictFlag state \<Longrightarrow> InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) 2. \<not> getConflictFlag state \<Longrightarrow> InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] unfolding InvariantQCharacterization_def [PROOF STATE] proof (prove) using this: getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) \<not> getConflictFlag state \<longrightarrow> (\<forall>l. l el getQ state = (\<exists>c. c el getF state \<and> isUnitClause c l (elements (getM state)))) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. \<not> getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<longrightarrow> (\<forall>l. l el getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = (\<exists>c. c el getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<and> isUnitClause c l (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))))) [PROOF STEP] by simp [PROOF STATE] proof (state) this: InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. \<not> getConflictFlag state \<Longrightarrow> InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. \<not> getConflictFlag state \<Longrightarrow> InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] case False [PROOF STATE] proof (state) this: \<not> getConflictFlag state goal (1 subgoal): 1. \<not> getConflictFlag state \<Longrightarrow> InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] with \<open>(getConflictFlag state) \<or> (getQ state) = []\<close> [PROOF STATE] proof (chain) picking this: getConflictFlag state \<or> getQ state = [] \<not> getConflictFlag state [PROOF STEP] have "getQ state = []" [PROOF STATE] proof (prove) using this: getConflictFlag state \<or> getQ state = [] \<not> getConflictFlag state goal (1 subgoal): 1. getQ state = [] [PROOF STEP] by simp [PROOF STATE] proof (state) this: getQ state = [] goal (1 subgoal): 1. \<not> getConflictFlag state \<Longrightarrow> InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: getQ state = [] goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using InvariantQCharacterizationAfterAssertLiteralNotInQ[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: getQ state = [] \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state); InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state); \<not> hd (remdups (removeFalseLiterals clause (elements (getM state)))) el getQ state\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: getQ state = [] \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state); InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state); \<not> hd (remdups (removeFalseLiterals clause (elements (getM state)))) el getQ state\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using \<open>uniq (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: getQ state = [] \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state); InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state); \<not> hd (remdups (removeFalseLiterals clause (elements (getM state)))) el getQ state\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using \<open>consistent (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: getQ state = [] \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state); InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state); \<not> hd (remdups (removeFalseLiterals clause (elements (getM state)))) el getQ state\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] unfolding InvariantConsistent_def [PROOF STATE] proof (prove) using this: getQ state = [] \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state); InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state); \<not> hd (remdups (removeFalseLiterals clause (elements (getM state)))) el getQ state\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') consistent (elements (getM state)) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] unfolding InvariantUniq_def [PROOF STATE] proof (prove) using this: getQ state = [] \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state); InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state); \<not> hd (remdups (removeFalseLiterals clause (elements (getM state)))) el getQ state\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') consistent (elements (getM state)) uniq (elements (getM state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using assertLiteralEffect[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: getQ state = [] \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state); InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state); \<not> hd (remdups (removeFalseLiterals clause (elements (getM state)))) el getQ state\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') consistent (elements (getM state)) uniq (elements (getM state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantUniqQ (getQ ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] using InvariantUniqQAfterAssertLiteral[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantUniqQ (getQ state)\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantUniqQ (getQ state') goal (1 subgoal): 1. InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) [PROOF STEP] by (simp add: Let_def) [PROOF STATE] proof (state) this: InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "currentLevel (getM ?state') = 0" [PROOF STATE] proof (prove) goal (1 subgoal): 1. currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 [PROOF STEP] using \<open>\<not> clauseTrue ?clause' (elements (getM state))\<close> [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 [PROOF STEP] using \<open>\<not> ?clause' = []\<close> [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 [PROOF STEP] using assertLiteralEffect[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 [PROOF STEP] unfolding addClause_def [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 [PROOF STEP] unfolding currentLevel_def [PROOF STATE] proof (prove) using this: InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) length (decisions (getM state)) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. length (decisions (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) = 0 [PROOF STEP] by (simp add:Let_def markedElementsAppend) [PROOF STATE] proof (state) this: currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] hence "InvariantGetReasonIsReason (getReason ?state') (getF ?state') (getM ?state') (set (getQ ?state'))" [PROOF STATE] proof (prove) using this: currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 goal (1 subgoal): 1. InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) [PROOF STEP] unfolding InvariantGetReasonIsReason_def [PROOF STATE] proof (prove) using this: currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 goal (1 subgoal): 1. \<forall>literal. (literal el elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<and> \<not> literal el decisions (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<and> 0 < elementLevel literal (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<longrightarrow> (\<exists>reason. getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) literal = Some reason \<and> 0 \<le> reason \<and> reason < length (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<and> isReason (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) ! reason) literal (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))))) \<and> (0 < currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<and> literal \<in> set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<longrightarrow> (\<exists>reason. getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) literal = Some reason \<and> 0 \<le> reason \<and> reason < length (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<and> (isUnitClause (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) ! reason) literal (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<or> clauseFalse (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) ! reason) (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)))))) [PROOF STEP] using elementLevelLeqCurrentLevel[of _ "getM ?state'"] [PROOF STATE] proof (prove) using this: currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 elementLevel ?a (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<le> currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. \<forall>literal. (literal el elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<and> \<not> literal el decisions (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<and> 0 < elementLevel literal (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<longrightarrow> (\<exists>reason. getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) literal = Some reason \<and> 0 \<le> reason \<and> reason < length (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<and> isReason (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) ! reason) literal (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))))) \<and> (0 < currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<and> literal \<in> set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<longrightarrow> (\<exists>reason. getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) literal = Some reason \<and> 0 \<le> reason \<and> reason < length (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<and> (isUnitClause (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) ! reason) literal (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<or> clauseFalse (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) ! reason) (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)))))) [PROOF STEP] by auto [PROOF STATE] proof (state) this: InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "var (hd ?clause') \<in> vars F0" [PROOF STATE] proof (prove) goal (1 subgoal): 1. var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 [PROOF STEP] using \<open>?clause' \<noteq> []\<close> [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 [PROOF STEP] using hd_in_set[of "?clause'"] [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<Longrightarrow> hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 [PROOF STEP] using \<open>vars ?clause' \<subseteq> vars F0\<close> [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<Longrightarrow> hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars F0 goal (1 subgoal): 1. var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 [PROOF STEP] using clauseContainsItsLiteralsVariable[of "hd ?clause'" "?clause'"] [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<Longrightarrow> hd (remdups (removeFalseLiterals clause (elements (getM state)))) \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars F0 hd (remdups (removeFalseLiterals clause (elements (getM state)))) el remdups (removeFalseLiterals clause (elements (getM state))) \<Longrightarrow> var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 [PROOF STEP] by auto [PROOF STATE] proof (state) this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] hence "InvariantVarsQ (getQ ?state') F0 Vbl" "InvariantVarsM (getM ?state') F0 Vbl" "InvariantVarsF (getF ?state') F0 Vbl" [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state)\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>InvariantWatchListsUniq (getWatchList state)\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state)\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state)\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>InvariantVarsF (getF state) F0 Vbl\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>InvariantVarsM (getM state) F0 Vbl\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl InvariantVarsM (getM state) F0 Vbl goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>InvariantVarsQ (getQ state) F0 Vbl\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>consistent (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using \<open>uniq (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using assertLiteralEffect[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using varsAppendValuation[of "elements (getM state)" "[hd ?clause']"] [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) vars (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]) = vars (elements (getM state)) \<union> vars [hd (remdups (removeFalseLiterals clause (elements (getM state))))] goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] using InvariantVarsQAfterAssertLiteral[of "state" "hd ?clause'" "False" "F0" "Vbl"] [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) vars (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]) = vars (elements (getM state)) \<union> vars [hd (remdups (removeFalseLiterals clause (elements (getM state))))] \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantVarsQ (getQ state) F0 Vbl; InvariantVarsF (getF state) F0 Vbl\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantVarsQ (getQ state') F0 Vbl goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] unfolding InvariantVarsM_def [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl vars (elements (getM state)) \<subseteq> vars F0 \<union> Vbl InvariantVarsQ (getQ state) F0 Vbl consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) vars (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]) = vars (elements (getM state)) \<union> vars [hd (remdups (removeFalseLiterals clause (elements (getM state))))] \<lbrakk>InvariantConsistent (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantVarsQ (getQ state) F0 Vbl; InvariantVarsF (getF state) F0 Vbl\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantVarsQ (getQ state') F0 Vbl goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& vars (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<subseteq> vars F0 \<union> Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] unfolding InvariantConsistent_def [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl vars (elements (getM state)) \<subseteq> vars F0 \<union> Vbl InvariantVarsQ (getQ state) F0 Vbl consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) vars (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]) = vars (elements (getM state)) \<union> vars [hd (remdups (removeFalseLiterals clause (elements (getM state))))] \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantUniq (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)]); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantVarsQ (getQ state) F0 Vbl; InvariantVarsF (getF state) F0 Vbl\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantVarsQ (getQ state') F0 Vbl goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& vars (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<subseteq> vars F0 \<union> Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] unfolding InvariantUniq_def [PROOF STATE] proof (prove) using this: var (hd (remdups (removeFalseLiterals clause (elements (getM state))))) \<in> vars F0 InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantVarsF (getF state) F0 Vbl vars (elements (getM state)) \<subseteq> vars F0 \<union> Vbl InvariantVarsQ (getQ state) F0 Vbl consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) vars (elements (getM state) @ [hd (remdups (removeFalseLiterals clause (elements (getM state))))]) = vars (elements (getM state)) \<union> vars [hd (remdups (removeFalseLiterals clause (elements (getM state))))] \<lbrakk>consistent (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); uniq (elements (getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)])); InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchListsUniq (getWatchList state); InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state); InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state); InvariantVarsQ (getQ state) F0 Vbl; InvariantVarsF (getF state) F0 Vbl\<rbrakk> \<Longrightarrow> let state' = assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state in InvariantVarsQ (getQ state') F0 Vbl goal (1 subgoal): 1. InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl &&& vars (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) \<subseteq> vars F0 \<union> Vbl &&& InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "exhaustiveUnitPropagate_dom ?state'" [PROOF STATE] proof (prove) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using exhaustiveUnitPropagateTermination[of "?state'" "F0" "Vbl"] [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantUniqQ (getQ ?state')\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantWatchListsContainOnlyClausesFromF (getWatchList ?state') (getF ?state')\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantWatchListsUniq (getWatchList ?state')\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantWatchListsCharacterization (getWatchList ?state') (getWatch1 ?state') (getWatch2 ?state')\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantWatchesEl (getF ?state') (getWatch1 ?state') (getWatch2 ?state')\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantWatchesDiffer (getF ?state') (getWatch1 ?state') (getWatch2 ?state')\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantQCharacterization (getConflictFlag ?state') (getQ ?state') (getF ?state') (getM ?state')\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantWatchCharacterization (getF ?state') (getWatch1 ?state') (getWatch2 ?state') (getM ?state')\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantConflictFlagCharacterization (getConflictFlag ?state') (getF ?state') (getM ?state')\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>consistent (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>uniq (elements (getM ?state'))\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>finite Vbl\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) finite Vbl goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantVarsQ (getQ ?state') F0 Vbl\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) finite Vbl InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantVarsM (getM ?state') F0 Vbl\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) finite Vbl InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] using \<open>InvariantVarsF (getF ?state') F0 Vbl\<close> [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) finite Vbl InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] unfolding InvariantConsistent_def [PROOF STATE] proof (prove) using this: \<lbrakk>InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) finite Vbl InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] unfolding InvariantUniq_def [PROOF STATE] proof (prove) using this: \<lbrakk>uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))); consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl; finite Vbl\<rbrakk> \<Longrightarrow> exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) finite Vbl InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl goal (1 subgoal): 1. exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] by simp [PROOF STATE] proof (state) this: exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) goal (2 subgoals): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) = 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] ultimately [PROOF STATE] proof (chain) picking this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using \<open>exhaustiveUnitPropagate_dom ?state'\<close> [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using InvariantsAfterExhaustiveUnitPropagate[of "?state'"] [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') ?F0.0 ?Vbl \<and> InvariantVarsM (getM state') ?F0.0 ?Vbl \<and> InvariantVarsF (getF state') ?F0.0 ?Vbl goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using InvariantConflictClauseCharacterizationAfterExhaustivePropagate[of "?state'"] [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') ?F0.0 ?Vbl \<and> InvariantVarsM (getM state') ?F0.0 ?Vbl \<and> InvariantVarsF (getF state') ?F0.0 ?Vbl \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using conflictFlagOrQEmptyAfterExhaustiveUnitPropagate[of "?state'"] [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') ?F0.0 ?Vbl \<and> InvariantVarsM (getM state') ?F0.0 ?Vbl \<and> InvariantVarsF (getF state') ?F0.0 ?Vbl \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in getConflictFlag state' \<or> getQ state' = [] goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using exhaustiveUnitPropagatePreservesCurrentLevel[of "?state'"] [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') ?F0.0 ?Vbl \<and> InvariantVarsM (getM state') ?F0.0 ?Vbl \<and> InvariantVarsF (getF state') ?F0.0 ?Vbl \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in getConflictFlag state' \<or> getQ state' = [] \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in currentLevel (getM state') = currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using InvariantGetReasonIsReasonAfterExhaustiveUnitPropagate[of "?state'"] [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') ?F0.0 ?Vbl \<and> InvariantVarsM (getM state') ?F0.0 ?Vbl \<and> InvariantVarsF (getF state') ?F0.0 ?Vbl \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in getConflictFlag state' \<or> getQ state' = [] \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in currentLevel (getM state') = currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') ?F0.0 ?Vbl \<and> InvariantVarsM (getM state') ?F0.0 ?Vbl \<and> InvariantVarsF (getF state') ?F0.0 ?Vbl \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in getConflictFlag state' \<or> getQ state' = [] \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in currentLevel (getM state') = currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using assertLiteralEffect[of "state" "hd ?clause'" "False"] [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') ?F0.0 ?Vbl \<and> InvariantVarsM (getM state') ?F0.0 ?Vbl \<and> InvariantVarsF (getF state') ?F0.0 ?Vbl \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in getConflictFlag state' \<or> getQ state' = [] \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in currentLevel (getM state') = currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantConsistent (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] unfolding InvariantConsistent_def [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in consistent (elements (getM state')) \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') ?F0.0 ?Vbl \<and> InvariantVarsM (getM state') ?F0.0 ?Vbl \<and> InvariantVarsF (getF state') ?F0.0 ?Vbl \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in getConflictFlag state' \<or> getQ state' = [] \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in currentLevel (getM state') = currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))); InvariantUniq (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) consistent (elements (getM state)) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. let state' = addClause clause state in consistent (elements (getM state')) \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] unfolding InvariantUniq_def [PROOF STATE] proof (prove) using this: addClause clause state = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) = 0 InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))) InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) F0 Vbl exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))); uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantVarsQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsM (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl; InvariantVarsF (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) ?F0.0 ?Vbl\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in consistent (elements (getM state')) \<and> uniq (elements (getM state')) \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') ?F0.0 ?Vbl \<and> InvariantVarsM (getM state') ?F0.0 ?Vbl \<and> InvariantVarsF (getF state') ?F0.0 ?Vbl \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictClauseCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getConflictClause (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in getConflictFlag state' \<or> getQ state' = [] \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in currentLevel (getM state') = currentLevel (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) \<lbrakk>exhaustiveUnitPropagate_dom (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state); consistent (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))); uniq (elements (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state))); InvariantWatchListsContainOnlyClausesFromF (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsUniq (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchListsCharacterization (getWatchList (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesEl (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchesDiffer (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantWatchCharacterization (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch1 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getWatch2 (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantConflictFlagCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantQCharacterization (getConflictFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantUniqQ (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)); InvariantGetReasonIsReason (getReason (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) (set (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)))\<rbrakk> \<Longrightarrow> let state' = exhaustiveUnitPropagate (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) in InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) consistent (elements (getM state)) uniq (elements (getM state)) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getM (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getM state @ [(hd (remdups (removeFalseLiterals clause (elements (getM state)))), False)] \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getF (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getF state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> getSATFlag (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state) = getSATFlag state \<lbrakk>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state); InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<rbrakk> \<Longrightarrow> isPrefix (getQ state) (getQ (assertLiteral (hd (remdups (removeFalseLiterals clause (elements (getM state))))) False state)) goal (1 subgoal): 1. let state' = addClause clause state in consistent (elements (getM state')) \<and> uniq (elements (getM state')) \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] by (auto simp only:Let_def) [PROOF STATE] proof (state) this: let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) goal (1 subgoal): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] case False [PROOF STATE] proof (state) this: length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 goal (1 subgoal): 1. \<lbrakk>remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []; length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] proof (cases "clauseTautology ?clause'") [PROOF STATE] proof (state) goal (2 subgoals): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] case True [PROOF STATE] proof (state) this: clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) goal (2 subgoals): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) 2. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using \<open>\<not> ?clause' = []\<close> [PROOF STATE] proof (prove) using this: clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using \<open>\<not> clauseTrue ?clause' (elements (getM state))\<close> [PROOF STATE] proof (prove) using this: clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using \<open>length ?clause' \<noteq> 1\<close> [PROOF STATE] proof (prove) using this: clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] unfolding addClause_def [PROOF STATE] proof (prove) using this: clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 goal (1 subgoal): 1. let state' = let clause' = remdups (removeFalseLiterals clause (elements (getM state))) in if clauseTrue clause' (elements (getM state)) then state else if clause' = [] then state\<lparr>getSATFlag := FALSE\<rparr> else if length clause' = 1 then Let (assertLiteral (hd clause') False state) exhaustiveUnitPropagate else if clauseTautology clause' then state else let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [clause']\<rparr>; state'' = setWatch1 clauseIndex (clause' ! 0) state'; state''' = setWatch2 clauseIndex (clause' ! 1) state'' in state''' in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] by simp [PROOF STATE] proof (state) this: let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] case False [PROOF STATE] proof (state) this: \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] from \<open>\<not> ?clause' = []\<close> \<open>length ?clause' \<noteq> 1\<close> [PROOF STATE] proof (chain) picking this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 [PROOF STEP] have "length ?clause' > 1" [PROOF STATE] proof (prove) using this: remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 goal (1 subgoal): 1. 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) [PROOF STEP] by (induct (?clause')) auto [PROOF STATE] proof (state) this: 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] hence "nth ?clause' 0 \<noteq> nth ?clause' 1" [PROOF STATE] proof (prove) using this: 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 [PROOF STEP] using distinct_remdups[of "?clause'"] [PROOF STATE] proof (prove) using this: 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) distinct (remdups (remdups (removeFalseLiterals clause (elements (getM state))))) goal (1 subgoal): 1. remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 [PROOF STEP] using nth_eq_iff_index_eq[of "?clause'" "0" "1"] [PROOF STATE] proof (prove) using this: 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) distinct (remdups (remdups (removeFalseLiterals clause (elements (getM state))))) \<lbrakk>distinct (remdups (removeFalseLiterals clause (elements (getM state)))); 0 < length (remdups (removeFalseLiterals clause (elements (getM state)))); 1 < length (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> (remdups (removeFalseLiterals clause (elements (getM state))) ! 0 = remdups (removeFalseLiterals clause (elements (getM state))) ! 1) = (0 = 1) goal (1 subgoal): 1. remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 [PROOF STEP] using \<open>\<not> ?clause' = []\<close> [PROOF STATE] proof (prove) using this: 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) distinct (remdups (remdups (removeFalseLiterals clause (elements (getM state))))) \<lbrakk>distinct (remdups (removeFalseLiterals clause (elements (getM state)))); 0 < length (remdups (removeFalseLiterals clause (elements (getM state)))); 1 < length (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> (remdups (removeFalseLiterals clause (elements (getM state))) ! 0 = remdups (removeFalseLiterals clause (elements (getM state))) ! 1) = (0 = 1) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 [PROOF STEP] by auto [PROOF STATE] proof (state) this: remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] let ?state' = "let clauseIndex = length (getF state) in let state' = state\<lparr> getF := (getF state) @ [?clause']\<rparr> in let state'' = setWatch1 clauseIndex (nth ?clause' 0) state' in let state''' = setWatch2 clauseIndex (nth ?clause' 1) state'' in state'''" [PROOF STATE] proof (state) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantWatchesEl (getF ?state') (getWatch1 ?state') (getWatch2 ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state)\<close> [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) goal (1 subgoal): 1. InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>length ?clause' > 1\<close> [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>?clause' \<noteq> []\<close> [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using nth_mem[of "0" "?clause'"] [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] 0 < length (remdups (removeFalseLiterals clause (elements (getM state)))) \<Longrightarrow> remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using nth_mem[of "1" "?clause'"] [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] 0 < length (remdups (removeFalseLiterals clause (elements (getM state)))) \<Longrightarrow> remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) \<Longrightarrow> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] unfolding InvariantWatchesEl_def [PROOF STATE] proof (prove) using this: \<forall>clause. 0 \<le> clause \<and> clause < length (getF state) \<longrightarrow> (\<exists>w1 w2. getWatch1 state clause = Some w1 \<and> getWatch2 state clause = Some w2 \<and> w1 el getF state ! clause \<and> w2 el getF state ! clause) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] 0 < length (remdups (removeFalseLiterals clause (elements (getM state)))) \<Longrightarrow> remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) \<Longrightarrow> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. \<forall>clausea. 0 \<le> clausea \<and> clausea < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<longrightarrow> (\<exists>w1 w2. getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') clausea = Some w1 \<and> getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') clausea = Some w2 \<and> w1 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! clausea \<and> w2 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! clausea) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: \<forall>clause. 0 \<le> clause \<and> clause < length (getF state) \<longrightarrow> (\<exists>w1 w2. getWatch1 state clause = Some w1 \<and> getWatch2 state clause = Some w2 \<and> w1 el getF state ! clause \<and> w2 el getF state ! clause) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] 0 < length (remdups (removeFalseLiterals clause (elements (getM state)))) \<Longrightarrow> remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) \<Longrightarrow> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. \<forall>clausea. 0 \<le> clausea \<and> clausea < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<longrightarrow> (\<exists>w1 w2. getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') clausea = Some w1 \<and> getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') clausea = Some w2 \<and> w1 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! clausea \<and> w2 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! clausea) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: \<forall>clause. 0 \<le> clause \<and> clause < length (getF state) \<longrightarrow> (\<exists>w1 w2. getWatch1 state clause = Some w1 \<and> getWatch2 state clause = Some w2 \<and> w1 el getF state ! clause \<and> w2 el getF state ! clause) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] 0 < length (remdups (removeFalseLiterals clause (elements (getM state)))) \<Longrightarrow> remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) \<Longrightarrow> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. \<forall>clausea. 0 \<le> clausea \<and> clausea < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<longrightarrow> (\<exists>w1 w2. getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') clausea = Some w1 \<and> getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') clausea = Some w2 \<and> w1 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! clausea \<and> w2 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! clausea) [PROOF STEP] by (auto simp add: Let_def nth_append) [PROOF STATE] proof (state) this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantWatchesDiffer (getF ?state') (getWatch1 ?state') (getWatch2 ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state)\<close> [PROOF STATE] proof (prove) using this: InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) goal (1 subgoal): 1. InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>nth ?clause' 0 \<noteq> nth ?clause' 1\<close> [PROOF STATE] proof (prove) using this: InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] unfolding InvariantWatchesDiffer_def [PROOF STATE] proof (prove) using this: \<forall>clause. 0 \<le> clause \<and> clause < length (getF state) \<longrightarrow> getWatch1 state clause \<noteq> getWatch2 state clause remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<forall>clausea. 0 \<le> clausea \<and> clausea < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<longrightarrow> getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') clausea \<noteq> getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') clausea [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: \<forall>clause. 0 \<le> clause \<and> clause < length (getF state) \<longrightarrow> getWatch1 state clause \<noteq> getWatch2 state clause remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<forall>clausea. 0 \<le> clausea \<and> clausea < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<longrightarrow> getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') clausea \<noteq> getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') clausea [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: \<forall>clause. 0 \<le> clause \<and> clause < length (getF state) \<longrightarrow> getWatch1 state clause \<noteq> getWatch2 state clause remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<forall>clausea. 0 \<le> clausea \<and> clausea < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<longrightarrow> getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') clausea \<noteq> getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') clausea [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantWatchListsContainOnlyClausesFromF (getWatchList ?state') (getF ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state)\<close> [PROOF STATE] proof (prove) using this: InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) goal (1 subgoal): 1. InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] unfolding InvariantWatchListsContainOnlyClausesFromF_def [PROOF STATE] proof (prove) using this: \<forall>l c. c \<in> set (getWatchList state l) \<longrightarrow> 0 \<le> c \<and> c < length (getF state) goal (1 subgoal): 1. \<forall>l c. c \<in> set (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') l) \<longrightarrow> 0 \<le> c \<and> c < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: \<forall>l c. c \<in> set (getWatchList state l) \<longrightarrow> 0 \<le> c \<and> c < length (getF state) goal (1 subgoal): 1. \<forall>l c. c \<in> set (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') l) \<longrightarrow> 0 \<le> c \<and> c < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: \<forall>l c. c \<in> set (getWatchList state l) \<longrightarrow> 0 \<le> c \<and> c < length (getF state) goal (1 subgoal): 1. \<forall>l c. c \<in> set (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') l) \<longrightarrow> 0 \<le> c \<and> c < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) [PROOF STEP] by (auto simp add:Let_def) (force)+ [PROOF STATE] proof (state) this: InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantWatchListsCharacterization (getWatchList ?state') (getWatch1 ?state') (getWatch2 ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state)\<close> [PROOF STATE] proof (prove) using this: InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) goal (1 subgoal): 1. InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state)\<close> [PROOF STATE] proof (prove) using this: InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) goal (1 subgoal): 1. InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>nth ?clause' 0 \<noteq> nth ?clause' 1\<close> [PROOF STATE] proof (prove) using this: InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] unfolding InvariantWatchListsCharacterization_def [PROOF STATE] proof (prove) using this: \<forall>c l. (c \<in> set (getWatchList state l)) = (Some l = getWatch1 state c \<or> Some l = getWatch2 state c) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<forall>c l. (c \<in> set (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') l)) = (Some l = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c \<or> Some l = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c) [PROOF STEP] unfolding InvariantWatchListsContainOnlyClausesFromF_def [PROOF STATE] proof (prove) using this: \<forall>c l. (c \<in> set (getWatchList state l)) = (Some l = getWatch1 state c \<or> Some l = getWatch2 state c) \<forall>l c. c \<in> set (getWatchList state l) \<longrightarrow> 0 \<le> c \<and> c < length (getF state) remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<forall>c l. (c \<in> set (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') l)) = (Some l = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c \<or> Some l = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: \<forall>c l. (c \<in> set (getWatchList state l)) = (Some l = getWatch1 state c \<or> Some l = getWatch2 state c) \<forall>l c. c \<in> set (getWatchList state l) \<longrightarrow> 0 \<le> c \<and> c < length (getF state) remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<forall>c l. (c \<in> set (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') l)) = (Some l = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c \<or> Some l = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: \<forall>c l. (c \<in> set (getWatchList state l)) = (Some l = getWatch1 state c \<or> Some l = getWatch2 state c) \<forall>l c. c \<in> set (getWatchList state l) \<longrightarrow> 0 \<le> c \<and> c < length (getF state) remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<forall>c l. (c \<in> set (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') l)) = (Some l = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') c \<or> Some l = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') c) [PROOF STEP] by (auto simp add:Let_def) [PROOF STATE] proof (state) this: InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantWatchCharacterization (getF ?state') (getWatch1 ?state') (getWatch2 ?state') (getM ?state')" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] proof- [PROOF STATE] proof (state) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] { [PROOF STATE] proof (state) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] fix c [PROOF STATE] proof (state) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] assume "0 \<le> c \<and> c < length (getF ?state')" [PROOF STATE] proof (state) this: 0 \<le> c \<and> c < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] fix www1 www2 [PROOF STATE] proof (state) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] assume "Some www1 = (getWatch1 ?state' c)" "Some www2 = (getWatch2 ?state' c)" [PROOF STATE] proof (state) this: Some www1 = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c Some www2 = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c goal (1 subgoal): 1. InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] have "watchCharacterizationCondition www1 www2 (getM ?state') (nth (getF ?state') c) \<and> watchCharacterizationCondition www2 www1 (getM ?state') (nth (getF ?state') c)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] proof (cases "c < length (getF state)") [PROOF STATE] proof (state) goal (2 subgoals): 1. c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) 2. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] case True [PROOF STATE] proof (state) this: c < length (getF state) goal (2 subgoals): 1. c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) 2. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] hence "(nth (getF ?state') c) = (nth (getF state) c)" [PROOF STATE] proof (prove) using this: c < length (getF state) goal (1 subgoal): 1. getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c = getF state ! c [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: c < length (getF state) goal (1 subgoal): 1. getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c = getF state ! c [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: c < length (getF state) goal (1 subgoal): 1. getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c = getF state ! c [PROOF STEP] by (auto simp add: Let_def nth_append) [PROOF STATE] proof (state) this: getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c = getF state ! c goal (2 subgoals): 1. c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) 2. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] have "Some www1 = (getWatch1 state c)" "Some www2 = (getWatch2 state c)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. Some www1 = getWatch1 state c &&& Some www2 = getWatch2 state c [PROOF STEP] using True [PROOF STATE] proof (prove) using this: c < length (getF state) goal (1 subgoal): 1. Some www1 = getWatch1 state c &&& Some www2 = getWatch2 state c [PROOF STEP] using \<open>Some www1 = (getWatch1 ?state' c)\<close> \<open>Some www2 = (getWatch2 ?state' c)\<close> [PROOF STATE] proof (prove) using this: c < length (getF state) Some www1 = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c Some www2 = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c goal (1 subgoal): 1. Some www1 = getWatch1 state c &&& Some www2 = getWatch2 state c [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: c < length (getF state) Some www1 = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c Some www2 = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c goal (1 subgoal): 1. Some www1 = getWatch1 state c &&& Some www2 = getWatch2 state c [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: c < length (getF state) Some www1 = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') c Some www2 = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') c goal (1 subgoal): 1. Some www1 = getWatch1 state c &&& Some www2 = getWatch2 state c [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: Some www1 = getWatch1 state c Some www2 = getWatch2 state c goal (2 subgoals): 1. c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) 2. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: Some www1 = getWatch1 state c Some www2 = getWatch2 state c goal (1 subgoal): 1. watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] using \<open>InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state)\<close> [PROOF STATE] proof (prove) using this: Some www1 = getWatch1 state c Some www2 = getWatch2 state c InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) goal (1 subgoal): 1. watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] unfolding InvariantWatchCharacterization_def [PROOF STATE] proof (prove) using this: Some www1 = getWatch1 state c Some www2 = getWatch2 state c \<forall>c w1 w2. 0 \<le> c \<and> c < length (getF state) \<and> Some w1 = getWatch1 state c \<and> Some w2 = getWatch2 state c \<longrightarrow> watchCharacterizationCondition w1 w2 (getM state) (getF state ! c) \<and> watchCharacterizationCondition w2 w1 (getM state) (getF state ! c) goal (1 subgoal): 1. watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] using \<open>(nth (getF ?state') c) = (nth (getF state) c)\<close> [PROOF STATE] proof (prove) using this: Some www1 = getWatch1 state c Some www2 = getWatch2 state c \<forall>c w1 w2. 0 \<le> c \<and> c < length (getF state) \<and> Some w1 = getWatch1 state c \<and> Some w2 = getWatch2 state c \<longrightarrow> watchCharacterizationCondition w1 w2 (getM state) (getF state ! c) \<and> watchCharacterizationCondition w2 w1 (getM state) (getF state ! c) getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c = getF state ! c goal (1 subgoal): 1. watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] using True [PROOF STATE] proof (prove) using this: Some www1 = getWatch1 state c Some www2 = getWatch2 state c \<forall>c w1 w2. 0 \<le> c \<and> c < length (getF state) \<and> Some w1 = getWatch1 state c \<and> Some w2 = getWatch2 state c \<longrightarrow> watchCharacterizationCondition w1 w2 (getM state) (getF state ! c) \<and> watchCharacterizationCondition w2 w1 (getM state) (getF state ! c) getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c = getF state ! c c < length (getF state) goal (1 subgoal): 1. watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: Some www1 = getWatch1 state c Some www2 = getWatch2 state c \<forall>c w1 w2. 0 \<le> c \<and> c < length (getF state) \<and> Some w1 = getWatch1 state c \<and> Some w2 = getWatch2 state c \<longrightarrow> watchCharacterizationCondition w1 w2 (getM state) (getF state ! c) \<and> watchCharacterizationCondition w2 w1 (getM state) (getF state ! c) getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c = getF state ! c c < length (getF state) goal (1 subgoal): 1. watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: Some www1 = getWatch1 state c Some www2 = getWatch2 state c \<forall>c w1 w2. 0 \<le> c \<and> c < length (getF state) \<and> Some w1 = getWatch1 state c \<and> Some w2 = getWatch2 state c \<longrightarrow> watchCharacterizationCondition w1 w2 (getM state) (getF state ! c) \<and> watchCharacterizationCondition w2 w1 (getM state) (getF state ! c) getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c = getF state ! c c < length (getF state) goal (1 subgoal): 1. watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c) [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) goal (1 subgoal): 1. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] case False [PROOF STATE] proof (state) this: \<not> c < length (getF state) goal (1 subgoal): 1. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] with \<open>0 \<le> c \<and> c < length (getF ?state')\<close> [PROOF STATE] proof (chain) picking this: 0 \<le> c \<and> c < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<not> c < length (getF state) [PROOF STEP] have "c = length (getF state)" [PROOF STATE] proof (prove) using this: 0 \<le> c \<and> c < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<not> c < length (getF state) goal (1 subgoal): 1. c = length (getF state) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: 0 \<le> c \<and> c < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<not> c < length (getF state) goal (1 subgoal): 1. c = length (getF state) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: 0 \<le> c \<and> c < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<not> c < length (getF state) goal (1 subgoal): 1. c = length (getF state) [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: c = length (getF state) goal (1 subgoal): 1. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] from \<open>InvariantWatchesEl (getF ?state') (getWatch1 ?state') (getWatch2 ?state')\<close> [PROOF STATE] proof (chain) picking this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] obtain w1 w2 where "w1 el ?clause'" "w2 el ?clause'" "getWatch1 ?state' (length (getF state)) = Some w1" "getWatch2 ?state' (length (getF state)) = Some w2" [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. (\<And>w1 w2. \<lbrakk>w1 el remdups (removeFalseLiterals clause (elements (getM state))); w2 el remdups (removeFalseLiterals clause (elements (getM state))); getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w1; getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] unfolding InvariantWatchesEl_def [PROOF STATE] proof (prove) using this: \<forall>clausea. 0 \<le> clausea \<and> clausea < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<longrightarrow> (\<exists>w1 w2. getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') clausea = Some w1 \<and> getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') clausea = Some w2 \<and> w1 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! clausea \<and> w2 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! clausea) goal (1 subgoal): 1. (\<And>w1 w2. \<lbrakk>w1 el remdups (removeFalseLiterals clause (elements (getM state))); w2 el remdups (removeFalseLiterals clause (elements (getM state))); getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w1; getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: \<forall>clausea. 0 \<le> clausea \<and> clausea < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<longrightarrow> (\<exists>w1 w2. getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') clausea = Some w1 \<and> getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') clausea = Some w2 \<and> w1 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! clausea \<and> w2 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! clausea) goal (1 subgoal): 1. (\<And>w1 w2. \<lbrakk>w1 el remdups (removeFalseLiterals clause (elements (getM state))); w2 el remdups (removeFalseLiterals clause (elements (getM state))); getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') (length (getF state)) = Some w1; getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') (length (getF state)) = Some w2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: \<forall>clausea. 0 \<le> clausea \<and> clausea < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<longrightarrow> (\<exists>w1 w2. getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') clausea = Some w1 \<and> getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') clausea = Some w2 \<and> w1 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! clausea \<and> w2 el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! clausea) goal (1 subgoal): 1. (\<And>w1 w2. \<lbrakk>w1 el remdups (removeFalseLiterals clause (elements (getM state))); w2 el remdups (removeFalseLiterals clause (elements (getM state))); getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') (length (getF state)) = Some w1; getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') (length (getF state)) = Some w2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: w1 el remdups (removeFalseLiterals clause (elements (getM state))) w2 el remdups (removeFalseLiterals clause (elements (getM state))) getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w1 getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w2 goal (1 subgoal): 1. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] hence "w1 = www1" and "w2 = www2" [PROOF STATE] proof (prove) using this: w1 el remdups (removeFalseLiterals clause (elements (getM state))) w2 el remdups (removeFalseLiterals clause (elements (getM state))) getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w1 getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w2 goal (1 subgoal): 1. w1 = www1 &&& w2 = www2 [PROOF STEP] using \<open>Some www1 = (getWatch1 ?state' c)\<close> \<open>Some www2 = (getWatch2 ?state' c)\<close> [PROOF STATE] proof (prove) using this: w1 el remdups (removeFalseLiterals clause (elements (getM state))) w2 el remdups (removeFalseLiterals clause (elements (getM state))) getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w1 getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w2 Some www1 = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c Some www2 = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c goal (1 subgoal): 1. w1 = www1 &&& w2 = www2 [PROOF STEP] using \<open>c = length (getF state)\<close> [PROOF STATE] proof (prove) using this: w1 el remdups (removeFalseLiterals clause (elements (getM state))) w2 el remdups (removeFalseLiterals clause (elements (getM state))) getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w1 getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') (length (getF state)) = Some w2 Some www1 = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c Some www2 = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c c = length (getF state) goal (1 subgoal): 1. w1 = www1 &&& w2 = www2 [PROOF STEP] by auto [PROOF STATE] proof (state) this: w1 = www1 w2 = www2 goal (1 subgoal): 1. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] have "\<not> literalFalse w1 (elements (getM ?state'))" "\<not> literalFalse w2 (elements (getM ?state'))" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) &&& \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) [PROOF STEP] using \<open>w1 el ?clause'\<close> \<open>w2 el ?clause'\<close> [PROOF STATE] proof (prove) using this: w1 el remdups (removeFalseLiterals clause (elements (getM state))) w2 el remdups (removeFalseLiterals clause (elements (getM state))) goal (1 subgoal): 1. \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) &&& \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) [PROOF STEP] using * [PROOF STATE] proof (prove) using this: w1 el remdups (removeFalseLiterals clause (elements (getM state))) w2 el remdups (removeFalseLiterals clause (elements (getM state))) \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) goal (1 subgoal): 1. \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) &&& \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: w1 el remdups (removeFalseLiterals clause (elements (getM state))) w2 el remdups (removeFalseLiterals clause (elements (getM state))) \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) goal (1 subgoal): 1. \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) &&& \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: w1 el remdups (removeFalseLiterals clause (elements (getM state))) w2 el remdups (removeFalseLiterals clause (elements (getM state))) \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) goal (1 subgoal): 1. \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) &&& \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) goal (1 subgoal): 1. \<not> c < length (getF state) \<Longrightarrow> watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) goal (1 subgoal): 1. watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] using \<open>w1 = www1\<close> \<open>w2 = www2\<close> [PROOF STATE] proof (prove) using this: \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) w1 = www1 w2 = www2 goal (1 subgoal): 1. watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] unfolding watchCharacterizationCondition_def [PROOF STATE] proof (prove) using this: \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) w1 = www1 w2 = www2 goal (1 subgoal): 1. (literalFalse www1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<longrightarrow> (\<exists>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c \<and> literalTrue l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<and> elementLevel l (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<le> elementLevel (opposite www1) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<or> (\<forall>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c \<and> l \<noteq> www1 \<and> l \<noteq> www2 \<longrightarrow> literalFalse l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<and> elementLevel (opposite l) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<le> elementLevel (opposite www1) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')))) \<and> (literalFalse www2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<longrightarrow> (\<exists>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c \<and> literalTrue l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<and> elementLevel l (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<le> elementLevel (opposite www2) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<or> (\<forall>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c \<and> l \<noteq> www2 \<and> l \<noteq> www1 \<longrightarrow> literalFalse l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) \<and> elementLevel (opposite l) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<le> elementLevel (opposite www2) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')))) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) w1 = www1 w2 = www2 goal (1 subgoal): 1. (literalFalse www1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<longrightarrow> (\<exists>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c \<and> literalTrue l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<and> elementLevel l (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<le> elementLevel (opposite www1) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<or> (\<forall>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c \<and> l \<noteq> www1 \<and> l \<noteq> www2 \<longrightarrow> literalFalse l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<and> elementLevel (opposite l) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<le> elementLevel (opposite www1) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')))) \<and> (literalFalse www2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<longrightarrow> (\<exists>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c \<and> literalTrue l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<and> elementLevel l (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<le> elementLevel (opposite www2) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<or> (\<forall>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c \<and> l \<noteq> www2 \<and> l \<noteq> www1 \<longrightarrow> literalFalse l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<and> elementLevel (opposite l) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<le> elementLevel (opposite www2) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')))) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: \<not> literalFalse w1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<not> literalFalse w2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) w1 = www1 w2 = www2 goal (1 subgoal): 1. (literalFalse www1 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<longrightarrow> (\<exists>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c \<and> literalTrue l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<and> elementLevel l (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<le> elementLevel (opposite www1) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<or> (\<forall>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c \<and> l \<noteq> www1 \<and> l \<noteq> www2 \<longrightarrow> literalFalse l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<and> elementLevel (opposite l) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<le> elementLevel (opposite www1) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')))) \<and> (literalFalse www2 (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<longrightarrow> (\<exists>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c \<and> literalTrue l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<and> elementLevel l (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<le> elementLevel (opposite www2) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<or> (\<forall>l. l el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! c \<and> l \<noteq> www2 \<and> l \<noteq> www1 \<longrightarrow> literalFalse l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<and> elementLevel (opposite l) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<le> elementLevel (opposite www2) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')))) [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: watchCharacterizationCondition www1 www2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition www2 www1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] } [PROOF STATE] proof (state) this: \<lbrakk>0 \<le> ?c2 \<and> ?c2 < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')); Some ?www1.2 = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ?c2; Some ?www2.2 = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ?c2\<rbrakk> \<Longrightarrow> watchCharacterizationCondition ?www1.2 ?www2.2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! ?c2) \<and> watchCharacterizationCondition ?www2.2 ?www1.2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! ?c2) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: \<lbrakk>0 \<le> ?c2 \<and> ?c2 < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')); Some ?www1.2 = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ?c2; Some ?www2.2 = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ?c2\<rbrakk> \<Longrightarrow> watchCharacterizationCondition ?www1.2 ?www2.2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! ?c2) \<and> watchCharacterizationCondition ?www2.2 ?www1.2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! ?c2) goal (1 subgoal): 1. InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] unfolding InvariantWatchCharacterization_def [PROOF STATE] proof (prove) using this: \<lbrakk>0 \<le> ?c2 \<and> ?c2 < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')); Some ?www1.2 = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ?c2; Some ?www2.2 = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ?c2\<rbrakk> \<Longrightarrow> watchCharacterizationCondition ?www1.2 ?www2.2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! ?c2) \<and> watchCharacterizationCondition ?www2.2 ?www1.2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! ?c2) goal (1 subgoal): 1. \<forall>c w1 w2. 0 \<le> c \<and> c < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) \<and> Some w1 = getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c \<and> Some w2 = getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') c \<longrightarrow> watchCharacterizationCondition w1 w2 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) \<and> watchCharacterizationCondition w2 w1 (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') ! c) [PROOF STEP] by auto [PROOF STATE] proof (state) this: InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "\<forall> l. length (getF state) \<notin> set (getWatchList state l)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<forall>l. length (getF state) \<notin> set (getWatchList state l) [PROOF STEP] using \<open>InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state)\<close> [PROOF STATE] proof (prove) using this: InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) goal (1 subgoal): 1. \<forall>l. length (getF state) \<notin> set (getWatchList state l) [PROOF STEP] unfolding InvariantWatchListsContainOnlyClausesFromF_def [PROOF STATE] proof (prove) using this: \<forall>l c. c \<in> set (getWatchList state l) \<longrightarrow> 0 \<le> c \<and> c < length (getF state) goal (1 subgoal): 1. \<forall>l. length (getF state) \<notin> set (getWatchList state l) [PROOF STEP] by auto [PROOF STATE] proof (state) this: \<forall>l. length (getF state) \<notin> set (getWatchList state l) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] hence "InvariantWatchListsUniq (getWatchList ?state')" [PROOF STATE] proof (prove) using this: \<forall>l. length (getF state) \<notin> set (getWatchList state l) goal (1 subgoal): 1. InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>InvariantWatchListsUniq (getWatchList state)\<close> [PROOF STATE] proof (prove) using this: \<forall>l. length (getF state) \<notin> set (getWatchList state l) InvariantWatchListsUniq (getWatchList state) goal (1 subgoal): 1. InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>nth ?clause' 0 \<noteq> nth ?clause' 1\<close> [PROOF STATE] proof (prove) using this: \<forall>l. length (getF state) \<notin> set (getWatchList state l) InvariantWatchListsUniq (getWatchList state) remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] unfolding InvariantWatchListsUniq_def [PROOF STATE] proof (prove) using this: \<forall>l. length (getF state) \<notin> set (getWatchList state l) \<forall>l. uniq (getWatchList state l) remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<forall>l. uniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') l) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: \<forall>l. length (getF state) \<notin> set (getWatchList state l) \<forall>l. uniq (getWatchList state l) remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<forall>l. uniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') l) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: \<forall>l. length (getF state) \<notin> set (getWatchList state l) \<forall>l. uniq (getWatchList state l) remdups (removeFalseLiterals clause (elements (getM state))) ! 0 \<noteq> remdups (removeFalseLiterals clause (elements (getM state))) ! 1 goal (1 subgoal): 1. \<forall>l. uniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') l) [PROOF STEP] by (auto simp add:Let_def uniqAppendIff) [PROOF STATE] proof (state) this: InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] from * [PROOF STATE] proof (chain) picking this: \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) [PROOF STEP] have "\<not> clauseFalse ?clause' (elements (getM state))" [PROOF STATE] proof (prove) using this: \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) goal (1 subgoal): 1. \<not> clauseFalse (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) [PROOF STEP] using \<open>?clause' \<noteq> []\<close> [PROOF STATE] proof (prove) using this: \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. \<not> clauseFalse (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) [PROOF STEP] by (auto simp add: clauseFalseIffAllLiteralsAreFalse) [PROOF STATE] proof (state) this: \<not> clauseFalse (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] hence "InvariantConflictFlagCharacterization (getConflictFlag ?state') (getF ?state') (getM ?state')" [PROOF STATE] proof (prove) using this: \<not> clauseFalse (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using \<open>InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state)\<close> [PROOF STATE] proof (prove) using this: \<not> clauseFalse (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) goal (1 subgoal): 1. InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] unfolding InvariantConflictFlagCharacterization_def [PROOF STATE] proof (prove) using this: \<not> clauseFalse (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) getConflictFlag state = formulaFalse (getF state) (elements (getM state)) goal (1 subgoal): 1. getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') = formulaFalse (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: \<not> clauseFalse (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) getConflictFlag state = formulaFalse (getF state) (elements (getM state)) goal (1 subgoal): 1. getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') = formulaFalse (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: \<not> clauseFalse (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) getConflictFlag state = formulaFalse (getF state) (elements (getM state)) goal (1 subgoal): 1. getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') = formulaFalse (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) [PROOF STEP] by (auto simp add: Let_def formulaFalseIffContainsFalseClause) [PROOF STATE] proof (state) this: InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "\<not> (\<exists> l. isUnitClause ?clause' l (elements (getM state)))" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] proof- [PROOF STATE] proof (state) goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] { [PROOF STATE] proof (state) goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] assume "\<not> ?thesis" [PROOF STATE] proof (state) this: \<not> (\<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state))) goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] then [PROOF STATE] proof (chain) picking this: \<not> (\<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state))) [PROOF STEP] obtain l where "isUnitClause ?clause' l (elements (getM state))" [PROOF STATE] proof (prove) using this: \<not> (\<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state))) goal (1 subgoal): 1. (\<And>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] by auto [PROOF STATE] proof (state) this: isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] hence "l el ?clause'" [PROOF STATE] proof (prove) using this: isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) goal (1 subgoal): 1. l el remdups (removeFalseLiterals clause (elements (getM state))) [PROOF STEP] unfolding isUnitClause_def [PROOF STATE] proof (prove) using this: l el remdups (removeFalseLiterals clause (elements (getM state))) \<and> \<not> literalTrue l (elements (getM state)) \<and> \<not> literalFalse l (elements (getM state)) \<and> (\<forall>literal. literal el remdups (removeFalseLiterals clause (elements (getM state))) \<and> literal \<noteq> l \<longrightarrow> literalFalse literal (elements (getM state))) goal (1 subgoal): 1. l el remdups (removeFalseLiterals clause (elements (getM state))) [PROOF STEP] by simp [PROOF STATE] proof (state) this: l el remdups (removeFalseLiterals clause (elements (getM state))) goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] have "\<exists> l'. l' el ?clause' \<and> l \<noteq> l'" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] proof- [PROOF STATE] proof (state) goal (1 subgoal): 1. \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] from \<open>length ?clause' > 1\<close> [PROOF STATE] proof (chain) picking this: 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) [PROOF STEP] obtain a1::Literal and a2::Literal where "a1 el ?clause'" "a2 el ?clause'" "a1 \<noteq> a2" [PROOF STATE] proof (prove) using this: 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. (\<And>a1 a2. \<lbrakk>a1 el remdups (removeFalseLiterals clause (elements (getM state))); a2 el remdups (removeFalseLiterals clause (elements (getM state))); a1 \<noteq> a2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] using lengthGtOneTwoDistinctElements[of "?clause'"] [PROOF STATE] proof (prove) using this: 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) \<lbrakk>uniq (remdups (removeFalseLiterals clause (elements (getM state)))); 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))); remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> []\<rbrakk> \<Longrightarrow> \<exists>a1 a2. a1 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) \<and> a2 \<in> set (remdups (removeFalseLiterals clause (elements (getM state)))) \<and> a1 \<noteq> a2 goal (1 subgoal): 1. (\<And>a1 a2. \<lbrakk>a1 el remdups (removeFalseLiterals clause (elements (getM state))); a2 el remdups (removeFalseLiterals clause (elements (getM state))); a1 \<noteq> a2\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] by (auto simp add: uniqDistinct) (force) [PROOF STATE] proof (state) this: a1 el remdups (removeFalseLiterals clause (elements (getM state))) a2 el remdups (removeFalseLiterals clause (elements (getM state))) a1 \<noteq> a2 goal (1 subgoal): 1. \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: a1 el remdups (removeFalseLiterals clause (elements (getM state))) a2 el remdups (removeFalseLiterals clause (elements (getM state))) a1 \<noteq> a2 goal (1 subgoal): 1. \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] proof (cases "a1 = l") [PROOF STATE] proof (state) goal (2 subgoals): 1. \<lbrakk>a1 el remdups (removeFalseLiterals clause (elements (getM state))); a2 el remdups (removeFalseLiterals clause (elements (getM state))); a1 \<noteq> a2; a1 = l\<rbrakk> \<Longrightarrow> \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' 2. \<lbrakk>a1 el remdups (removeFalseLiterals clause (elements (getM state))); a2 el remdups (removeFalseLiterals clause (elements (getM state))); a1 \<noteq> a2; a1 \<noteq> l\<rbrakk> \<Longrightarrow> \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] case True [PROOF STATE] proof (state) this: a1 = l goal (2 subgoals): 1. \<lbrakk>a1 el remdups (removeFalseLiterals clause (elements (getM state))); a2 el remdups (removeFalseLiterals clause (elements (getM state))); a1 \<noteq> a2; a1 = l\<rbrakk> \<Longrightarrow> \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' 2. \<lbrakk>a1 el remdups (removeFalseLiterals clause (elements (getM state))); a2 el remdups (removeFalseLiterals clause (elements (getM state))); a1 \<noteq> a2; a1 \<noteq> l\<rbrakk> \<Longrightarrow> \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: a1 = l goal (1 subgoal): 1. \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] using \<open>a1 \<noteq> a2\<close> \<open>a2 el ?clause'\<close> [PROOF STATE] proof (prove) using this: a1 = l a1 \<noteq> a2 a2 el remdups (removeFalseLiterals clause (elements (getM state))) goal (1 subgoal): 1. \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] by auto [PROOF STATE] proof (state) this: \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' goal (1 subgoal): 1. \<lbrakk>a1 el remdups (removeFalseLiterals clause (elements (getM state))); a2 el remdups (removeFalseLiterals clause (elements (getM state))); a1 \<noteq> a2; a1 \<noteq> l\<rbrakk> \<Longrightarrow> \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. \<lbrakk>a1 el remdups (removeFalseLiterals clause (elements (getM state))); a2 el remdups (removeFalseLiterals clause (elements (getM state))); a1 \<noteq> a2; a1 \<noteq> l\<rbrakk> \<Longrightarrow> \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] case False [PROOF STATE] proof (state) this: a1 \<noteq> l goal (1 subgoal): 1. \<lbrakk>a1 el remdups (removeFalseLiterals clause (elements (getM state))); a2 el remdups (removeFalseLiterals clause (elements (getM state))); a1 \<noteq> a2; a1 \<noteq> l\<rbrakk> \<Longrightarrow> \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: a1 \<noteq> l goal (1 subgoal): 1. \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] using \<open>a1 el ?clause'\<close> [PROOF STATE] proof (prove) using this: a1 \<noteq> l a1 el remdups (removeFalseLiterals clause (elements (getM state))) goal (1 subgoal): 1. \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] by auto [PROOF STATE] proof (state) this: \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] then [PROOF STATE] proof (chain) picking this: \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' [PROOF STEP] obtain l'::Literal where "l \<noteq> l'" "l' el ?clause'" [PROOF STATE] proof (prove) using this: \<exists>l'. l' el remdups (removeFalseLiterals clause (elements (getM state))) \<and> l \<noteq> l' goal (1 subgoal): 1. (\<And>l'. \<lbrakk>l \<noteq> l'; l' el remdups (removeFalseLiterals clause (elements (getM state)))\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis [PROOF STEP] by auto [PROOF STATE] proof (state) this: l \<noteq> l' l' el remdups (removeFalseLiterals clause (elements (getM state))) goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] with * [PROOF STATE] proof (chain) picking this: \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) l \<noteq> l' l' el remdups (removeFalseLiterals clause (elements (getM state))) [PROOF STEP] have "\<not> literalFalse l' (elements (getM state))" [PROOF STATE] proof (prove) using this: \<forall>l. l el remdups (removeFalseLiterals clause (elements (getM state))) \<longrightarrow> \<not> literalFalse l (elements (getM state)) l \<noteq> l' l' el remdups (removeFalseLiterals clause (elements (getM state))) goal (1 subgoal): 1. \<not> literalFalse l' (elements (getM state)) [PROOF STEP] by simp [PROOF STATE] proof (state) this: \<not> literalFalse l' (elements (getM state)) goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] hence "False" [PROOF STATE] proof (prove) using this: \<not> literalFalse l' (elements (getM state)) goal (1 subgoal): 1. False [PROOF STEP] using \<open>isUnitClause ?clause' l (elements (getM state))\<close> [PROOF STATE] proof (prove) using this: \<not> literalFalse l' (elements (getM state)) isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) goal (1 subgoal): 1. False [PROOF STEP] using \<open>l \<noteq> l'\<close> \<open>l' el ?clause'\<close> [PROOF STATE] proof (prove) using this: \<not> literalFalse l' (elements (getM state)) isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) l \<noteq> l' l' el remdups (removeFalseLiterals clause (elements (getM state))) goal (1 subgoal): 1. False [PROOF STEP] unfolding isUnitClause_def [PROOF STATE] proof (prove) using this: \<not> literalFalse l' (elements (getM state)) l el remdups (removeFalseLiterals clause (elements (getM state))) \<and> \<not> literalTrue l (elements (getM state)) \<and> \<not> literalFalse l (elements (getM state)) \<and> (\<forall>literal. literal el remdups (removeFalseLiterals clause (elements (getM state))) \<and> literal \<noteq> l \<longrightarrow> literalFalse literal (elements (getM state))) l \<noteq> l' l' el remdups (removeFalseLiterals clause (elements (getM state))) goal (1 subgoal): 1. False [PROOF STEP] by auto [PROOF STATE] proof (state) this: False goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] } [PROOF STATE] proof (state) this: \<not> (\<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state))) \<Longrightarrow> False goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: \<not> (\<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state))) \<Longrightarrow> False goal (1 subgoal): 1. \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) [PROOF STEP] by auto [PROOF STATE] proof (state) this: \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] hence "InvariantQCharacterization (getConflictFlag ?state') (getQ ?state') (getF ?state') (getM ?state')" [PROOF STATE] proof (prove) using this: \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) [PROOF STEP] unfolding InvariantQCharacterization_def [PROOF STATE] proof (prove) using this: \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) \<not> getConflictFlag state \<longrightarrow> (\<forall>l. l el getQ state = (\<exists>c. c el getF state \<and> isUnitClause c l (elements (getM state)))) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. \<not> getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') \<longrightarrow> (\<forall>l. l el getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') = (\<exists>c. c el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''') \<and> isUnitClause c l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))))) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) \<not> getConflictFlag state \<longrightarrow> (\<forall>l. l el getQ state = (\<exists>c. c el getF state \<and> isUnitClause c l (elements (getM state)))) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. \<not> getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') \<longrightarrow> (\<forall>l. l el getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') = (\<exists>c. c el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') \<and> isUnitClause c l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))))) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: \<nexists>l. isUnitClause (remdups (removeFalseLiterals clause (elements (getM state)))) l (elements (getM state)) InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) \<not> getConflictFlag state \<longrightarrow> (\<forall>l. l el getQ state = (\<exists>c. c el getF state \<and> isUnitClause c l (elements (getM state)))) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. \<not> getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') \<longrightarrow> (\<forall>l. l el getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') = (\<exists>c. c el getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') \<and> isUnitClause c l (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))))) [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [?clause']) (getM state)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] proof (cases "getConflictFlag state") [PROOF STATE] proof (state) goal (2 subgoals): 1. getConflictFlag state \<Longrightarrow> InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) 2. \<not> getConflictFlag state \<Longrightarrow> InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] case False [PROOF STATE] proof (state) this: \<not> getConflictFlag state goal (2 subgoals): 1. getConflictFlag state \<Longrightarrow> InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) 2. \<not> getConflictFlag state \<Longrightarrow> InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: \<not> getConflictFlag state goal (1 subgoal): 1. InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] unfolding InvariantConflictClauseCharacterization_def [PROOF STATE] proof (prove) using this: \<not> getConflictFlag state goal (1 subgoal): 1. getConflictFlag state \<longrightarrow> getConflictClause state < length (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) \<and> clauseFalse ((getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) ! getConflictClause state) (elements (getM state)) [PROOF STEP] by simp [PROOF STATE] proof (state) this: InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) goal (1 subgoal): 1. getConflictFlag state \<Longrightarrow> InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] next [PROOF STATE] proof (state) goal (1 subgoal): 1. getConflictFlag state \<Longrightarrow> InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] case True [PROOF STATE] proof (state) this: getConflictFlag state goal (1 subgoal): 1. getConflictFlag state \<Longrightarrow> InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] hence "getConflictClause state < length (getF state)" [PROOF STATE] proof (prove) using this: getConflictFlag state goal (1 subgoal): 1. getConflictClause state < length (getF state) [PROOF STEP] using \<open>InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state)\<close> [PROOF STATE] proof (prove) using this: getConflictFlag state InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) goal (1 subgoal): 1. getConflictClause state < length (getF state) [PROOF STEP] unfolding InvariantConflictClauseCharacterization_def [PROOF STATE] proof (prove) using this: getConflictFlag state getConflictFlag state \<longrightarrow> getConflictClause state < length (getF state) \<and> clauseFalse (getF state ! getConflictClause state) (elements (getM state)) goal (1 subgoal): 1. getConflictClause state < length (getF state) [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: getConflictClause state < length (getF state) goal (1 subgoal): 1. getConflictFlag state \<Longrightarrow> InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] hence "nth ((getF state) @ [?clause']) (getConflictClause state) = nth (getF state) (getConflictClause state)" [PROOF STATE] proof (prove) using this: getConflictClause state < length (getF state) goal (1 subgoal): 1. (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) ! getConflictClause state = getF state ! getConflictClause state [PROOF STEP] by (simp add: nth_append) [PROOF STATE] proof (state) this: (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) ! getConflictClause state = getF state ! getConflictClause state goal (1 subgoal): 1. getConflictFlag state \<Longrightarrow> InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] thus ?thesis [PROOF STATE] proof (prove) using this: (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) ! getConflictClause state = getF state ! getConflictClause state goal (1 subgoal): 1. InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] using \<open>InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state)\<close> [PROOF STATE] proof (prove) using this: (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) ! getConflictClause state = getF state ! getConflictClause state InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) goal (1 subgoal): 1. InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) [PROOF STEP] unfolding InvariantConflictClauseCharacterization_def [PROOF STATE] proof (prove) using this: (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) ! getConflictClause state = getF state ! getConflictClause state getConflictFlag state \<longrightarrow> getConflictClause state < length (getF state) \<and> clauseFalse (getF state ! getConflictClause state) (elements (getM state)) goal (1 subgoal): 1. getConflictFlag state \<longrightarrow> getConflictClause state < length (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) \<and> clauseFalse ((getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) ! getConflictClause state) (elements (getM state)) [PROOF STEP] by (auto simp add: Let_def clauseFalseAppendValuation) [PROOF STATE] proof (state) this: InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantGetReasonIsReason (getReason ?state') (getF ?state') (getM ?state') (set (getQ ?state'))" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) [PROOF STEP] using \<open>currentLevel (getM state) = 0\<close> [PROOF STATE] proof (prove) using this: currentLevel (getM state) = 0 goal (1 subgoal): 1. InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) [PROOF STEP] using elementLevelLeqCurrentLevel[of _ "getM state"] [PROOF STATE] proof (prove) using this: currentLevel (getM state) = 0 elementLevel ?a (getM state) \<le> currentLevel (getM state) goal (1 subgoal): 1. InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: currentLevel (getM state) = 0 elementLevel ?a (getM state) \<le> currentLevel (getM state) goal (1 subgoal): 1. InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: currentLevel (getM state) = 0 elementLevel ?a (getM state) \<le> currentLevel (getM state) goal (1 subgoal): 1. InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) [PROOF STEP] unfolding InvariantGetReasonIsReason_def [PROOF STATE] proof (prove) using this: currentLevel (getM state) = 0 elementLevel ?a (getM state) \<le> currentLevel (getM state) goal (1 subgoal): 1. \<forall>literal. (literal el elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<and> \<not> literal el decisions (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<and> 0 < elementLevel literal (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<longrightarrow> (\<exists>reason. getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') literal = Some reason \<and> 0 \<le> reason \<and> reason < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<and> isReason (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! reason) literal (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))))) \<and> (0 < currentLevel (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<and> literal \<in> set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<longrightarrow> (\<exists>reason. getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') literal = Some reason \<and> 0 \<le> reason \<and> reason < length (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<and> (isUnitClause (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! reason) literal (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) \<or> clauseFalse (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''') ! reason) (elements (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')))))) [PROOF STEP] by (simp add: Let_def) [PROOF STATE] proof (state) this: InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] moreover [PROOF STATE] proof (state) this: InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] have "InvariantVarsF (getF ?state') F0 Vbl" [PROOF STATE] proof (prove) goal (1 subgoal): 1. InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl [PROOF STEP] using \<open>InvariantVarsF (getF state) F0 Vbl\<close> [PROOF STATE] proof (prove) using this: InvariantVarsF (getF state) F0 Vbl goal (1 subgoal): 1. InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl [PROOF STEP] using \<open>vars ?clause' \<subseteq> vars F0\<close> [PROOF STATE] proof (prove) using this: InvariantVarsF (getF state) F0 Vbl vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars F0 goal (1 subgoal): 1. InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl [PROOF STEP] using varsAppendFormulae[of "getF state" "[?clause']"] [PROOF STATE] proof (prove) using this: InvariantVarsF (getF state) F0 Vbl vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars F0 vars (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) = vars (getF state) \<union> vars [remdups (removeFalseLiterals clause (elements (getM state)))] goal (1 subgoal): 1. InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: InvariantVarsF (getF state) F0 Vbl vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars F0 vars (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) = vars (getF state) \<union> vars [remdups (removeFalseLiterals clause (elements (getM state)))] goal (1 subgoal): 1. InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) F0 Vbl [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: InvariantVarsF (getF state) F0 Vbl vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars F0 vars (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) = vars (getF state) \<union> vars [remdups (removeFalseLiterals clause (elements (getM state)))] goal (1 subgoal): 1. InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) F0 Vbl [PROOF STEP] unfolding InvariantVarsF_def [PROOF STATE] proof (prove) using this: vars (getF state) \<subseteq> vars F0 \<union> Vbl vars (remdups (removeFalseLiterals clause (elements (getM state)))) \<subseteq> vars F0 vars (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) = vars (getF state) \<union> vars [remdups (removeFalseLiterals clause (elements (getM state)))] goal (1 subgoal): 1. vars (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) \<subseteq> vars F0 \<union> Vbl [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl goal (1 subgoal): 1. \<lbrakk>length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1; \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state))))\<rbrakk> \<Longrightarrow> let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] ultimately [PROOF STATE] proof (chain) picking this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl [PROOF STEP] show ?thesis [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using \<open>length ?clause' > 1\<close> [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using \<open>\<not> ?clause' = []\<close> [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using \<open>\<not> clauseTrue ?clause' (elements (getM state))\<close> [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using \<open>length ?clause' \<noteq> 1\<close> [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] using \<open>\<not> clauseTautology ?clause'\<close> [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] unfolding addClause_def [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = setWatch1 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 0) state'; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. let state' = let clause' = remdups (removeFalseLiterals clause (elements (getM state))) in if clauseTrue clause' (elements (getM state)) then state else if clause' = [] then state\<lparr>getSATFlag := FALSE\<rparr> else if length clause' = 1 then Let (assertLiteral (hd clause') False state) exhaustiveUnitPropagate else if clauseTautology clause' then state else let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [clause']\<rparr>; state'' = setWatch1 clauseIndex (clause' ! 0) state'; state''' = setWatch2 clauseIndex (clause' ! 1) state'' in state''' in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] unfolding setWatch1_def [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = setWatch2 clauseIndex (remdups (removeFalseLiterals clause (elements (getM state))) ! 1) state'' in state''')) F0 Vbl InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. let state' = let clause' = remdups (removeFalseLiterals clause (elements (getM state))) in if clauseTrue clause' (elements (getM state)) then state else if clause' = [] then state\<lparr>getSATFlag := FALSE\<rparr> else if length clause' = 1 then Let (assertLiteral (hd clause') False state) exhaustiveUnitPropagate else if clauseTautology clause' then state else let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [clause']\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> clause' ! 0), getWatchList := (getWatchList state')(clause' ! 0 := clauseIndex # getWatchList state' (clause' ! 0))\<rparr>; state''' = setWatch2 clauseIndex (clause' ! 1) state'' in state''' in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] unfolding setWatch2_def [PROOF STATE] proof (prove) using this: InvariantWatchesEl (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) InvariantWatchesDiffer (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) InvariantWatchListsContainOnlyClausesFromF (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) InvariantWatchListsCharacterization (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) InvariantWatchCharacterization (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getWatch1 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getWatch2 (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) InvariantWatchListsUniq (getWatchList (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) InvariantConflictFlagCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) InvariantQCharacterization (getConflictFlag (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]) (getM state) InvariantGetReasonIsReason (getReason (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (getM (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) (set (getQ (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state'''))) InvariantVarsF (getF (let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [remdups (removeFalseLiterals clause (elements (getM state)))]\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 0), getWatchList := (getWatchList state')(remdups (removeFalseLiterals clause (elements (getM state))) ! 0 := clauseIndex # getWatchList state' (remdups (removeFalseLiterals clause (elements (getM state))) ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> remdups (removeFalseLiterals clause (elements (getM state))) ! 1), getWatchList := (getWatchList state'')(remdups (removeFalseLiterals clause (elements (getM state))) ! 1 := clauseIndex # getWatchList state'' (remdups (removeFalseLiterals clause (elements (getM state))) ! 1))\<rparr> in state''')) F0 Vbl InvariantConsistent (getM state) InvariantUniq (getM state) InvariantWatchListsContainOnlyClausesFromF (getWatchList state) (getF state) InvariantWatchListsUniq (getWatchList state) InvariantWatchListsCharacterization (getWatchList state) (getWatch1 state) (getWatch2 state) InvariantWatchesEl (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchesDiffer (getF state) (getWatch1 state) (getWatch2 state) InvariantWatchCharacterization (getF state) (getWatch1 state) (getWatch2 state) (getM state) InvariantConflictFlagCharacterization (getConflictFlag state) (getF state) (getM state) InvariantConflictClauseCharacterization (getConflictFlag state) (getConflictClause state) (getF state) (getM state) InvariantQCharacterization (getConflictFlag state) (getQ state) (getF state) (getM state) InvariantUniqQ (getQ state) InvariantGetReasonIsReason (getReason state) (getF state) (getM state) (set (getQ state)) currentLevel (getM state) = 0 getConflictFlag state \<or> getQ state = [] InvariantVarsM (getM state) F0 Vbl InvariantVarsQ (getQ state) F0 Vbl InvariantVarsF (getF state) F0 Vbl finite Vbl vars clause \<subseteq> vars F0 1 < length (remdups (removeFalseLiterals clause (elements (getM state)))) remdups (removeFalseLiterals clause (elements (getM state))) \<noteq> [] \<not> clauseTrue (remdups (removeFalseLiterals clause (elements (getM state)))) (elements (getM state)) length (remdups (removeFalseLiterals clause (elements (getM state)))) \<noteq> 1 \<not> clauseTautology (remdups (removeFalseLiterals clause (elements (getM state)))) goal (1 subgoal): 1. let state' = let clause' = remdups (removeFalseLiterals clause (elements (getM state))) in if clauseTrue clause' (elements (getM state)) then state else if clause' = [] then state\<lparr>getSATFlag := FALSE\<rparr> else if length clause' = 1 then Let (assertLiteral (hd clause') False state) exhaustiveUnitPropagate else if clauseTautology clause' then state else let clauseIndex = length (getF state); state' = state\<lparr>getF := getF state @ [clause']\<rparr>; state'' = state'\<lparr>getWatch1 := getWatch1 state'(clauseIndex \<mapsto> clause' ! 0), getWatchList := (getWatchList state')(clause' ! 0 := clauseIndex # getWatchList state' (clause' ! 0))\<rparr>; state''' = state''\<lparr>getWatch2 := getWatch2 state''(clauseIndex \<mapsto> clause' ! 1), getWatchList := (getWatchList state'')(clause' ! 1 := clauseIndex # getWatchList state'' (clause' ! 1))\<rparr> in state''' in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) [PROOF STEP] by (auto simp add: Let_def) [PROOF STATE] proof (state) this: let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) goal: No subgoals! [PROOF STEP] qed [PROOF STATE] proof (state) this: let state' = addClause clause state in InvariantConsistent (getM state') \<and> InvariantUniq (getM state') \<and> InvariantWatchListsContainOnlyClausesFromF (getWatchList state') (getF state') \<and> InvariantWatchListsUniq (getWatchList state') \<and> InvariantWatchListsCharacterization (getWatchList state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesEl (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchesDiffer (getF state') (getWatch1 state') (getWatch2 state') \<and> InvariantWatchCharacterization (getF state') (getWatch1 state') (getWatch2 state') (getM state') \<and> InvariantConflictFlagCharacterization (getConflictFlag state') (getF state') (getM state') \<and> InvariantConflictClauseCharacterization (getConflictFlag state') (getConflictClause state') (getF state') (getM state') \<and> InvariantQCharacterization (getConflictFlag state') (getQ state') (getF state') (getM state') \<and> InvariantGetReasonIsReason (getReason state') (getF state') (getM state') (set (getQ state')) \<and> InvariantUniqQ (getQ state') \<and> InvariantVarsQ (getQ state') F0 Vbl \<and> InvariantVarsM (getM state') F0 Vbl \<and> InvariantVarsF (getF state') F0 Vbl \<and> currentLevel (getM state') = 0 \<and> (getConflictFlag state' \<or> getQ state' = []) goal: No subgoals! [PROOF STEP] qed
{"llama_tokens": 385976, "file": "SATSolverVerification_Initialization", "length": 456}
# Eric Xu, 2019-09 ###### PACKAGES ###### import pandas as pd import logging import time import dateutil.parser import flask import numpy as np from functools import wraps from flask import Flask, request, Response, render_template import numpy as np import math from flask_limiter import Limiter from flask_limiter.util import get_remote_address import initialize_mysql from flask_mysqldb import MySQL from local_settings import * from validate_email import validate_email ########################## # ensure info logs are printed logging.basicConfig(format='%(asctime)s %(levelname)s:%(message)s', level=logging.INFO, datefmt='%m/%d/%Y %I:%M:%S %p') app = Flask(__name__) limiter = Limiter( app, key_func=get_remote_address, default_limits=["200 per day", "50 per hour"]) app.config['MYSQL_HOST'] = MYSQL_AUTH['host'] app.config['MYSQL_USER'] = MYSQL_AUTH['user'] app.config['MYSQL_PASSWORD'] = MYSQL_AUTH['password'] app.config['MYSQL_DB'] = 'klaviyo' mysql = MySQL(app) @app.route('/klaviyo_weather_app') def klaviyo_weather_app_html(): return render_template("subscribe.html") @app.route('/klaviyo_weather_app', methods=['POST']) def klaviyo_weather_app_post(): i_email = str(request.form['i_email']) is_valid = validate_email(email_address=i_email, check_regex=True, check_mx=True, smtp_timeout=10, \ dns_timeout=10, use_blacklist=True) if is_valid == False: return str('Unable to validate email address: %s' % i_email) i_city = str(request.form['i_city']) if i_city not in valid_city_set: return "Please choose a valid city from the list of 100 most populous US cities" i_city_id, i_city_name = int(i_city.split(' : ')[1]), i_city.split(' : ')[0] cur = mysql.connection.cursor() try: logging.info(cur.execute("INSERT INTO tblDimEmailCity(email, city_id) VALUES (%s, %s)", (i_email, i_city_id))) mysql.connection.commit() cur.close() except Exception as error: error_message = str('Caught this error: ' + repr(error)) if error_message.count('Duplicate entry') > 0: return str('Existing subscription found for %s and location %s' % (i_email, i_city)) else: return error_message return str('SUCCESS! email: %s is now subscribed to weather powered emails for %s ' % (i_email, i_city_name)) #--------- RUN WEB APP SERVER ------------# # Start the app server on port 1984 app.debug = True app.run(host='0.0.0.0', port=1984, threaded=True)
{"hexsha": "c29a0e4d6cefb8ee8924a10b5f7a8e119b8bf22c", "size": 2454, "ext": "py", "lang": "Python", "max_stars_repo_path": "subscription_service.py", "max_stars_repo_name": "eric-xu-ownerIQ/klaviyo-weather-app", "max_stars_repo_head_hexsha": "aa01332f18b1fe6ca3a6df2a6d7f2ae304f001d4", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "subscription_service.py", "max_issues_repo_name": "eric-xu-ownerIQ/klaviyo-weather-app", "max_issues_repo_head_hexsha": "aa01332f18b1fe6ca3a6df2a6d7f2ae304f001d4", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "subscription_service.py", "max_forks_repo_name": "eric-xu-ownerIQ/klaviyo-weather-app", "max_forks_repo_head_hexsha": "aa01332f18b1fe6ca3a6df2a6d7f2ae304f001d4", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 32.2894736842, "max_line_length": 119, "alphanum_fraction": 0.7082314588, "include": true, "reason": "import numpy", "num_tokens": 613}
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import unittest os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' import tensorlayerx import tensorlayerx as tlx from tests.utils import CustomTestCase import numpy as np class Layer_BinaryLinear_Test(CustomTestCase): @classmethod def setUpClass(self): print("-" * 20, "Layer_BinaryLinear_Test", "-" * 20) self.batch_size = 4 self.inputs_shape = [self.batch_size, 10] self.ni = tlx.nn.Input(self.inputs_shape, name='input_layer') self.layer1 = tlx.nn.BinaryLinear(out_features=5) self.layer2 = tlx.nn.BinaryLinear(out_features=5, in_features=10) self.n1 = self.layer1(self.ni) self.n2 = self.layer2(self.ni) @classmethod def tearDownClass(cls): pass def test_layer_n1(self): print(self.n1[0]) self.assertEqual(tlx.ReduceSum()(self.n1).numpy() % 1, 0.0) # should be integer def test_layer_n2(self): print(self.n2[0]) self.assertEqual(tlx.ReduceSum()(self.n2).numpy() % 1, 0.0) # should be integer class Layer_DorefaLinear_Test(CustomTestCase): @classmethod def setUpClass(self): print("-" * 20, "Layer_DorefaLinear_Test", "-" * 20) self.batch_size = 4 self.inputs_shape = [self.batch_size, 10] self.ni = tlx.nn.Input(self.inputs_shape, name='input_layer') self.layer1 = tlx.nn.DorefaLinear(out_features=5) self.layer2 = tlx.nn.DorefaLinear(out_features=5, in_features=10) self.n1 = self.layer1(self.ni) self.n2 = self.layer2(self.ni) @classmethod def tearDownClass(cls): pass def test_layer_n1(self): print(self.n1[0]) def test_layer_n2(self): print(self.n2[0]) class Layer_DropconnectLinear_Test(CustomTestCase): @classmethod def setUpClass(self): print("-" * 20, "Layer_DropconnectLinear_Test", "-" * 20) self.batch_size = 4 self.inputs_shape = [self.batch_size, 10] self.ni = tlx.nn.Input(self.inputs_shape, name='input_layer') self.layer1 = tlx.nn.DropconnectLinear(out_features=5, keep=0.1) self.layer2 = tlx.nn.DropconnectLinear(out_features=5, in_features=10, keep=0.99) self.n1 = self.layer1(self.ni) self.n2 = self.layer2(self.ni) @classmethod def tearDownClass(cls): pass def test_layer_n1(self): print(self.n1[0]) def test_layer_n2(self): print(self.n2[0]) class Layer_QuanLinear_Test(CustomTestCase): @classmethod def setUpClass(self): print("-" * 20, "Layer_QuanLinear_Test", "-" * 20) self.batch_size = 4 self.inputs_shape = [self.batch_size, 10] self.ni = tlx.nn.Input(self.inputs_shape, name='input_layer') self.layer1 = tlx.nn.QuanLinear(out_features=5) self.layer2 = tlx.nn.QuanLinear(out_features=5, in_features=10) self.n1 = self.layer1(self.ni) self.n2 = self.layer2(self.ni) @classmethod def tearDownClass(cls): pass def test_layer_n1(self): print(self.n1[0]) def test_layer_n2(self): print(self.n2[0]) class Layer_QuanLinearWithBN_Test(CustomTestCase): @classmethod def setUpClass(self): print("-" * 20, "Layer_QuanLinearWithBN_Test", "-" * 20) self.batch_size = 4 self.inputs_shape = [self.batch_size, 10] self.inputs = tensorlayerx.nn.initializers.TruncatedNormal()(shape=self.inputs_shape) self.layer1 = tlx.nn.QuanLinearWithBN(out_features=5) self.layer2 = tlx.nn.QuanLinearWithBN(out_features=5, in_features=10) self.n1 = self.layer1(self.inputs) self.n2 = self.layer2(self.inputs) @classmethod def tearDownClass(cls): pass def test_layer_n1(self): print(self.n1[0]) def test_layer_n2(self): print(self.n2[0]) class Layer_TernaryLinear_Test(CustomTestCase): @classmethod def setUpClass(self): print("-" * 20, "Layer_BinaryLinear_Test", "-" * 20) self.batch_size = 4 self.inputs_shape = [self.batch_size, 10] self.inputs = tlx.nn.Input(self.inputs_shape, name='input_layer') self.layer1 = tlx.nn.TernaryLinear(out_features=5) self.layer2 = tlx.nn.TernaryLinear(out_features=5, in_features=10) self.n1 = self.layer1(self.inputs) self.n2 = self.layer2(self.inputs) @classmethod def tearDownClass(cls): pass def test_layer_n1(self): print(np.unique(self.n1.numpy().reshape(-1))) print(self.n1[0]) def test_layer_n2(self): print(np.unique(self.n2.numpy().reshape(-1))) print(self.n2[0]) if __name__ == '__main__': tlx.logging.set_verbosity(tlx.logging.DEBUG) unittest.main()
{"hexsha": "d3f12fbccf184a06268e049f718b76d43d2b2605", "size": 4810, "ext": "py", "lang": "Python", "max_stars_repo_path": "tests/layers/test_layers_linear.py", "max_stars_repo_name": "tensorlayer/TensorLayerX", "max_stars_repo_head_hexsha": "4e3e6f13687309dda7787f0b86e35a62bb3adbad", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 34, "max_stars_repo_stars_event_min_datetime": "2021-12-03T08:19:23.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-13T08:34:34.000Z", "max_issues_repo_path": "tests/layers/test_layers_linear.py", "max_issues_repo_name": "tensorlayer/TensorLayerX", "max_issues_repo_head_hexsha": "4e3e6f13687309dda7787f0b86e35a62bb3adbad", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/layers/test_layers_linear.py", "max_forks_repo_name": "tensorlayer/TensorLayerX", "max_forks_repo_head_hexsha": "4e3e6f13687309dda7787f0b86e35a62bb3adbad", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2021-12-28T16:57:20.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-18T02:23:14.000Z", "avg_line_length": 27.1751412429, "max_line_length": 93, "alphanum_fraction": 0.6415800416, "include": true, "reason": "import numpy", "num_tokens": 1306}
"""test_production.py This contains validation scripts comparing circuit-based Z2 simulation to Erik's numerics code. To run the pre-arranged test suite just call python3 -m pytest test_production.py Alternatively, you can arrange a custom test suite using the __name__==__main__ logic at the end of this module. Notes: - There's currently a discrepancy between the numerics code and cirq outputs. However it can be completely fixed in postprocessing. - This will not run for 5x5 grid; the sparse matrix operations become to expensive to actually validate against the qsimcirq outputs. """ import numpy as np import pytest from z2_sim.src.QuantumCircuits.Cirq_Code import production from z2_sim.src.NumericsPython.Z2DualCorrelation import z2_dual_correlater_numeric # Visually verify agreement between the two simulation methods. PRODUCE_PLOTS = False if PRODUCE_PLOTS: import matplotlib.pyplot as plt # Tolerances for comparison to numerics. These are intentionally well above # machine precision to allow for the error accumulated due to imperfect # gate decompositions. ATOL = 1e-4 RTOL = 1e-2 def postprocess_numerics(truth): """ FIXME: There is a complex conjugate discrepancy between the numerics and circuit simulation. Less importantly, there's a different grid indexing scheme. Both of these can be corrected in postprocessing. """ truth = truth[:,:,1:].transpose(2, 1, 0) truth = truth[:,:,::-1] # reflect the grid truth = truth.conj() # ???? return truth @pytest.mark.parametrize('n', [3, 4]) @pytest.mark.parametrize('trotter_steps', [10]) @pytest.mark.parametrize('obc', [True, False]) @pytest.mark.parametrize('decompbasis', [None, "ISP"]) def test_compute_obs_with_intermediate_state_vector_all_observables(n, trotter_steps, obc, decompbasis): """Test that the main qsim routine is consistent with numerics.""" jcoup = 10 dt = 0.05 out = production.compute_obs_with_intermediate_state_vector( n, trotter_steps, jcoup, dt, all_observables=True, obc=obc, decompbasis=decompbasis ) assert out.shape == (trotter_steps, n, n) truth = z2_dual_correlater_numeric(n, jcoup, 1 / jcoup, dt, trotter_steps, obc=obc, localgroundstate=False) truth = postprocess_numerics(truth) np.testing.assert_allclose(truth, out, atol=ATOL, rtol=RTOL) if PRODUCE_PLOTS: fig_re, axes_re = plt.subplots(n, n, sharex=True, constrained_layout=True) fig_im, axes_im = plt.subplots(n, n, sharex=True, constrained_layout=True) for i in range(n): for j in range(n): axes_re[i,j].plot(truth[:,i,j].real, c='r', label='Re[numeric]') axes_re[i,j].plot(out[:,i,j].real, c='pink', label='Re[circuit]') axes_im[i,j].plot(truth[:,i,j].imag, c='b', label='Im[numeric]') axes_im[i,j].plot(out[:,i,j].imag, c='cyan', label='Im[circuit]') axes_re[-1, -1].legend() axes_im[-1, -1].legend() for axes in [axes_re, axes_im]: for ax in axes[-1,:]: ax.set_xlabel("trotter step") for ax in axes_re[:,0]: ax.set_ylabel(r"$Re\langle X_i (X+iY)_a\rangle$") for ax in axes_im[:,0]: ax.set_ylabel(r"$Im\langle X_i (X+iY)_a\rangle$") fig_re.savefig("plot_test_production_n{}_re".format(n)) fig_im.savefig("plot_test_production_n{}_im".format(n)) @pytest.mark.parametrize('n', [3]) @pytest.mark.parametrize('trotter_steps', [10]) @pytest.mark.parametrize('func', [ production.compute_obs_with_intermediate_state_vector, production.compute_ancillafree_obs_with_intermediate_state_vector ]) @pytest.mark.parametrize('obc', [True]) def test_run_parameter_sweep_all_observables(n, trotter_steps, func, obc): """This just verifies the sweep outputs a reasonable object.""" jcoup_arr = [10, 8, 6] dt_arr = [0.05, 0.01] res = production.run_noiseless_parameter_sweep( n, trotter_steps, jcoup_arr=jcoup_arr, dt_arr=dt_arr, all_observables=True, func=func, obc=obc, decompbasis=None, ) assert res.shape == (len(jcoup_arr), len(dt_arr), trotter_steps, n, n) for j in range(len(jcoup_arr)): for k in range(len(dt_arr)): truth = z2_dual_correlater_numeric(n, jcoup_arr[j], 1 / jcoup_arr[j], dt_arr[k], trotter_steps, obc=obc, localgroundstate=False) truth = postprocess_numerics(truth) np.testing.assert_allclose(truth, res[j,k], atol=ATOL, rtol=RTOL) @pytest.mark.parametrize('n', [3, 4]) @pytest.mark.parametrize('trotter_steps', [10]) @pytest.mark.parametrize('obc', [True, False]) @pytest.mark.parametrize('decompbasis', [None, "ISP"]) def test_compute_ancillafree_obs_with_intermediate_state_vector_all_observables(n, trotter_steps, obc, decompbasis): """Test that the ancilla-free qsim routine is consistent with ancilla.""" jcoup = 10 dt = 0.05 out = production.compute_ancillafree_obs_with_intermediate_state_vector( n, trotter_steps, jcoup, dt, all_observables=True, obc=obc, decompbasis=decompbasis ) truth = production.compute_obs_with_intermediate_state_vector( n, trotter_steps, jcoup, dt, all_observables=True, obc=obc, decompbasis=decompbasis ) assert out.shape == (trotter_steps, n, n) np.testing.assert_allclose(truth, out, atol=ATOL, rtol=RTOL) @pytest.mark.parametrize('n', [3]) @pytest.mark.parametrize('decompbasis', [None, "SIS"]) def test_compute_noisy_obs(n, decompbasis): """Test that the no-checkpoint qsim is compatible with checkpoint.""" jcoup = 10 dt = 0.05 obc = True trotter_steps = 3 trotter_start, trotter_stop = (1, trotter_steps + 1) # EXCLUSIVE indexing out = production.compute_noisy_obs( n=n, trotter_start=trotter_start, trotter_stop=trotter_stop, jcoup=jcoup, dt=dt, all_observables=True, qsim_options=dict(t=32, f=4, r=1), noise_models=None, obc=obc, decompbasis=decompbasis ) assert out.shape == (trotter_stop - trotter_start, n, n) truth = production.compute_obs_with_intermediate_state_vector( n, trotter_steps, jcoup, dt, all_observables=True, obc=obc, decompbasis=decompbasis ) np.testing.assert_allclose(truth, out, atol=ATOL, rtol=RTOL) @pytest.mark.parametrize('n', [3]) @pytest.mark.parametrize('decompbasis', [None, "SIS"]) def test_compute_noisy_obs_composition(n, decompbasis): """Test that the no-checkpoint qsim concatenates correctly""" jcoup = 10 dt = 0.05 obc = True start_stops = [ (1, 4), (4, 6), (6, 7) ] all_res = [] for (trotter_start, trotter_stop) in start_stops: out = production.compute_noisy_obs( n=n, trotter_start=trotter_start, trotter_stop=trotter_stop, jcoup=jcoup, dt=dt, all_observables=True, qsim_options=dict(t=32, f=4, r=1), noise_models=None, obc=obc, decompbasis=decompbasis ) all_res.append(out) out = np.vstack(all_res) truth = production.compute_obs_with_intermediate_state_vector( n, 6, jcoup, dt, all_observables=True, obc=obc, decompbasis=decompbasis ) np.testing.assert_allclose(truth, out, atol=ATOL, rtol=RTOL) if __name__ == "__main__": # test_compute_ancillafree_obs_with_intermediate_state_vector_all_observables(3, 10, True, "MS") test_compute_obs_with_intermediate_state_vector_all_observables(3, 10, True, "MS") # test_compute_noisy_obs_composition(3, None) # test_compute_noisy_obs(3, None) # test_run_parameter_sweep_all_observables(3, 10) # FIXME: numerics cant actually support this computation, or at least it # hangs for a looong time. # test_compute_obs_with_intermediate_state_vector_all_observables(5, 20)
{"hexsha": "15bb3edf95603300677fcbc92a92c46e2a34f062", "size": 8018, "ext": "py", "lang": "Python", "max_stars_repo_path": "tests/test_production.py", "max_stars_repo_name": "Fermilab-Quantum-Science/Z2Sim-public", "max_stars_repo_head_hexsha": "dfbefffd933aa2e39a0cb9f668b424596dfa7d35", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-11-02T17:28:30.000Z", "max_stars_repo_stars_event_max_datetime": "2021-11-17T17:14:02.000Z", "max_issues_repo_path": "tests/test_production.py", "max_issues_repo_name": "Fermilab-Quantum-Science/Z2Sim-public", "max_issues_repo_head_hexsha": "dfbefffd933aa2e39a0cb9f668b424596dfa7d35", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tests/test_production.py", "max_forks_repo_name": "Fermilab-Quantum-Science/Z2Sim-public", "max_forks_repo_head_hexsha": "dfbefffd933aa2e39a0cb9f668b424596dfa7d35", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-02-23T16:12:16.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-23T16:12:16.000Z", "avg_line_length": 35.6355555556, "max_line_length": 140, "alphanum_fraction": 0.6818408581, "include": true, "reason": "import numpy", "num_tokens": 2197}
[STATEMENT] lemma run_snth: assumes "run r p" shows "enabled (r !! k) (target (stake k r) p)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. enabled (r !! k) (target (stake k r) p) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: run r p goal (1 subgoal): 1. enabled (r !! k) (target (stake k r) p) [PROOF STEP] by (metis stream.collapse sdrop_simps(1) run_scons_elim run_sdrop)
{"llama_tokens": 176, "file": "Transition_Systems_and_Automata_Transition_Systems_Transition_System_Extra", "length": 2}
/* vim: set tabstop=4 expandtab shiftwidth=4 softtabstop=4: */ /** * \file boost/numeric/ublasx/operation/abs.hpp * * \brief Apply the \c std::abs function to a vector or matrix expression. * * \author Marco Guazzone ([email protected]) * * <hr/> * * Copyright (c) 2010, Marco Guazzone * * Distributed under the Boost Software License, Version 1.0. (See * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_NUMERIC_UBLASX_OPERATION_ABS_HPP #define BOOST_NUMERIC_UBLASX_OPERATION_ABS_HPP #include <boost/numeric/ublas/traits.hpp> #include <boost/numeric/ublasx/expression/matrix_unary_functor.hpp> #include <boost/numeric/ublasx/expression/vector_unary_functor.hpp> #include <cmath> namespace boost { namespace numeric { namespace ublasx { using namespace ::boost::numeric::ublas; namespace detail { template <typename VectorExprT> struct vector_abs_functor_traits { typedef VectorExprT input_expression_type; typedef typename vector_traits<input_expression_type>::value_type signature_argument_type; typedef typename type_traits<signature_argument_type>::real_type signature_result_type; typedef vector_unary_functor_traits< input_expression_type, signature_result_type (signature_argument_type) > unary_functor_expression_type; typedef typename unary_functor_expression_type::result_type result_type; typedef typename unary_functor_expression_type::expression_type expression_type; }; template <typename MatrixExprT> struct matrix_abs_functor_traits { typedef MatrixExprT input_expression_type; typedef typename matrix_traits<input_expression_type>::value_type signature_argument_type; typedef typename type_traits<signature_argument_type>::real_type signature_result_type; typedef matrix_unary_functor_traits< input_expression_type, signature_result_type (signature_argument_type) > unary_functor_expression_type; typedef typename unary_functor_expression_type::result_type result_type; typedef typename unary_functor_expression_type::expression_type expression_type; }; } // Namespace detail /** * \brief Applies the \c std::abs function to a given vector expression. * * \tparam VectorExprT The type of the input vector expression. * * \param ve The input vector expression. * \return A vector expression representing the application of \c std::abs to * each element of \a ve. * * \author Marco Guazzone, [email protected] */ template <typename VectorExprT> BOOST_UBLAS_INLINE typename detail::vector_abs_functor_traits<VectorExprT>::result_type abs(vector_expression<VectorExprT> const& ve) { typedef typename detail::vector_abs_functor_traits<VectorExprT>::expression_type expression_type; typedef typename detail::vector_abs_functor_traits<VectorExprT>::signature_result_type signature_result_type; return expression_type(ve(), ::std::abs<signature_result_type>); } /** * \brief Applies the \c std::abs function to a given matrix expression. * * \tparam MatrixExprT The type of the input matrix expression. * * \param me The input matrix expression. * \return A matrix expression representing the application of \c std::abs to * each element of \a me. * * \author Marco Guazzone, [email protected] */ template <typename MatrixExprT> BOOST_UBLAS_INLINE typename detail::matrix_abs_functor_traits<MatrixExprT>::result_type abs(matrix_expression<MatrixExprT> const& me) { typedef typename detail::matrix_abs_functor_traits<MatrixExprT>::expression_type expression_type; typedef typename detail::matrix_abs_functor_traits<MatrixExprT>::signature_result_type signature_result_type; return expression_type(me(), ::std::abs<signature_result_type>); } }}} // Namespace boost::numeric::ublasx #endif // BOOST_NUMERIC_UBLASX_OPERATION_ABS_HPP
{"hexsha": "7912ddd63fe2d2e4dae911667903bb748fb3ef2f", "size": 3930, "ext": "hpp", "lang": "C++", "max_stars_repo_path": "boost/numeric/ublasx/operation/abs.hpp", "max_stars_repo_name": "sguazt/boost-ublasx", "max_stars_repo_head_hexsha": "21c9b393d33a6ec2a8071ba8d48680073d766409", "max_stars_repo_licenses": ["BSL-1.0"], "max_stars_count": 7.0, "max_stars_repo_stars_event_min_datetime": "2016-05-14T11:08:44.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-05T14:22:20.000Z", "max_issues_repo_path": "boost/numeric/ublasx/operation/abs.hpp", "max_issues_repo_name": "sguazt/boost-ublasx", "max_issues_repo_head_hexsha": "21c9b393d33a6ec2a8071ba8d48680073d766409", "max_issues_repo_licenses": ["BSL-1.0"], "max_issues_count": 1.0, "max_issues_repo_issues_event_min_datetime": "2020-12-28T18:36:04.000Z", "max_issues_repo_issues_event_max_datetime": "2021-01-06T11:28:51.000Z", "max_forks_repo_path": "boost/numeric/ublasx/operation/abs.hpp", "max_forks_repo_name": "sguazt/boost-ublasx", "max_forks_repo_head_hexsha": "21c9b393d33a6ec2a8071ba8d48680073d766409", "max_forks_repo_licenses": ["BSL-1.0"], "max_forks_count": 1.0, "max_forks_repo_forks_event_min_datetime": "2019-12-23T02:53:27.000Z", "max_forks_repo_forks_event_max_datetime": "2019-12-23T02:53:27.000Z", "avg_line_length": 34.4736842105, "max_line_length": 114, "alphanum_fraction": 0.7796437659, "num_tokens": 869}
(AxisVector{T, A, SVector{1, T}} where {T})( a::Real, ::LocalGeometry, ) where {A} = AxisVector(A.instance, SVector(a)) # standard conversions ContravariantVector(u::ContravariantVector, ::LocalGeometry) = u CovariantVector(u::CovariantVector, ::LocalGeometry) = u LocalVector(u::LocalVector, ::LocalGeometry) = u ContravariantVector( u::LocalVector{T, I}, local_geometry::LocalGeometry{I}, ) where {T, I} = local_geometry.∂ξ∂x * u LocalVector( u::ContravariantVector{T, I}, local_geometry::LocalGeometry{I}, ) where {T, I} = local_geometry.∂x∂ξ * u CovariantVector( u::LocalVector{T, I}, local_geometry::LocalGeometry{I}, ) where {T, I} = local_geometry.∂x∂ξ' * u LocalVector( u::CovariantVector{T, I}, local_geometry::LocalGeometry{I}, ) where {T, I} = local_geometry.∂ξ∂x' * u # Converting to specific dimension types (::Type{<:ContravariantVector{<:Any, I}})( u::ContravariantVector{<:Any, I}, ::LocalGeometry{I}, ) where {I} = u (::Type{<:ContravariantVector{<:Any, I}})( u::ContravariantVector, ::LocalGeometry, ) where {I} = transform(ContravariantAxis{I}(), u) (::Type{<:ContravariantVector{<:Any, I}})( u::AxisVector, local_geometry::LocalGeometry, ) where {I} = transform(ContravariantAxis{I}(), ContravariantVector(u, local_geometry)) (::Type{<:CovariantVector{<:Any, I}})( u::CovariantVector{<:Any, I}, ::LocalGeometry{I}, ) where {I} = u (::Type{<:CovariantVector{<:Any, I}})( u::CovariantVector, ::LocalGeometry, ) where {I} = transform(CovariantAxis{I}(), u) (::Type{<:CovariantVector{<:Any, I}})( u::AxisVector, local_geometry::LocalGeometry, ) where {I} = transform(CovariantAxis{I}(), CovariantVector(u, local_geometry)) (::Type{<:LocalVector{<:Any, I}})( u::LocalVector{<:Any, I}, ::LocalGeometry{I}, ) where {I} = u (::Type{<:LocalVector{<:Any, I}})(u::LocalVector, ::LocalGeometry) where {I} = transform(LocalAxis{I}(), u) (::Type{<:LocalVector{<:Any, I}})( u::AxisVector, local_geometry::LocalGeometry, ) where {I} = transform(LocalAxis{I}(), LocalVector(u, local_geometry)) # Generic N-axis conversion functions, # Convert to specific local geometry dimension then convert vector type LocalVector(u::CovariantVector, local_geometry::LocalGeometry{I}) where {I} = transform(LocalAxis{I}(), transform(CovariantAxis{I}(), u), local_geometry) LocalVector( u::ContravariantVector, local_geometry::LocalGeometry{I}, ) where {I} = transform( LocalAxis{I}(), transform(ContravariantAxis{I}(), u), local_geometry, ) CovariantVector(u::LocalVector, local_geometry::LocalGeometry{I}) where {I} = transform(CovariantAxis{I}(), transform(LocalAxis{I}(), u), local_geometry) CovariantVector( u::ContravariantVector, local_geometry::LocalGeometry{I}, ) where {I} = transform( CovariantAxis{I}(), transform(ContravariantAxis{I}(), u), local_geometry, ) ContravariantVector( u::LocalVector, local_geometry::LocalGeometry{I}, ) where {I} = transform( ContravariantAxis{I}(), transform(LocalAxis{I}(), u), local_geometry, ) ContravariantVector( u::CovariantVector, local_geometry::LocalGeometry{I}, ) where {I} = transform( ContravariantAxis{I}(), transform(CovariantAxis{I}(), u), local_geometry, ) # In order to make curls and cross products work in 2D, we define the 3rd # dimension to be orthogonal to the exisiting dimensions, and have unit length # (so covariant, contravariant and local axes are equal) ContravariantVector(u::LocalVector{<:Any, (3,)}, ::LocalGeometry{(1, 2)}) = AxisVector(Contravariant3Axis(), components(u)) ContravariantVector(u::CovariantVector{<:Any, (3,)}, ::LocalGeometry{(1, 2)}) = AxisVector(Contravariant3Axis(), components(u)) CovariantVector(u::LocalVector{<:Any, (3,)}, ::LocalGeometry{(1, 2)}) = AxisVector(Covariant3Axis(), components(u)) CovariantVector(u::ContravariantVector{<:Any, (3,)}, ::LocalGeometry{(1, 2)}) = AxisVector(Covariant3Axis(), components(u)) LocalVector(u::CovariantVector{<:Any, (3,)}, ::LocalGeometry{(1, 2)}) = AxisVector(WAxis(), components(u)) LocalVector(u::ContravariantVector{<:Any, (3,)}, ::LocalGeometry{(1, 2)}) = AxisVector(WAxis(), components(u)) covariant1(u::AxisVector, local_geometry::LocalGeometry) = CovariantVector(u, local_geometry).u₁ covariant2(u::AxisVector, local_geometry::LocalGeometry) = CovariantVector(u, local_geometry).u₂ covariant3(u::AxisVector, local_geometry::LocalGeometry) = CovariantVector(u, local_geometry).u₃ contravariant1(u::AxisVector, local_geometry::LocalGeometry) = transform(Contravariant123Axis(), u, local_geometry).u¹ contravariant2(u::AxisVector, local_geometry::LocalGeometry) = transform(Contravariant123Axis(), u, local_geometry).u² contravariant3(u::AxisVector, local_geometry::LocalGeometry) = transform(Contravariant123Axis(), u, local_geometry).u³ contravariant1(u::Axis2Tensor, local_geometry::LocalGeometry) = transform(Contravariant123Axis(), u, local_geometry)[1, :] contravariant2(u::Axis2Tensor, local_geometry::LocalGeometry) = transform(Contravariant123Axis(), u, local_geometry)[2, :] contravariant3(u::Axis2Tensor, local_geometry::LocalGeometry) = transform(Contravariant123Axis(), u, local_geometry)[3, :] Jcontravariant3(u::AxisTensor, local_geometry::LocalGeometry) = local_geometry.J * contravariant3(u, local_geometry) # required for curl-curl covariant3(u::Contravariant3Vector, local_geometry::LocalGeometry{(1, 2)}) = contravariant3(u, local_geometry) """ transform(axis, V[, local_geometry]) Transform the first axis of the vector or tensor `V` to `axis`. """ function transform end """ project(axis, V[, local_geometry]) Project the first axis component of the vector or tensor `V` to `axis` """ function project end for op in (:transform, :project) @eval begin # Covariant <-> Cartesian $op( ax::CartesianAxis, v::CovariantTensor, local_geometry::LocalGeometry, ) = $op( ax, local_geometry.∂ξ∂x' * $op(dual(axes(local_geometry.∂ξ∂x, 1)), v), ) $op( ax::CovariantAxis, v::CartesianTensor, local_geometry::LocalGeometry, ) = $op( ax, local_geometry.∂x∂ξ' * $op(dual(axes(local_geometry.∂x∂ξ, 1)), v), ) $op(ax::LocalAxis, v::CovariantTensor, local_geometry::LocalGeometry) = $op( ax, local_geometry.∂ξ∂x' * $op(dual(axes(local_geometry.∂ξ∂x, 1)), v), ) $op(ax::CovariantAxis, v::LocalTensor, local_geometry::LocalGeometry) = $op( ax, local_geometry.∂x∂ξ' * $op(dual(axes(local_geometry.∂x∂ξ, 1)), v), ) # Contravariant <-> Cartesian $op( ax::ContravariantAxis, v::CartesianTensor, local_geometry::LocalGeometry, ) = $op( ax, local_geometry.∂ξ∂x * $op(dual(axes(local_geometry.∂ξ∂x, 2)), v), ) $op( ax::CartesianAxis, v::ContravariantTensor, local_geometry::LocalGeometry, ) = $op( ax, local_geometry.∂x∂ξ * $op(dual(axes(local_geometry.∂x∂ξ, 2)), v), ) $op( ax::ContravariantAxis, v::LocalTensor, local_geometry::LocalGeometry, ) = $op( ax, local_geometry.∂ξ∂x * $op(dual(axes(local_geometry.∂ξ∂x, 2)), v), ) $op( ax::LocalAxis, v::ContravariantTensor, local_geometry::LocalGeometry, ) = $op( ax, local_geometry.∂x∂ξ * $op(dual(axes(local_geometry.∂x∂ξ, 2)), v), ) # Covariant <-> Contravariant $op( ax::ContravariantAxis, v::CovariantTensor, local_geometry::LocalGeometry, ) = $op( ax, local_geometry.∂ξ∂x * local_geometry.∂ξ∂x' * $op(dual(axes(local_geometry.∂ξ∂x, 1)), v), ) $op( ax::CovariantAxis, v::ContravariantTensor, local_geometry::LocalGeometry, ) = $op( ax, local_geometry.∂x∂ξ' * local_geometry.∂x∂ξ * $op(dual(axes(local_geometry.∂x∂ξ, 2)), v), ) $op(ato::CovariantAxis, v::CovariantTensor, ::LocalGeometry) = $op(ato, v) $op(ato::ContravariantAxis, v::ContravariantTensor, ::LocalGeometry) = $op(ato, v) $op(ato::CartesianAxis, v::CartesianTensor, ::LocalGeometry) = $op(ato, v) $op(ato::LocalAxis, v::LocalTensor, ::LocalGeometry) = $op(ato, v) end end """ divergence_result_type(V) The return type when taking the divergence of a field of `V`. Required for statically infering the result type of the divergence operation for `AxisVector` subtypes. """ @inline divergence_result_type(::Type{V}) where {V <: AxisVector} = eltype(V) # this isn't quite right: it only is true when the Christoffel symbols are zero @inline divergence_result_type( ::Type{Axis2Tensor{FT, Tuple{A1, A2}, S}}, ) where {FT, A1, A2 <: LocalAxis, S <: StaticMatrix{S1, S2}} where {S1, S2} = AxisVector{FT, A2, SVector{S2, FT}} """ gradient_result_type(Val(I), V) The return type when taking the gradient along dimension `I` of a field `V`. Required for statically infering the result type of the gradient operation for `AxisVector` subtypes. """ @inline function gradient_result_type( ::Val{I}, ::Type{V}, ) where {I, V <: Number} N = length(I) AxisVector{V, CovariantAxis{I}, SVector{N, V}} end @inline function gradient_result_type( ::Val{I}, ::Type{V}, ) where {I, V <: Geometry.AxisVector{T, A, SVector{N, T}}} where {T, A, N} M = length(I) Axis2Tensor{T, Tuple{CovariantAxis{I}, A}, SMatrix{M, N, T, M * N}} end """ curl_result_type(Val(I), Val(L), V) The return type when taking the curl along dimensions `I` of a field of eltype `V`, defined on dimensions `L` Required for statically infering the result type of the curl operation for `AxisVector` subtypes. """ @inline curl_result_type( ::Val{(1, 2)}, ::Type{Covariant12Vector{FT}}, ) where {FT} = Contravariant3Vector{FT} @inline curl_result_type( ::Val{(1, 2)}, ::Type{Covariant3Vector{FT}}, ) where {FT} = Contravariant12Vector{FT} @inline curl_result_type(::Val{(1,)}, ::Type{Covariant3Vector{FT}}) where {FT} = Contravariant2Vector{FT} @inline curl_result_type( ::Val{(3,)}, ::Type{Covariant12Vector{FT}}, ) where {FT} = Contravariant12Vector{FT} @inline curl_result_type(::Val{(3,)}, ::Type{Covariant1Vector{FT}}) where {FT} = Contravariant2Vector{FT} @inline curl_result_type(::Val{(3,)}, ::Type{Covariant2Vector{FT}}) where {FT} = Contravariant1Vector{FT} # these are only true in 2D @inline curl_result_type( ::Val{(1, 2)}, ::Type{Contravariant12Vector{FT}}, ) where {FT} = Contravariant3Vector{FT} @inline curl_result_type(::Val{(1, 2)}, ::Type{UVVector{FT}}) where {FT} = Contravariant3Vector{FT} @inline curl_result_type( ::Val{(1, 2)}, ::Type{Contravariant3Vector{FT}}, ) where {FT} = Contravariant12Vector{FT} @inline curl_result_type(::Val{(1, 2)}, ::Type{WVector{FT}}) where {FT} = Contravariant12Vector{FT} _norm_sqr(x, local_geometry::LocalGeometry) = sum(x -> _norm_sqr(x, local_geometry), x) _norm_sqr(x::Number, ::LocalGeometry) = LinearAlgebra.norm_sqr(x) _norm_sqr(x::AbstractArray, ::LocalGeometry) = LinearAlgebra.norm_sqr(x) function _norm_sqr(uᵢ::CovariantVector, local_geometry::LocalGeometry) LinearAlgebra.norm_sqr(LocalVector(uᵢ, local_geometry)) end function _norm_sqr(uᵢ::ContravariantVector, local_geometry::LocalGeometry) LinearAlgebra.norm_sqr(LocalVector(uᵢ, local_geometry)) end _norm_sqr(u::Contravariant2Vector, ::LocalGeometry{(1,)}) = LinearAlgebra.norm_sqr(u.u²) _norm_sqr(u::Contravariant2Vector, ::LocalGeometry{(3,)}) = LinearAlgebra.norm_sqr(u.u²) _norm_sqr(u::Contravariant2Vector, ::LocalGeometry{(1, 3)}) = LinearAlgebra.norm_sqr(u.u²) _norm_sqr(u::Contravariant3Vector, ::LocalGeometry{(1,)}) = LinearAlgebra.norm_sqr(u.u³) _norm_sqr(u::Contravariant3Vector, ::LocalGeometry{(1, 2)}) = LinearAlgebra.norm_sqr(u.u³) _norm(u::AxisVector, local_geometry::LocalGeometry) = sqrt(_norm_sqr(u, local_geometry)) _cross(u::AxisVector, v::AxisVector, local_geometry::LocalGeometry) = _cross( ContravariantVector(u, local_geometry), ContravariantVector(v, local_geometry), local_geometry, ) _cross( x::ContravariantVector, y::ContravariantVector, local_geometry::LocalGeometry, ) = local_geometry.J * Covariant123Vector( x.u² * y.u³ - x.u³ * y.u², x.u³ * y.u¹ - x.u¹ * y.u³, x.u¹ * y.u² - x.u² * y.u¹, ) _cross( x::Contravariant12Vector, y::Contravariant12Vector, local_geometry::LocalGeometry, ) = local_geometry.J * Covariant3Vector(x.u¹ * y.u² - x.u² * y.u¹) _cross( x::Contravariant2Vector, y::Contravariant1Vector, local_geometry::LocalGeometry, ) = local_geometry.J * Covariant3Vector(-x.u² * y.u¹) _cross( x::Contravariant12Vector, y::Contravariant3Vector, local_geometry::LocalGeometry, ) = local_geometry.J * Covariant12Vector(x.u² * y.u³, -x.u¹ * y.u³) _cross( x::Contravariant3Vector, y::Contravariant12Vector, local_geometry::LocalGeometry, ) = local_geometry.J * Covariant12Vector(-x.u³ * y.u², x.u³ * y.u¹) _cross( x::Contravariant2Vector, y::Contravariant3Vector, local_geometry::LocalGeometry, ) = local_geometry.J * Covariant1Vector(x.u² * y.u³) _cross(u::CartesianVector, v::CartesianVector, ::LocalGeometry) = LinearAlgebra.cross(u, v) _cross(u::LocalVector, v::LocalVector, ::LocalGeometry) = LinearAlgebra.cross(u, v)
{"hexsha": "c82a0e4324c7756f0820b9171b5a0821a0a93a7c", "size": 14062, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "src/Geometry/conversions.jl", "max_stars_repo_name": "CliMA/ClimaCore.jl", "max_stars_repo_head_hexsha": "e28309249a4c0dea0e8bb897b4dc9ebc376fa94e", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 32, "max_stars_repo_stars_event_min_datetime": "2021-07-19T20:14:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-26T00:18:43.000Z", "max_issues_repo_path": "src/Geometry/conversions.jl", "max_issues_repo_name": "CliMA/ClimaCore.jl", "max_issues_repo_head_hexsha": "e28309249a4c0dea0e8bb897b4dc9ebc376fa94e", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 543, "max_issues_repo_issues_event_min_datetime": "2021-07-06T18:21:05.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T20:39:02.000Z", "max_forks_repo_path": "src/Geometry/conversions.jl", "max_forks_repo_name": "CliMA/ClimateMachineCore.jl", "max_forks_repo_head_hexsha": "73dff5e125aa641b1560f3ca5163db472c1ed07a", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-09-27T16:54:21.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-27T16:54:21.000Z", "avg_line_length": 32.400921659, "max_line_length": 109, "alphanum_fraction": 0.6527520979, "num_tokens": 4208}
#!/usr/bin/env python3 import argparse import sys import pandas as p import numpy as np from numpy.random import RandomState from scipy.optimize import minimize_scalar from numpy.random import RandomState from scipy.stats import chi2 from collections import defaultdict from scipy.special import gammaln #class to perform simple variant filtering assuming fixed genome error rate def div(x, y): if x.dtype == np.int64 and y.dtype == np.int64: return x // y return x / y def log_factorial(x): """Returns the logarithm of x! Also accepts lists and NumPy arrays in place of x.""" return gammaln(x + 1) def mixNLL(p, eta, n, m, f): mix = p*eta[n,:] + (1-p)*eta[m,:] return np.dot(f,-np.log(mix)) def log_multinomial_pdf2(f,mix): return np.dot(f,-np.log(mix)) def log_multinomial_pdf(xs, ps): """Returns logarithm of multinomial pdf""" n = sum(xs) result = log_factorial(n) - sum(log_factorial(xs)) + sum(xs * np.log(ps)) return result def expand_sample_names(sample_names): expanded = [] for name in sample_names: expanded.append(name + "-A") expanded.append(name + "-C") expanded.append(name + "-G") expanded.append(name + "-T") return expanded class Variant_Val(): """Filters variant position based on simple binomial or log ratio of binomial to mixtures of binomials""" def __init__(self,variants, eta, G, tau_star_array, gamma_array, randomState, optimise = False, max_iter = 100, min_p = 0.01,sampleFilter=0.5,min_freq=10): self.optimise = optimise self.max_iter = max_iter self.min_p = min_p self.upperP = 1.0 - min_p self.min_freq = min_freq self.G = G self.tau = tau_star_array self.gamma = gamma_array row_sums = self.gamma.sum(axis=1) self.gamma = self.gamma / row_sums[:, np.newaxis] #first get array dimensions variants_matrix = variants.values self.genes = list(variants.index) self.position = variants_matrix[:,0] variants_matrix = np.delete(variants_matrix, 0, 1) self.snps = np.reshape(variants_matrix, (variants_matrix.shape[0],int(variants_matrix.shape[1] / 4),4)) self.sumVS = np.sum(self.snps,axis=2) #self.snps = self.snps[:,np.sum(self.sumVS > 10,axis=0) > self.V*0.9] self.sumVS = np.sum(self.snps,axis=2) self.sampleFilter = sampleFilter self.S = self.snps.shape[1] #number of sites following filtering self.selectV = np.sum(self.sumVS > self.min_freq,axis=1) >= self.S*self.sampleFilter self.tau = self.tau[self.selectV,:,:] self.snps = self.snps[self.selectV,:] self.V = self.snps.shape[0] #number of variants self.sumVS = np.sum(self.snps,axis=2) self.position = self.position[self.selectV] self.genes = [x for x, y in zip(self.genes, self.selectV.tolist()) if y is True] self.snps1 = self.snps + 1 self.fsnps = self.snps.astype(np.float) vs_sum = self.snps.sum(axis=(2)) vs_mean = np.mean(vs_sum,axis=0) #set random state self.randomState = randomState self.eta = eta def calcMixtureLog(self): MLL = np.zeros(self.V) #get most abundant base self.maxA = np.argmax(self.snps,axis=2) self.maxAF = np.argmax(np.sum(self.snps,axis=1),axis=1) #get second most abundant base ftemp = np.copy(self.snps) for v in range(self.V): for s in range(self.S): ftemp[v,s,self.maxA[v,s]] = -1 self.maxB = np.argmax(ftemp,axis=2) self.N = (self.snps.sum(axis=2)).astype(np.float64) self.n = (self.snps.max(axis=2)).astype(np.float64) #value of most abundant base self.m = (ftemp.max(axis=2)).astype(np.float64) #value of second most abundant self.e = self.N -self.n p = self.n/self.N p[p > self.upperP] = self.upperP q = self.m/self.N self.sumVS1 = np.sum(self.snps1,axis=2) self.nsnps = np.zeros((self.V,self.S,4)) self.div = np.zeros(self.V) self.ndiv = np.zeros(self.V) for v in range(self.V): for s in range(self.S): #if self.sumVS[v,s] > 0: if self.sumVS[v,s] > self.min_freq: fracd = self.snps1[v,s,:]/self.sumVS1[v,s] self.div[v] += np.sum(self.probVS[v,s,:]*np.log(self.probVS[v,s,:]/fracd)) self.ndiv[v] += 1 if self.optimise: res = minimize_scalar(mixNLL, bounds=(0.0, self.upperP), args = (self.eta,self.maxA[v,s],self.maxB[v,s],self.fsnps[v,s,:]), method='bounded') p[v,s] = res.x MLL[v] += mixNLL(p[v,s],self.eta,self.maxA[v,s],self.maxB[v,s],self.fsnps[v,s,:]) else: if self.sumVS[v,s] > self.min_freq: frac1 = self.snps1[v,s,:]/self.sumVS1[v,s] self.nsnps[v,s,:] = self.snps[v,s,:]/self.sumVS[v,s] #self.nsnps[v,s,:] = self.snps1[v,s,:]/self.sumVS1[v,s] mix = np.dot(frac1,self.eta) #p[v,s]*self.eta[self.maxA[v,s],:] + q[v,s]*self.eta[self.maxB[v,s],:] MLL[v] += np.dot(self.fsnps[v,s,:],-np.log(mix)) return MLL def calcRankTable(self): self.rsnps = np.zeros((self.V,self.S,4)) for v in range(self.V): for s in range(self.S): self.rsnps[v,s,:] = np.sort(self.nsnps[v,s,:]) def calcRankTable1(self): self.rsnps1 = np.zeros((self.V,self.S)) for v in range(self.V): self.rsnps1[v,:] = 1.0 - self.nsnps[v,:,self.maxAF[v]] def calcModeLog(self): self.probVS = np.einsum('ijk,lj,km->ilm',self.tau,self.gamma,self.eta) sumVS = np.sum(self.snps,axis=2) logProbV = np.zeros(self.V) #loop each variant for v in range(self.V): #loop each site for s in range(self.S): if sumVS[v,s] > 0: logProbV[v] += np.dot(self.snps[v,s,:],-np.log(self.probVS[v,s,:])) return logProbV def calcAssArray(self): self.assArray = np.zeros(self.V,dtype=np.int) self.tauT = np.zeros((self.V,self.G),dtype=np.int) for v in range(self.V): for g in range(self.G): self.tauT[v,g] = np.argmax(self.tau[v,g,:]) self.mapAss = {} for v in range(self.V): test = (self.tauT[v,:] == self.maxAF[v]) == False testI = test.astype(int) testBit = np.packbits(testI) assert 8 - self.G > 0 testBitR = np.right_shift(testBit, 8 - self.G) if np.sum(test) < self.G: self.assArray[v] = testBitR[0] def main(argv): parser = argparse.ArgumentParser() parser.add_argument("variant_file", help="input SNP frequencies") parser.add_argument("tau_file", help="haplotype assignments") parser.add_argument("gamma_file", help="haplotype frequencies") parser.add_argument("eta_file", help="error transition matrix") parser.add_argument("outStub", help="output file stub") parser.add_argument('-s','--random_seed',default=23724839, type=int, help=("specifies seed for numpy random number generator defaults to 23724839")) parser.add_argument('-m','--min_freq', type=int, default=5, help=("minimum frequency for sample to be used in SNV stats")) parser.add_argument('-f','--sample_frac', type=float, default=0.5, help=("fraction of samples with freq above minimum for SNV to be used at all")) parser.add_argument('-d','--min_dev', type=float, default=10, help=("number of samples for us to trust SNV stats")) args = parser.parse_args() #create new random state prng = RandomState(args.random_seed) variant_file = args.variant_file tau_star = p.read_csv(args.tau_file, header=0, index_col=0) tau_star_matrix = tau_star.as_matrix() tau_star_matrix = np.delete(tau_star_matrix,0,1) tau_star_matrix[tau_star_matrix < 0.5] = 0.0 tau_star_matrix[tau_star_matrix >= 0.5] = 1.0 V = tau_star_matrix.shape[0] G = int(tau_star_matrix.shape[1]/4) tau_star_array = np.reshape(tau_star_matrix,(V, G,4)) #import ipdb; ipdb.set_trace() variants = p.read_csv(variant_file, header=0, index_col=0) eta_df = p.read_csv(args.eta_file, header=0, index_col=0) eta = eta_df.values gamma = p.read_csv(args.gamma_file, header=0, index_col=0) gamma_names = gamma.index.values expanded_names = expand_sample_names(gamma_names) variants_intersect = variants[['Position'] + expanded_names] gamma_array = gamma.values variantVal = Variant_Val(variants_intersect,eta,G,tau_star_array,gamma_array,randomState = prng,sampleFilter=args.sample_frac,min_freq=args.min_freq) logModel = variantVal.calcModeLog() logMixture = variantVal.calcMixtureLog() logDiff = logMixture - logModel variantVal.calcRankTable1() df = p.DataFrame(variantVal.rsnps1,index=variantVal.position) df.to_csv(args.outStub + "_rsnps1.csv") variantVal.calcAssArray() with open(args.outStub + "_dev.csv", 'w') as out: for v in range(variantVal.V): maxD = max(-logDiff[v],0) if variantVal.ndiv[v] > 0: out.write(str(v) + "," + variantVal.genes[v] + "," + str(variantVal.position[v]) + "," + str(variantVal.ndiv[v]) + "," + str(variantVal.assArray[v]) +"," + str(maxD/variantVal.ndiv[v]) + "," + str(variantVal.div[v]/variantVal.ndiv[v]) + "\n") else: out.write(str(v) + "," + variantVal.genes[v] + "," + str(variantVal.position[v]) + "," + str(variantVal.ndiv[v]) + "," + str(variantVal.assArray[v]) +"," + "NA" + "," + "NA\n") if __name__ == "__main__": main(sys.argv[1:])
{"hexsha": "80be5c44a2e75a685eb4a59c312586c10ea809dd", "size": 10549, "ext": "py", "lang": "Python", "max_stars_repo_path": "scripts/Variant_eval.py", "max_stars_repo_name": "MatthewWolff/DESMAN", "max_stars_repo_head_hexsha": "3f683e75830c4862b5f2c7577ef31b4cc86bdd61", "max_stars_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "scripts/Variant_eval.py", "max_issues_repo_name": "MatthewWolff/DESMAN", "max_issues_repo_head_hexsha": "3f683e75830c4862b5f2c7577ef31b4cc86bdd61", "max_issues_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scripts/Variant_eval.py", "max_forks_repo_name": "MatthewWolff/DESMAN", "max_forks_repo_head_hexsha": "3f683e75830c4862b5f2c7577ef31b4cc86bdd61", "max_forks_repo_licenses": ["BSD-2-Clause-FreeBSD"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.8151815182, "max_line_length": 258, "alphanum_fraction": 0.5700066357, "include": true, "reason": "import numpy,from numpy,from scipy", "num_tokens": 2788}
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import os import numpy as np import boto3 import time import sagemaker import sagemaker.session from sagemaker.workflow.parameters import ParameterInteger, ParameterString from sagemaker.sklearn.processing import SKLearnProcessor from sagemaker.processing import ProcessingInput, ProcessingOutput from sagemaker.workflow.steps import ProcessingStep, TrainingStep, CacheConfig from sagemaker.workflow.properties import PropertyFile from sagemaker.inputs import TrainingInput from sagemaker.workflow.step_collections import RegisterModel from sagemaker.workflow.pipeline import Pipeline BASE_DIR = os.path.dirname(os.path.realpath(__file__)) def get_session(region, default_bucket): """Gets the sagemaker session based on the region. Args: region: the aws region to start the session default_bucket: the bucket to use for storing the artifacts Returns: `sagemaker.session.Session instance """ boto_session = boto3.Session(region_name=region) sagemaker_client = boto_session.client("sagemaker") runtime_client = boto_session.client("sagemaker-runtime") return sagemaker.session.Session( boto_session=boto_session, sagemaker_client=sagemaker_client, sagemaker_runtime_client=runtime_client, default_bucket=default_bucket, ) def get_pipeline( region, role=None, default_bucket=None, pipeline_name="defect-detection-semantic-segmentation-pipeline", base_job_prefix="defect-detection-semantic-segmentation", ): """Gets a SageMaker ML Pipeline instance working with on DefectDetection data. Args: region: AWS region to create and run the pipeline. role: IAM role to create and run steps and pipeline. default_bucket: the bucket to use for storing the artifacts Returns: an instance of a pipeline """ sagemaker_session = get_session(region, default_bucket) if role is None: role = sagemaker.session.get_execution_role(sagemaker_session) ## By enabling cache, if you run this pipeline again, without changing the input ## parameters it will skip the training part and reuse the previous trained model cache_config = CacheConfig(enable_caching=True, expire_after="30d") ts = time.strftime('%Y-%m-%d-%H-%M-%S') # Data prep processing_instance_type = ParameterString( # instance type for data preparation name="ProcessingInstanceType", default_value="ml.m5.xlarge" ) processing_instance_count = ParameterInteger( # number of instances used for data preparation name="ProcessingInstanceCount", default_value=1 ) # Training training_instance_type = ParameterString( # instance type for training the model name="TrainingInstanceType", default_value="ml.c5.xlarge" ) training_instance_count = ParameterInteger( # number of instances used to train your model name="TrainingInstanceCount", default_value=1 ) training_epochs = ParameterString( name="TrainingEpochs", default_value="100" ) # Dataset input data: S3 path input_data = ParameterString( name="InputData", default_value="", ) # Model Approval State model_approval_status = ParameterString( name="ModelApprovalStatus", default_value="PendingManualApproval" ) # Model package group name for registering in model registry model_package_group_name = ParameterString( name="ModelPackageGroupName", default_value="defect-detection-semantic-segmentation-model-group" ) # The preprocessor preprocessor = SKLearnProcessor( framework_version="0.23-1", role=role, instance_type=processing_instance_type, instance_count=processing_instance_count, max_runtime_in_seconds=7200, ) # A preprocessing report to store some information from the preprocessing step for next steps preprocessing_report = PropertyFile( name='PreprocessingReport', output_name='preprocessing_report', path='preprocessing_report.json' ) # Preprocessing Step step_process = ProcessingStep( name="DefectDetectionPreprocessing", code=os.path.join(BASE_DIR, 'preprocessing.py'), ## this is the script defined above processor=preprocessor, inputs=[ ProcessingInput(source=input_data, destination='/opt/ml/processing/input') ], outputs=[ ProcessingOutput(output_name='train_data', source='/opt/ml/processing/train'), ProcessingOutput(output_name='test_data', source='/opt/ml/processing/test'), ProcessingOutput(output_name='val_data', source='/opt/ml/processing/val'), ProcessingOutput(output_name='preprocessing_report', source='/opt/ml/processing/report') ], job_arguments=['--split', '0.1'], property_files=[preprocessing_report] ) from sagemaker.tensorflow import TensorFlow model_dir = '/opt/ml/model' hyperparameters = {'epochs': training_epochs, 'batch_size': 8, 'learning_rate': 0.0001} estimator = TensorFlow(source_dir=BASE_DIR, entry_point='train_tf.py', model_dir=model_dir, instance_type=training_instance_type, #instance_type='local', instance_count=training_instance_count, hyperparameters=hyperparameters, role=role, output_path='s3://{}/{}/{}/{}'.format(default_bucket, 'models', base_job_prefix, 'training-output'), framework_version='2.2.0', py_version='py37', script_mode=True ) step_train = TrainingStep( name="DefectDetectionSemanticSegmentationTrain", estimator=estimator, inputs={ "train": TrainingInput( s3_data=step_process.properties.ProcessingOutputConfig.Outputs["train_data"].S3Output.S3Uri, content_type='image/png', s3_data_type='S3Prefix' ), "validation": TrainingInput( s3_data=step_process.properties.ProcessingOutputConfig.Outputs["val_data"].S3Output.S3Uri, content_type='image/png', s3_data_type='S3Prefix' ) }, cache_config=cache_config ) # Register model step that will be conditionally executed step_register = RegisterModel( name="DefectDetectionSemanticSegmentationRegister", estimator=estimator, model_data=step_train.properties.ModelArtifacts.S3ModelArtifacts, content_types=["image/png"], response_types=["application/json"], inference_instances=["ml.c5.2xlarge", "ml.p3.2xlarge"], transform_instances=["ml.c5.xlarge"], model_package_group_name=model_package_group_name, approval_status=model_approval_status ) pipeline = Pipeline( name=pipeline_name, parameters=[ processing_instance_type, processing_instance_count, training_instance_type, training_instance_count, training_epochs, input_data, model_approval_status, model_package_group_name ], steps=[step_process, step_train, step_register], sagemaker_session=sagemaker_session, ) return pipeline
{"hexsha": "e1904458e9960fc48085767b14f0b32283301954", "size": 7516, "ext": "py", "lang": "Python", "max_stars_repo_path": "src/cloud/pipelines/semantic_segmentation/pipeline.py", "max_stars_repo_name": "aws-samples/amazon-sagemaker-edge-defect-detection-computer-vision", "max_stars_repo_head_hexsha": "61d762ef43a59a5ec2a59d4230caccfef466f45d", "max_stars_repo_licenses": ["MIT-0"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2021-07-22T14:05:23.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-12T22:53:36.000Z", "max_issues_repo_path": "src/cloud/pipelines/semantic_segmentation/pipeline.py", "max_issues_repo_name": "aws-samples/amazon-sagemaker-edge-defect-detection-computer-vision", "max_issues_repo_head_hexsha": "61d762ef43a59a5ec2a59d4230caccfef466f45d", "max_issues_repo_licenses": ["MIT-0"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2021-09-17T12:43:51.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-24T07:12:45.000Z", "max_forks_repo_path": "src/cloud/pipelines/semantic_segmentation/pipeline.py", "max_forks_repo_name": "aws-samples/amazon-sagemaker-edge-defect-detection-computer-vision", "max_forks_repo_head_hexsha": "61d762ef43a59a5ec2a59d4230caccfef466f45d", "max_forks_repo_licenses": ["MIT-0"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2021-09-20T14:42:59.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-23T21:59:09.000Z", "avg_line_length": 35.961722488, "max_line_length": 108, "alphanum_fraction": 0.6883980841, "include": true, "reason": "import numpy,import sage,from sage", "num_tokens": 1564}
[STATEMENT] lemma (in Module) lin_span_sub_carrier:"\<lbrakk>ideal R A; H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> linear_span R M A H \<subseteq> carrier M" [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>ideal R A; H \<subseteq> carrier M\<rbrakk> \<Longrightarrow> linear_span R M A H \<subseteq> carrier M [PROOF STEP] apply (cut_tac sc_Ring) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R\<rbrakk> \<Longrightarrow> linear_span R M A H \<subseteq> carrier M [PROOF STEP] apply (rule subsetI) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>x. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; x \<in> linear_span R M A H\<rbrakk> \<Longrightarrow> x \<in> carrier M [PROOF STEP] apply (simp add:linear_span_def) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>x. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; x \<in> (if H = {} then {\<zero>} else {x. \<exists>n. \<exists>f\<in>{j. j \<le> n} \<rightarrow> H. \<exists>s\<in>{j. j \<le> n} \<rightarrow> A. x = l_comb R M n s f})\<rbrakk> \<Longrightarrow> x \<in> carrier M [PROOF STEP] apply (case_tac "H = {}") [PROOF STATE] proof (prove) goal (2 subgoals): 1. \<And>x. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; x \<in> (if H = {} then {\<zero>} else {x. \<exists>n. \<exists>f\<in>{j. j \<le> n} \<rightarrow> H. \<exists>s\<in>{j. j \<le> n} \<rightarrow> A. x = l_comb R M n s f}); H = {}\<rbrakk> \<Longrightarrow> x \<in> carrier M 2. \<And>x. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; x \<in> (if H = {} then {\<zero>} else {x. \<exists>n. \<exists>f\<in>{j. j \<le> n} \<rightarrow> H. \<exists>s\<in>{j. j \<le> n} \<rightarrow> A. x = l_comb R M n s f}); H \<noteq> {}\<rbrakk> \<Longrightarrow> x \<in> carrier M [PROOF STEP] apply simp [PROOF STATE] proof (prove) goal (2 subgoals): 1. \<And>x. \<lbrakk>ideal R A; Ring R; x = \<zero>; H = {}\<rbrakk> \<Longrightarrow> \<zero> \<in> carrier M 2. \<And>x. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; x \<in> (if H = {} then {\<zero>} else {x. \<exists>n. \<exists>f\<in>{j. j \<le> n} \<rightarrow> H. \<exists>s\<in>{j. j \<le> n} \<rightarrow> A. x = l_comb R M n s f}); H \<noteq> {}\<rbrakk> \<Longrightarrow> x \<in> carrier M [PROOF STEP] apply (simp add:module_inc_zero) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>x. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; x \<in> (if H = {} then {\<zero>} else {x. \<exists>n. \<exists>f\<in>{j. j \<le> n} \<rightarrow> H. \<exists>s\<in>{j. j \<le> n} \<rightarrow> A. x = l_comb R M n s f}); H \<noteq> {}\<rbrakk> \<Longrightarrow> x \<in> carrier M [PROOF STEP] apply simp [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>x. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; \<exists>n. \<exists>f\<in>{j. j \<le> n} \<rightarrow> H. \<exists>s\<in>{j. j \<le> n} \<rightarrow> A. x = l_comb R M n s f; H \<noteq> {}\<rbrakk> \<Longrightarrow> x \<in> carrier M [PROOF STEP] apply (erule exE, (erule bexE)+, simp, thin_tac "x = l_comb R M n s f") [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>x n f s. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; H \<noteq> {}; f \<in> {j. j \<le> n} \<rightarrow> H; s \<in> {j. j \<le> n} \<rightarrow> A\<rbrakk> \<Longrightarrow> l_comb R M n s f \<in> carrier M [PROOF STEP] apply (simp add:l_comb_def) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>n f s. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; H \<noteq> {}; f \<in> {j. j \<le> n} \<rightarrow> H; s \<in> {j. j \<le> n} \<rightarrow> A\<rbrakk> \<Longrightarrow> \<Sigma>\<^sub>e M (\<lambda>j. s j \<cdot>\<^sub>s f j) n \<in> carrier M [PROOF STEP] apply (rule_tac n = n in nsum_mem) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>n f s. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; H \<noteq> {}; f \<in> {j. j \<le> n} \<rightarrow> H; s \<in> {j. j \<le> n} \<rightarrow> A\<rbrakk> \<Longrightarrow> \<forall>j\<le>n. s j \<cdot>\<^sub>s f j \<in> carrier M [PROOF STEP] apply (rule allI, rule impI) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>n f s j. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; H \<noteq> {}; f \<in> {j. j \<le> n} \<rightarrow> H; s \<in> {j. j \<le> n} \<rightarrow> A; j \<le> n\<rbrakk> \<Longrightarrow> s j \<cdot>\<^sub>s f j \<in> carrier M [PROOF STEP] apply (rule sc_mem) [PROOF STATE] proof (prove) goal (2 subgoals): 1. \<And>n f s j. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; H \<noteq> {}; f \<in> {j. j \<le> n} \<rightarrow> H; s \<in> {j. j \<le> n} \<rightarrow> A; j \<le> n\<rbrakk> \<Longrightarrow> s j \<in> carrier R 2. \<And>n f s j. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; H \<noteq> {}; f \<in> {j. j \<le> n} \<rightarrow> H; s \<in> {j. j \<le> n} \<rightarrow> A; j \<le> n\<rbrakk> \<Longrightarrow> f j \<in> carrier M [PROOF STEP] apply (simp add:Pi_def Ring.ideal_subset) [PROOF STATE] proof (prove) goal (1 subgoal): 1. \<And>n f s j. \<lbrakk>ideal R A; H \<subseteq> carrier M; Ring R; H \<noteq> {}; f \<in> {j. j \<le> n} \<rightarrow> H; s \<in> {j. j \<le> n} \<rightarrow> A; j \<le> n\<rbrakk> \<Longrightarrow> f j \<in> carrier M [PROOF STEP] apply (simp add:Pi_def subsetD) [PROOF STATE] proof (prove) goal: No subgoals! [PROOF STEP] done
{"llama_tokens": 2285, "file": "Group-Ring-Module_Algebra7", "length": 15}
SUBROUTINE CLUKM(X,NX,N,NATT,NCLUST,IASSGN,LIST,NUM,SS,MAXIT, * IWORK,RW,NW) C*********************************************************************** C* * C* FORTRAN CODE WRITTEN FOR INCLUSION IN IBM RESEARCH REPORT RC20525, * C* 'FORTRAN ROUTINES FOR USE WITH THE METHOD OF L-MOMENTS, VERSION 3' * C* * C* J. R. M. HOSKING * C* IBM RESEARCH DIVISION * C* T. J. WATSON RESEARCH CENTER * C* YORKTOWN HEIGHTS * C* NEW YORK 10598, U.S.A. * C* * C* VERSION 3 AUGUST 1996 * C* * C*********************************************************************** C C CLUSTER ANALYSIS BY THE K-MEANS ALGORITHM C C PARAMETERS OF ROUTINE: C X * INPUT* ARRAY OF DIMENSION (NX,NATT). X(I,J) SHOULD C CONTAIN THE J'TH ATTRIBUTE FOR THE I'TH DATA POINT. C NX * INPUT* THE FIRST DIMENSION OF ARRAY X, AS DECLARED IN THE C CALLING PROGRAM. C N * INPUT* NUMBER OF DATA POINTS C NATT * INPUT* NUMBER OF ATTRIBUTES FOR EACH DATA POINT C NCLUST * INPUT* NUMBER OF CLUSTERS C IASSGN *IN/OUT* ARRAY OF LENGTH N. ON ENTRY, SHOULD CONTAIN THE C INITIAL ASSIGNMENT OF SITES TO CLUSTERS. ON EXIT, C CONTAINS THE FINAL ASSIGNMENT. THE I'TH ELEMENT OF C THE ARRAY CONTAINS THE LABEL OF THE CLUSTER TO WHICH C THE I'TH DATA POINT BELONGS. LABELS MUST BE BETWEEN C 1 AND NCLUST, AND EACH OF THE VALUES 1 THROUGH NCLUST C MUST OCCUR AT LEAST ONCE. C LIST *OUTPUT* ARRAY OF LENGTH N. CONTAINS THE DATA POINTS IN C CLUSTER 1, FOLLOWED BY THE DATA POINTS IN CLUSTER 2, C ETC. DATA POINTS IN EACH CLUSTER ARE LISTED IN C INCREASING ORDER. THE LAST DATA POINT IN EACH C CLUSTER IS INDICATED BY A NEGATIVE NUMBER. C NUM *OUTPUT* ARRAY OF LENGTH NCLUST. NUMBER OF DATA POINTS IN C EACH CLUSTER. C SS *OUTPUT* WITHIN-GROUP SUM OF SQUARES OF THE FINAL CLUSTERS. C MAXIT * INPUT* MAXIMUM NUMBER OF ITERATIONS FOR THE K-MEANS C CLUSTERING ALGORITHM C IWORK * LOCAL* (INTEGER) WORK ARRAY OF LENGTH NCLUST*3 C RW * LOCAL* REAL WORK ARRAY OF LENGTH NW. N.B. THIS ARRAY IS OF C TYPE REAL, NOT DOUBLE PRECISION! C NW * INPUT* LENGTH OF ARRAY RW. MUST BE AT LEAST C (N+NCLUST)*(NATT+1)+2*NCLUST C C OTHER ROUTINES USED: APPLIED STATISTICS ALGORITHM AS136 (ROUTINES C KMNS,OPTRA,QTRAN), AVAILABLE FROM C HTTP://STAT.LIB.CMU.EDU/APSTAT/136 C IMPLICIT DOUBLE PRECISION (A-H,O-Z) DOUBLE PRECISION X(NX,NATT) INTEGER IASSGN(N),LIST(N),NUM(NCLUST),IWORK(NCLUST,3) REAL RW(NW) DATA ZERO/0D0/ C C SET ADDRESSES FOR SUBDIVISION OF WORK ARRAY C MC=1 MA=MC+NCLUST*NATT MAN1=MA+N*NATT MAN2=MAN1+NCLUST MWSS=MAN2+NCLUST MD=MWSS+NCLUST NWREQ=MD+N-1 IF(NW.LT.NWREQ)GOTO 1000 LA=MA-1 LWSS=MWSS-1 C C COPY ATTRIBUTES TO WORK ARRAY C IW=LA DO 5 IATT=1,NATT DO 5 I=1,N IW=IW+1 5 RW(IW)=X(I,IATT) C C COMPUTE CLUSTER CENTERS C DO 10 ICL=1,NCLUST 10 NUM(ICL)=0 IWMAX=NCLUST*NATT DO 20 IW=1,IWMAX 20 RW(IW)=ZERO DO 40 I=1,N ICL=IASSGN(I) IF(ICL.LE.0.OR.ICL.GT.NCLUST)GOTO 1010 NUM(ICL)=NUM(ICL)+1 IW=ICL DO 30 IATT=1,NATT RW(IW)=RW(IW)+X(I,IATT) IW=IW+NCLUST 30 CONTINUE 40 CONTINUE DO 60 ICL=1,NCLUST NSIZE=NUM(ICL) IF(NSIZE.EQ.0)GOTO 1020 IW=ICL DO 50 IATT=1,NATT RW(IW)=RW(IW)/NSIZE IW=IW+NCLUST 50 CONTINUE 60 CONTINUE C C CALL ALGORITHM AS136 C CALL KMNS(RW(MA),N,NATT,RW(MC),NCLUST,IASSGN,LIST,NUM,RW(MAN1), * RW(MAN2),IWORK(1,1),RW(MD),IWORK(1,2),IWORK(1,3),MAXIT,RW(MWSS), * IFAULT) IF(IFAULT.EQ.2)WRITE(6,7030) C C COMPUTE LIST ARRAY AND FINAL SUM OF SQUARES C I=0 DO 80 ICL=1,NCLUST DO 70 K=1,N IF(IASSGN(K).NE.ICL)GOTO 70 I=I+1 LIST(I)=K 70 CONTINUE LIST(I)=-LIST(I) 80 CONTINUE SS=ZERO DO 90 ICL=1,NCLUST 90 SS=SS+RW(LWSS+ICL) C RETURN C 1000 WRITE(6,7000)NWREQ RETURN 1010 WRITE(6,7010)I RETURN 1020 WRITE(6,7020)ICL RETURN C 7000 FORMAT(' *** ERROR *** ROUTINE CLUKM : INSUFFICIENT WORKSPACE.', * ' LENGTH OF WORK ARRAY SHOULD BE AT LEAST ',I8) 7010 FORMAT(' *** ERROR *** ROUTINE CLUKM :', * ' INVALID INITIAL CLUSTER NUMBER FOR DATA POINT ',I5) 7020 FORMAT(' *** ERROR *** ROUTINE CLUKM :', * ' INITIAL CLUSTERS INVALID. CLUSTER ',I4,' HAS NO MEMBERS.') 7030 FORMAT(' ** WARNING ** ROUTINE CLUKM :', * ' ITERATION HAS NOT CONVERGED. RESULTS MAY BE UNRELIABLE.') C END
{"hexsha": "aeb4d4a620165729e5f0a11bf489b7836a2a6c1b", "size": 5383, "ext": "for", "lang": "FORTRAN", "max_stars_repo_path": "contrib/lmoments/Src/clukm.for", "max_stars_repo_name": "xylar/cdat", "max_stars_repo_head_hexsha": "8a5080cb18febfde365efc96147e25f51494a2bf", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 62, "max_stars_repo_stars_event_min_datetime": "2018-03-30T15:46:56.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-08T23:30:24.000Z", "max_issues_repo_path": "contrib/lmoments/Src/clukm.for", "max_issues_repo_name": "xylar/cdat", "max_issues_repo_head_hexsha": "8a5080cb18febfde365efc96147e25f51494a2bf", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 114, "max_issues_repo_issues_event_min_datetime": "2018-03-21T01:12:43.000Z", "max_issues_repo_issues_event_max_datetime": "2021-07-05T12:29:54.000Z", "max_forks_repo_path": "contrib/lmoments/Src/clukm.for", "max_forks_repo_name": "CDAT/uvcdat", "max_forks_repo_head_hexsha": "5133560c0c049b5c93ee321ba0af494253b44f91", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 14, "max_forks_repo_forks_event_min_datetime": "2018-06-06T02:42:47.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-26T03:27:00.000Z", "avg_line_length": 35.8866666667, "max_line_length": 72, "alphanum_fraction": 0.5249860672, "num_tokens": 1673}
""" permutation-flowshop repository Module that implements constructive heuristics for the flowshop scheduling problem. """ import random import numpy as np def NEH(solution, tie_breaking=False, order_jobs="SD"): """Create initial solution with NEH heuristic. Apply the Nawaz, Enscore and Hans heuristic (1983) to the solution object argument. Arguments: solution: Solution object. tie_breaking: Use tie breaking mechanism (boolean, default: False). order_jobs: How to order jobs, possible values are: SD - Non decreasing sum of processing times (original order) AD - Non decreasing sum of the mean and deviation of processing times RD - Jobs are randomly ordered """ # Order jobs if order_jobs == 0: sorted_jobs = _sd_order(solution) elif order_jobs == 1: sorted_jobs = _ad_order(solution) else: sorted_jobs = [i for i in range(1, solution.num_jobs + 1)] random.shuffle(sorted_jobs) # Take the first two jobs and schedule them in order to minimize the partial makespan solution.sequence = [sorted_jobs[0],sorted_jobs[1]] makespan1 = solution.calculate_makespan() solution.sequence = [sorted_jobs[1], sorted_jobs[0]] if makespan1 < solution.calculate_makespan(): solution.sequence = [sorted_jobs[0],sorted_jobs[1]] solution.makespan = makespan1 # For i = 3 to n: Insert the i-th job at the place, among # the i possible ones, which minimize the partial makespan for job in sorted_jobs[2:]: solution.insert_best_position(job, tie_breaking) def _sd_order(solution): """Order jobs by non decreasing sum of the processing times.""" total_processing_times = dict() for i in range(1, solution.num_jobs + 1): total_processing_times[i] = np.sum(solution.processing_times[i-1]) return sorted(total_processing_times, key=total_processing_times.get, reverse=True) def _ad_order(solution): """Order jobs by non-decreasing sum of the mean and deviation (Huang and Chen, 2008).""" average_plus_deviation = dict() for i in range(1, solution.num_jobs + 1): avg = np.mean(solution.processing_times[i-1]) dev = np.std(solution.processing_times[i-1]) average_plus_deviation[i] = avg + dev return sorted(average_plus_deviation, key=average_plus_deviation.get, reverse=True)
{"hexsha": "c9f6723e641d91fe154c6bc846eb771b832fc7a0", "size": 2399, "ext": "py", "lang": "Python", "max_stars_repo_path": "src/constructive_heuristic.py", "max_stars_repo_name": "sukanyakudva/permutation-flowshop", "max_stars_repo_head_hexsha": "11ac52f309cf443da9bff5a11b9e83602fdae84a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/constructive_heuristic.py", "max_issues_repo_name": "sukanyakudva/permutation-flowshop", "max_issues_repo_head_hexsha": "11ac52f309cf443da9bff5a11b9e83602fdae84a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/constructive_heuristic.py", "max_forks_repo_name": "sukanyakudva/permutation-flowshop", "max_forks_repo_head_hexsha": "11ac52f309cf443da9bff5a11b9e83602fdae84a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-10-02T07:40:54.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-02T07:40:54.000Z", "avg_line_length": 38.6935483871, "max_line_length": 92, "alphanum_fraction": 0.70237599, "include": true, "reason": "import numpy", "num_tokens": 562}
import datetime import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn import cross_validation from sklearn.linear_model import LogisticRegression from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from pylab import rcParams import pickle import json import os class protomodel: def train(self, csvpath, mode): """ trains the selected predictive model and returns printed report selects algorithm based on mode variable mode = ['simple', 'decisiontrees','regression'] returns serialized model """ print("test") df = pd.read_csv(csvpath).set_index('time') df['diff'] = np.abs(df.velocity - df.velocity_edited) df['anomaly'] = df['diff'].apply(lambda x: 1 if x > 0 else 0) columns = ['level', 'velocity', 'level_1', 'velocity_1', 'level_2', 'velocity_2', 'level_3', 'velocity_3', ] X_train, X_test, y_train, y_test = cross_validation.train_test_split(df[columns], df.anomaly, test_size=0.3, random_state=0) file_pathx = os.path.relpath("models/xtest") file_pathy = os.path.relpath("models/ytest") # print(json.dumps(X_test[1:5].tolist(), cls=SetEncoder)) # print(json.dumps(y_test[1:5].tolist(), cls=SetEncoder)) ytest = json.dumps(y_test.tolist(), cls=SetEncoder) xtest = json.dumps(X_test.tolist(), cls=SetEncoder) target = open(file_pathx, 'w') target.writelines(xtest) target.close() target = open(file_pathy, 'w') target.writelines(ytest) target.close() xs = pd.core.series.Series() clf = LogisticRegression() if mode == 'simple': xs = X_test['velocity'].apply(lambda x: 1 if x == 0 else 0) print(type(xs)) elif mode == 'regression': clf = LogisticRegression() clf.fit(X_train, y_train) xs = clf.predict(X_test) print(json.dumps(X_test[1:5].tolist(), cls=SetEncoder)) print(json.dumps(y_test[1:5].tolist(), cls=SetEncoder)) # print(type(clf)) elif mode == 'decisiontrees': clf = RandomForestClassifier() clf.fit(X_train, y_train) xs = clf.predict(X_test) self.print_report(y_test, xs) return pickle.dumps(clf) def __init__(self): test='' def print_report(self, expected, predicted): target_names = ['Anomalies', 'Regular velocity'] print("Confusion Matrix") print(confusion_matrix(expected, predicted)) print(classification_report(expected, predicted, target_names = target_names)) class SetEncoder(json.JSONEncoder): def default(self, obj): if isinstance(obj, set): return list(obj) return json.JSONEncoder.default(self, obj)
{"hexsha": "d5bd87f189968255cc85d71e1498df14242a236c", "size": 2991, "ext": "py", "lang": "Python", "max_stars_repo_path": "apps/mlservice/classes/protomodel.py", "max_stars_repo_name": "hamed225/Channel-Sensor-Error-Detection", "max_stars_repo_head_hexsha": "12aba311c4334fec2fbbe0a69e0c764d6db5988c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 8, "max_stars_repo_stars_event_min_datetime": "2018-10-12T11:47:39.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-22T08:20:47.000Z", "max_issues_repo_path": "apps/mlservice/classes/protomodel.py", "max_issues_repo_name": "aribornstein/Channel-Sensor-Error-Detection", "max_issues_repo_head_hexsha": "12aba311c4334fec2fbbe0a69e0c764d6db5988c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "apps/mlservice/classes/protomodel.py", "max_forks_repo_name": "aribornstein/Channel-Sensor-Error-Detection", "max_forks_repo_head_hexsha": "12aba311c4334fec2fbbe0a69e0c764d6db5988c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 6, "max_forks_repo_forks_event_min_datetime": "2018-03-06T15:00:38.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-22T08:21:50.000Z", "avg_line_length": 36.4756097561, "max_line_length": 132, "alphanum_fraction": 0.6255432966, "include": true, "reason": "import numpy", "num_tokens": 690}
from __future__ import (absolute_import, division, print_function, unicode_literals) import batman import numpy as np from .cache import planet_props from .limbdarkening import quad __all__ = ['kic_to_params', 'transit_model'] def kic_to_params(kic): """ For a KIC number ``kic``, return a `~batman.TransitParams` object for that star-planet system. Parameters ---------- kic : int KIC number Returns ------- params : `~batman.TransitParams` Transit parameter object Examples -------- >>> from salter import kic_to_params >>> params = kic_to_params(9705459) """ table = planet_props.table params = batman.TransitParams() # object to store transit parameters params.limb_dark = "quadratic" #limb darkening model params.u = quad(table.loc[kic]['TEFF'], 4.5, 'KP') # limb darkening coefficients params.t0 = table.loc[kic]['koi_time0bk'] + 2454833.0 # time of inferior conjunction params.per = table.loc[kic]['koi_period'] # orbital period constant = 1/(1 - params.u[0]/3 - params.u[1]/6) params.rp = np.sqrt(table.loc[kic]['koi_depth'] / 1e6 / constant) # planet radius (in units of stellar radii) params.ecc = 0 # table.loc[kic]['koi_eccen'] params.w = 90 # table.loc[kic]['koi_longp'] params.duration = table.loc[kic]['koi_duration'] / 24.0 # [days] params.b = table.loc[kic]['koi_impact'] # impact parameter a_rs, inc = T14b2aRsi(params.per,params.duration, params.b, params.rp, params.ecc, params.w) params.a = a_rs params.inc = inc return params def transit_model(kic, times): """ Compute a transit model for KIC ``kic`` at times ``times`` Parameters ---------- kic : int KIC number times : `~astropy.time.Time` Times to compute model Returns ------- flux : `~numpy.ndarray` Model fluxes at ``tiems`` """ table = planet_props.table params = kic_to_params(kic) m = batman.TransitModel(params, times) #initializes model flux = m.light_curve(params) #calculates light curve return flux def impact_parameter(transit_params): """ Calculate impact parameter of transit from other transit parameters. From Winn 2010, Eqn 7 [1]_. Parameters ---------- transit_params : `~batman.TransitParams` Transit light curve parameters Returns ------- b : float Impact parameter References ---------- .. [1] http://adsabs.harvard.edu/abs/2010arXiv1001.2010W """ e = transit_params.ecc # eccentricity w = transit_params.w # long. of pericenter [deg] a_on_Rs = transit_params.a # a/R_s i = transit_params.inc # inclination [deg] b = (a_on_Rs * np.cos(np.radians(i)) * (1 - e**2) / (1 + e*np.sin(np.radians(w)))) return b def T14b2aRsi(P, T14, b, RpRs, eccentricity, omega): """ Convert from duration and impact param to a/Rs and inclination Parameters ---------- P : float Period [days] T14 : float Duration [days] b : float Impact parameter eccentricity : float Eccentricity omega : float argument of periastron Returns aRs : float semimajor axis in units of stellar radii inc : float Orbital inclination in units of degrees """ beta = (1 - eccentricity**2)/(1 + eccentricity*np.sin(np.radians(omega))) C = np.sqrt(1 - eccentricity**2)/(1 + eccentricity*np.sin(np.radians(omega))) i = np.arctan(beta * np.sqrt((1 + RpRs)**2 - b**2)/(b*np.sin(T14*np.pi/(P*C)))) aRs = b/(np.cos(i) * beta) return aRs, np.degrees(i)
{"hexsha": "b4fa88d3d6199fb932c51c6519b6cfc658b4fc4b", "size": 3801, "ext": "py", "lang": "Python", "max_stars_repo_path": "salter/params.py", "max_stars_repo_name": "bmorris3/salter", "max_stars_repo_head_hexsha": "f7471aa074fb9fdd024ba2f4dc7ac51ae9180093", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "salter/params.py", "max_issues_repo_name": "bmorris3/salter", "max_issues_repo_head_hexsha": "f7471aa074fb9fdd024ba2f4dc7ac51ae9180093", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2017-10-09T22:43:53.000Z", "max_issues_repo_issues_event_max_datetime": "2020-10-29T19:49:48.000Z", "max_forks_repo_path": "salter/params.py", "max_forks_repo_name": "bmorris3/salter", "max_forks_repo_head_hexsha": "f7471aa074fb9fdd024ba2f4dc7ac51ae9180093", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.9574468085, "max_line_length": 122, "alphanum_fraction": 0.6014206788, "include": true, "reason": "import numpy", "num_tokens": 1049}
import cv2 import numpy as np from pathlib import Path import json from settings_folder import settings_folder circles_detection_file = f'{settings_folder}circles_detection_data.txt' def nothing(_): pass def get_circles(image): cv2.namedWindow('Circle detection') erosion = 0 minDist = 10 param1 = 30 param2 = 33 minRadius = 0 maxRadius = 1000 stable_erosion = erosion stable_minDist = minDist stable_param1 = param1 stable_param2 = param2 stable_minRadius = minRadius stable_maxRadius = maxRadius if Path(circles_detection_file).exists(): try: with open(circles_detection_file, 'r') as f: data = json.load(f) erosion, minDist, param1, param2, minRadius, maxRadius = data except EOFError: pass cv2.createTrackbar('erosion', 'Circle detection', 0, 20, nothing) cv2.createTrackbar('minDist', 'Circle detection', 0, 200, nothing) cv2.createTrackbar('param1', 'Circle detection', 0, 50, nothing) cv2.createTrackbar('param2', 'Circle detection', 0, 50, nothing) cv2.createTrackbar('minRadius', 'Circle detection', 0, 200, nothing) cv2.createTrackbar('maxRadius', 'Circle detection', 0, 800, nothing) cv2.setTrackbarPos('erosion', 'Circle detection', erosion) cv2.setTrackbarPos('minDist', 'Circle detection', minDist) cv2.setTrackbarPos('param1', 'Circle detection', param1) cv2.setTrackbarPos('param2', 'Circle detection', param2) cv2.setTrackbarPos('minRadius', 'Circle detection', minRadius) cv2.setTrackbarPos('maxRadius', 'Circle detection', maxRadius) output_alive = False error_alive = False while 1: erosion = cv2.getTrackbarPos('erosion', 'Circle detection') minDist = cv2.getTrackbarPos('minDist', 'Circle detection') param1 = cv2.getTrackbarPos('param1', 'Circle detection') param2 = cv2.getTrackbarPos('param2', 'Circle detection') minRadius = cv2.getTrackbarPos('minRadius', 'Circle detection') maxRadius = cv2.getTrackbarPos('maxRadius', 'Circle detection') try: error = False kernel = np.ones((erosion, erosion), np.uint8) output = cv2.erode(image, kernel, cv2.BORDER_REFLECT) gray = cv2.cvtColor(output, cv2.COLOR_BGR2GRAY) cv2.imshow('gray', gray) circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1, minDist, param1=param1, param2=param2, minRadius=minRadius, maxRadius=maxRadius) if circles is not None: circles = np.uint16(np.around(circles)) for index, i in enumerate(circles[0, :]): cv2.circle(output, (i[0], i[1]), i[2], (0, 255, 0), 2) stable_erosion = erosion stable_minDist = minDist stable_param1 = param1 stable_param2 = param2 stable_minRadius = minRadius stable_maxRadius = maxRadius except cv2.error: error = True erosion = stable_erosion minDist = stable_minDist param1 = stable_param1 param2 = stable_param2 minRadius = stable_minRadius maxRadius = stable_maxRadius kernel = np.ones((erosion, erosion), np.uint8) output = cv2.erode(image, kernel, cv2.BORDER_REFLECT) gray = cv2.cvtColor(output, cv2.COLOR_BGR2GRAY) cv2.imshow('gray', gray) circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1, minDist, param1=param1, param2=param2, minRadius=minRadius, maxRadius=maxRadius) if circles is not None: circles = np.uint16(np.around(circles)) for index, i in enumerate(circles[0, :]): cv2.circle(output, (i[0], i[1]), i[2], (0, 255, 0), 2) print('Error') if error: if output_alive: cv2.destroyWindow("output") output_alive = False cv2.imshow('error', output) error_alive = True else: if error_alive: cv2.destroyWindow("error") error_alive = False cv2.imshow('output', output) output_alive = True k = cv2.waitKey(1) & 0xFF if k == 27: break with open(circles_detection_file, "w") as f: json.dump([erosion, minDist, param1, param2, minRadius, maxRadius], f) cv2.destroyAllWindows() if circles is not None: circles = np.uint16(np.around(circles)) return circles, output
{"hexsha": "ec1c6fe5ae087186cb087fe8845da7ebe5f6dee9", "size": 4686, "ext": "py", "lang": "Python", "max_stars_repo_path": "circles_calibration.py", "max_stars_repo_name": "Dikzamen/dbd_bloodweb_python", "max_stars_repo_head_hexsha": "51c13a917d49740f15fdb38189308851a1369e63", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-09-25T00:51:49.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-05T02:54:19.000Z", "max_issues_repo_path": "circles_calibration.py", "max_issues_repo_name": "Dikzamen/dbd_bloodweb_python", "max_issues_repo_head_hexsha": "51c13a917d49740f15fdb38189308851a1369e63", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "circles_calibration.py", "max_forks_repo_name": "Dikzamen/dbd_bloodweb_python", "max_forks_repo_head_hexsha": "51c13a917d49740f15fdb38189308851a1369e63", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.7272727273, "max_line_length": 106, "alphanum_fraction": 0.604993598, "include": true, "reason": "import numpy", "num_tokens": 1206}
[STATEMENT] lemma sub_point_rep_number_le: "x \<in> \<U> \<Longrightarrow> \<A> rep x \<le> \<B> rep x" [PROOF STATE] proof (prove) goal (1 subgoal): 1. x \<in> \<U> \<Longrightarrow> \<A> rep x \<le> \<B> rep x [PROOF STEP] by (simp add: point_replication_number_def blocks_subset multiset_filter_mono size_mset_mono)
{"llama_tokens": 129, "file": "Design_Theory_Sub_Designs", "length": 1}
import Dates import HTTP import JSON function compare_http_date_header(header_value::String, timestamp_request_completed::Dates.DateTime) :: Nothing header_value_timestamp::Dates.DateTime = Dates.DateTime(split(header_value, " UTC")[1], "e, d u Y H:M:S") @test header_value_timestamp <= timestamp_request_completed nothing end function compare_http_header(headers::Array, key::String, value::String) :: Nothing @test header_get_value(headers::Array, key::String)==value nothing end function header_get_value(headers::Array, key::String) :: String for item in headers if item[1]==key return item[2] end end end function parse_and_test_request(r::HTTP.Messages.Response, status::Int64, headers::Vector{Pair{String,String}}, content_length::Int64, is_json::Bool, is_get::Bool, body::Union{Dict, String}="") timestamp_request_completed::Dates.DateTime = Dates.now(Dates.UTC) @test r.status==status for (key, value) in headers compare_http_header(r.headers, key, value) end compare_http_date_header(header_get_value(r.headers, "Date"), timestamp_request_completed) # TODO: fix Windows HTML file longer due to line final char if !Sys.iswindows() compare_http_header(r.headers, "Content-Length", string(content_length)) end if is_json header_get_value(r.headers, "Content-Type") == "application/json" @test JSON.json(body) == String(r.body) elseif is_get header_get_value(r.headers, "Content-Type") == "text/html; charset=UTF-8" @test occursin("Content ...", String(r.body)) else length(r.body) == 0 end nothing end
{"hexsha": "326490d3c9e6c8aab8e77afaca9ca74a61b1f1b2", "size": 1685, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "test/utils/request.jl", "max_stars_repo_name": "DanceJL/Flamenco.jl", "max_stars_repo_head_hexsha": "c0d16201f3265d2b265b6114e5af07555a467720", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/utils/request.jl", "max_issues_repo_name": "DanceJL/Flamenco.jl", "max_issues_repo_head_hexsha": "c0d16201f3265d2b265b6114e5af07555a467720", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-11-01T14:28:46.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-14T00:27:12.000Z", "max_forks_repo_path": "test/utils/request.jl", "max_forks_repo_name": "DanceJL/Flamenco.jl", "max_forks_repo_head_hexsha": "c0d16201f3265d2b265b6114e5af07555a467720", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2022-01-11T02:30:49.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-11T02:30:49.000Z", "avg_line_length": 31.2037037037, "max_line_length": 193, "alphanum_fraction": 0.7002967359, "num_tokens": 403}
""" Simple Linear Regression ======================== See `LinearRegression <http://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html>`_. """ import numpy as np import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression def plot_linear_regression(): a = 0.5 b = 1.0 # x from 0 to 10 x = 30 * np.random.random(20) # y = a*x + b with noise y = a * x + b + np.random.normal(size=x.shape) # create a linear regression classifier clf = LinearRegression() clf.fit(x[:, None], y) # predict y from the data x_new = np.linspace(0, 30, 100) y_new = clf.predict(x_new[:, None]) # plot the results ax = plt.axes() ax.scatter(x, y) ax.plot(x_new, y_new) ax.set_xlabel('x') ax.set_ylabel('y') ax.axis('tight') plot_linear_regression()
{"hexsha": "b799b8b48b1368a36b67073ade9931539af7a66f", "size": 868, "ext": "py", "lang": "Python", "max_stars_repo_path": "_doc/examples/sklearn_ensae_course/plot_linear_regression.py", "max_stars_repo_name": "Jerome-maker/ensae_teaching_cs", "max_stars_repo_head_hexsha": "43ea044361ee60c00c85aea354a7b25c21c0fd07", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 73, "max_stars_repo_stars_event_min_datetime": "2015-05-12T13:12:11.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-21T11:44:29.000Z", "max_issues_repo_path": "_doc/examples/sklearn_ensae_course/plot_linear_regression.py", "max_issues_repo_name": "Jerome-maker/ensae_teaching_cs", "max_issues_repo_head_hexsha": "43ea044361ee60c00c85aea354a7b25c21c0fd07", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 90, "max_issues_repo_issues_event_min_datetime": "2015-06-23T11:11:35.000Z", "max_issues_repo_issues_event_max_datetime": "2021-03-31T22:09:15.000Z", "max_forks_repo_path": "_doc/examples/sklearn_ensae_course/plot_linear_regression.py", "max_forks_repo_name": "Jerome-maker/ensae_teaching_cs", "max_forks_repo_head_hexsha": "43ea044361ee60c00c85aea354a7b25c21c0fd07", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 65, "max_forks_repo_forks_event_min_datetime": "2015-01-13T08:23:55.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-11T22:42:07.000Z", "avg_line_length": 20.1860465116, "max_line_length": 118, "alphanum_fraction": 0.6290322581, "include": true, "reason": "import numpy", "num_tokens": 234}
""" calc_grm() --- Merge imputed data and calculate GRM. e.g., two.bed + norge.bed, or, dutch.bed, german.bed, norge.bed """ function calc_grm(source) title("Data imputed within country") cd(work_dir) fra = joinpath(work_dir, "data/genotypes/step-8.plk") ped = joinpath(work_dir, "data/pedigree") tmp = joinpath(work_dir, "tmp") empty_dir(tmp) item("Merge source beds into one") open(joinpath(tmp, "beds.lst"), "w") do lst for data in source write(lst, joinpath(fra, data), '\n') end end _ = read(`plink --cow --merge-list $tmp/beds.lst --make-bed --out $tmp/one`, String) done() cd(tmp) item("Prepare pedigree") pds = [joinpath(ped, "dutch.ped"), joinpath(ped, "german.ped")] _ = run(pipeline(`cat $pds`, `$rdBin/pedsort UUUUUUUUUUUUUUUUUUU`, "two.ped")) _ = run(pipeline(joinpath(ped, "norge.ped"), `$rdBin/pedsort 0`, "third.ped")) peds = [joinpath(tmp, "two.ped"), joinpath(tmp, "third.ped")] _ = run(pipeline(`$rdBin/merge-ped $peds`, joinpath(tmp, "all.ped"))) done() item("ID country index") idic = Dict() for line in eachline(joinpath(tmp, "all.ped")) id, name = [split(line)[i] for i in [1, 4]] push!(idic, name => id) end icntry = 0 cdic = Dict() countries = ["dutch", "german", "norge"] for country in countries icntry += 1 for line in eachline(joinpath(fra, "$country.fam")) name = split(line)[2] push!(cdic, name=>icntry) end end # To put some MRY Dutch bulls in group 4 for line in eachline(joinpath(fra, "dutch.fam")) name = split(line)[2] if name[1:3] == "MRY" cdic[name] = 4 end end # fourth group ends here mv("one.fam", "tmp.fam", force=true) cindx = open("country.idx", "w") ifam = open("one.fam", "w") for line in eachline("tmp.fam") t = split(line) name = t[2] t[2] = idic[name] write(ifam, join(t, ' '), '\n') tvec = [0, 0, 0, 0] tvec[cdic[name]] = 1 write(cindx, idic[name], ' ', join(tvec, ' '), '\n') end close(cindx) close(ifam) done() item("Convert bed to 012 genotypes.txt") #plink_012("one", "tmp") _ = run(`plink --cow --bfile one --extract $work_dir/data/genotypes/5160.raw --recode A --out tmp` ) _ = run(pipeline("tmp.raw", `$rdBin/raw2gt`, "genotypes.txt")) done() item("Calculate GRM") nlc = length(split(readline("genotypes.txt"))[2]) inp = ["$nlc", "genotypes.txt", "genotypes", "4 country.idx", "vanraden", "giv 0.00", "G ASReml", "print_giv=asc", "print_geno=no genotypes.dat", "12", ""] write("calc_grm.inp", join(inp, '\n')) _ = run(`calc_grm`) _ = read(run(pipeline("G.grm", `gawk '{if($1==$2) print $3}'`, "diag.txt")), String) done() item("Parents offspring consistancy") open("int.ped", "w") do io for line in eachline("all.ped") id, pa, ma = split(line) write(io, "$id $pa $ma\n") end end inp = ["$nlc", "genotypes.txt int.ped", "genotypes", "1", "vanraden", "giv 0.00", "G ASReml", "print_giv=asc", "print_geno=no genotypes.dat", "12", "!checkparents", ""] mv("calc_grm.inp", "cal_grm.inp.G", force=true) write(joinpath(tmp, "calc_grm.inp"), join(inp, '\n')) _ = run(`calc_grm`) done() cd(work_dir) end """ Calculate grm on MRY related ID in dutch pedigree """ function calc_grm_dutch_MRY() title("Data imputed within country") cd(work_dir) fra = joinpath(work_dir, "data/genotypes/step-8.plk") ped = joinpath(work_dir, "data/pedigree") tmp = joinpath(work_dir, "tmp") empty_dir(tmp) item("Prepare Dutch MRY releated data") _ = run(pipeline(joinpath(ped, "dutch.ped"), `grep MRY`, `gawk '{print $1}'`, joinpath(tmp, "MRY.lst"))) open(joinpath(tmp, "id.lst"), "w") do io for line in eachline(joinpath(tmp, "MRY.lst")) write(io, "0 $line\n") end end _ = run(pipeline(joinpath(ped, "dutch.ped"), `$rdBin/pedsort UUUUUUUUUUUUUUUUUUU`, joinpath(tmp, "dutch.ped"))) _ = run(`plink --cow --bfile $fra/dutch --keep $tmp/id.lst --extract $work_dir/data/genotypes/5160.raw --make-bed --out $tmp/mry` ) cd(tmp) ID = Dict() for line in eachline("dutch.ped") id, name = [split(line)[i] for i in [1, 4]] push!(ID, name=>id) end mv("mry.fam", "tmp.fam", force=true) open("mry.fam", "w") do io for line in eachline("tmp.fam") x = split(line) x[2] = ID[x[2]] write(io, join(x, ' '), '\n') end end plink_012("mry", "tmp") _ = run(pipeline("tmp.raw", `$rdBin/raw2gt`, "genotypes.txt")) done() item("Calculate GRM") nlc = length(split(readline("genotypes.txt"))[2]) inp = ["$nlc", "genotypes.txt", "genotypes", "1", "vanraden", "giv 0.00", "G ASReml", "print_giv=asc", "print_geno=no genotypes.dat", "12", ""] write("calc_grm.inp", join(inp, '\n')) _ = run(`calc_grm`) _ = read(run(pipeline("G.grm", `gawk '{if($1==$2) print $3}'`, "diag.txt")), String) done() item("Parents offspring consistancy") open("int.ped", "w") do io for line in eachline("dutch.ped") id, pa, ma = split(line) write(io, "$id $pa $ma\n") end end inp = ["$nlc", "genotypes.txt int.ped", "genotypes", "1", "vanraden", "giv 0.00", "G ASReml", "print_giv=asc", "print_geno=no genotypes.dat", "12", "!checkparents", ""] mv("calc_grm.inp", "cal_grm.inp.G", force=true) write(joinpath(tmp, "calc_grm.inp"), join(inp, '\n')) _ = run(`calc_grm`) done() cd(work_dir) end """ calc_grm_by_country() --- Calculate **`G`** by country. Also QQ-plot diagonals. This must be run after `calc_grm` to have the data ready. """ function calc_grm_by_country() title("Examine GRM by country") grm = joinpath(work_dir, "data/genotypes/grm") tmp = joinpath(work_dir, "tmp") bin = joinpath(work_dir, "bin") til = joinpath(work_dir, "data/genotypes/grm") cd(tmp) for country in ["dutch", "german", "norge"] item("G of $country") _ = run(pipeline(`$bin/merge4grm $country.raw`, "genotypes.txt")) open("calc_grm.inp", "w") do io nlc = 0 open(joinpath(tmp, "genotypes.txt"), "r") do gt line = readline(gt) nlc = length(split(line)) - 1 end # it's 44037 anyway write(io, "$nlc\n") write(io, "genotypes.txt\n") write(io, "genotypes\n") write(io, "1\n") write(io, "vanraden\n") write(io, "giv 0.00\n") write(io, "G ASReml\n") write(io, "print_giv=asc\n") write(io, "print_geno=no genotypes.dat\n") write(io, "12\n") # number of threads end _ = run(`calc_grm`) _ = read(run(pipeline("G.grm", `gawk '{if($1==$2) print $3}'`, "diag.txt")), String) isdir("$til/$country") || mkdir("$til/$country") for file in ["calc_grm.inp", "calculated_all_freq.dat", "country.idx", "diag.txt", "G_asreml.giv", "genomic_inbr_coef.dat", "genotypes.txt", "G.grm", "high_grm_coefs.log", "ID.dic", "ID_vs_row_number_G.txt", "WARNING_ERROR_calc_grm.log"] isfile(file) && mv(file, "$grm/$country/$file", force=true) end end cd(work_dir) end """ plot_grm_diag() --- Sort and plot diagonals of `GRM`. """ function plot_grm_diag() title("QQ-Plot GRM diagonals") fra = joinpath(work_dir, "data/genotypes/grm") pp = Any[] for country in ["all", "dutch", "german", "norge"] item("Figure of $country") dd = Float64[] for line in eachline(joinpath(fra, "$country/diag.txt")) push!(dd, parse(Float64, line)) end p = plot(sort(dd), label = country, dpi=300) push!(pp, p) end plot(pp[1], pp[2], pp[3], pp[4], layout=4) savefig("notebooks/fig/diag.png") end """ calc_grm_w_ped() --- Previously the elements in Dutch and Norwegian block are weird. This funciton tries to bend the results toward the **A** matrix, to see if the problem is alieved or not. """ function calc_grm_w_ped() title("Calculate GRM with pedigree") item("Prepare directories") countries = ["dutch", "german", "norge"] cd(work_dir) fra = joinpath(work_dir, "data/genotypes/step-8.plk") tmp = joinpath(work_dir, "tmp") bin = joinpath(work_dir, "bin") grm = joinpath(work_dir, "data/genotypes/grm") ped = joinpath(work_dir, "data/pedigree") isdir(grm) || mkdir(grm) empty_dir(tmp) done() item("Create unified pedigree") run(pipeline(joinpath(ped, "dg.ped"), `$bin/pedsort UUUUUUUUUUUUUUUUUUU`, joinpath(tmp, "dg.ped"))) run(pipeline(joinpath(ped, "norge.ped"), `$bin/pedsort 0`, joinpath(tmp, "norge.ped"))) argv = joinpath.(tmp, ["dg.ped", "norge.ped"]) run(pipeline(`$bin/merge-ped $argv`, joinpath(tmp,"one.ped"))) done() item("Convert country.bed to raw data") for country in countries plink_012(joinpath(fra, country), joinpath(tmp, country)) end done() item("Merge raw data for `calc_grm`") argv = joinpath.(tmp, ["dutch.raw", "german.raw", "norge.raw", "country.idx"]) _ = run(pipeline(joinpath(tmp, "one.ped"), `$bin/merge4grm $argv`, joinpath(tmp, "genotypes.txt"))) done() item("Create a parameter file for `calc_grm`") nlc = begin open(joinpath(tmp, "genotypes.txt"), "r") do gt line = readline(gt) length(split(line)) - 1 end end open(joinpath(tmp, "three.ped"), "w") do ped for line in eachline(joinpath(tmp, "one.ped")) id, pa, ma = split(line)[1:3] write(ped, "$id $pa $ma\n") end end inp = ["$nlc", "genotypes.txt three.ped", "genotypes", "1", "vanraden", "giv 0.00", "G ASReml", "print_giv=asc", "print_geno=no genotypes.dat", "12", "!checkparents", ""] write(joinpath(tmp, "calc_grm.inp"), join(inp, '\n')) done() item("Run `calc_grm`") cd(tmp) _ = run(`calc_grm`) done() cd(work_dir) end """ This function create an ID (string) dictionary to (integer). - Unknown ID are coded as 0 - Known ID start from 1 - ID in sire, dam columns and not in ID column are coded first - Country were also recorded as 1, 2, 3 for dutch, german and norge, respectively. """ function generate_ID_dict() title("generate a ID dictionary of all ID in 3 countries") dic = open(joinpath(work_dir, "data/pedigree/ID.dict"), "w") ped = open(joinpath(work_dir, "data/pedigree/union.ped"), "w") idx = open(joinpath(work_dir, "data/pedigree/country.idx"), "w") ref = Dict() iid = 0 write(dic, "UUUUUUUUUUUUUUUUUUU 0 0\n") # an unknown parent write(dic, "0 0 0\n") # another unknown parent push!(ref, "UUUUUUUUUUUUUUUUUUU" => 0) push!(ref, "0" => 0) breed = Dict("dutch" => " 1 0 0\n", "german" => " 0 1 0\n", "norge" => " 0 0 1\n") for country in ["dutch", "german", "norge"] id, pa, ma = begin a = String[] b = String[] c = String[] fra = joinpath(work_dir, "data/pedigree/$country.ped") for line in eachline(fra) x, y, z = (split(line)[i] for i in [1, 2, 3]) push!(a, x) push!(b, y) push!(c, z) end Set(a), delete!(Set(b), "UUUUUUUUUUUUUUUUUUU"), delete!(Set(c), "UUUUUUUUUUUUUUUUUUU") end println("N id pa ma in $country: ", length(id), ' ', length(pa), ' ', length(ma)) for i in setdiff(union(pa, ma), id) iid += 1 write(dic, "$i $iid $country\n") push!(ref, i => iid) write(ped, iid, " 0 0\n") write(idx, iid, breed[country]) end for line in eachline(joinpath(work_dir, "data/pedigree/$country.ped")) x, y, z = (split(line)[i] for i in [1, 2, 3]) iid += 1 push!(ref, x => iid) write(dic, "$x $iid $country\n") write(ped, iid, ' ', ref[y], ' ', ref[z], '\n') write(idx, iid, breed[country]) end end close(ped, idx) done() end function test_ID() title("Test ID") #til = joinpath end #= Discarded codes allid = begin id = String[] for x in eachline(joinpath(work_dir, "data/pedigree/ids")) push!(id, x) end Set(id) end for country in ["dutch", "german", "norge"] cid = begin id = String[] for line in eachline(joinpath(work_dir, "data/genotypes/step-8.plk/$country.fam")) push!(id, split(line)[2]) end Set(id) end did = setdiff(cid, allid) if length(did) > 0 println(country, " has ", length(did), " ID not in the pedigree") write(joinpath(work_dir, "tmp/$country.diff"), join(did, '\n'), '\n') end end =#
{"hexsha": "ded30e2cbbbed119a3069986fc3191542ee788a2", "size": 14019, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "src/grm/calc-grm.jl", "max_stars_repo_name": "xijiang/ReDiverse.jl", "max_stars_repo_head_hexsha": "02212b981934b43997b942a78ea8e6f7ac1b9fa4", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/grm/calc-grm.jl", "max_issues_repo_name": "xijiang/ReDiverse.jl", "max_issues_repo_head_hexsha": "02212b981934b43997b942a78ea8e6f7ac1b9fa4", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/grm/calc-grm.jl", "max_forks_repo_name": "xijiang/ReDiverse.jl", "max_forks_repo_head_hexsha": "02212b981934b43997b942a78ea8e6f7ac1b9fa4", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 31.3624161074, "max_line_length": 104, "alphanum_fraction": 0.5271417362, "num_tokens": 4246}
! ! Copyright © 2011 The Numerical Algorithms Group Ltd. All rights reserved. ! ! Redistribution and use in source and binary forms, with or without ! modification, are permitted provided that the following conditions are ! met: ! - Redistributions of source code must retain the above copyright notice, ! this list of conditions, and the following disclaimer. ! - Redistributions in binary form must reproduce the above copyright ! notice, this list of conditions and the following disclaimer listed in ! this license in the documentation and/or other materials provided with ! the distribution. ! - Neither the name of the copyright holders nor the names of its ! contributors may be used to endorse or promote products derived from ! this software without specific prior written permission. ! ! This software is provided by the copyright holders and contributors "as ! is" and any express or implied warranties, including, but not limited ! to, the implied warranties of merchantability and fitness for a ! particular purpose are disclaimed. in no event shall the copyright owner ! or contributors be liable for any direct, indirect, incidental, special, ! exemplary, or consequential damages (including, but not limited to, ! procurement of substitute goods or services; loss of use, data, or ! profits; or business interruption) however caused and on any theory of ! liability, whether in contract, strict liability, or tort (including ! negligence or otherwise) arising in any way out of the use of this ! software, even if advised of the possibility of such damage. ! ! ! @file plasma_f90.f90 ! ! PLASMA fortran 90 interface ! PLASMA is a software package provided by Univ. of Tennessee, ! Univ. of California Berkeley and Univ. of Colorado Denver ! ! @version 2.6.0 ! @author Numerical Algorithm Group ! @date 2011-09-15 ! @precisions normal z -> c d s ! module plasma use plasma_s use plasma_d use plasma_ds use plasma_c use plasma_z use plasma_zc include 'plasmaf.h' logical :: plasma_initialized = .false. integer, parameter :: sp = kind(0.0) integer, parameter :: dp = kind(0.0d0) interface function PLASMA_Init_c(cores) & & bind(c, name='PLASMA_Init') use iso_c_binding implicit none integer(kind=c_int) :: PLASMA_Init_c integer(kind=c_int), value :: cores end function PLASMA_Init_c end interface interface function PLASMA_Finalize_c() & & bind(c, name='PLASMA_Finalize') use iso_c_binding implicit none integer(kind=c_int) :: PLASMA_Finalize_c end function PLASMA_Finalize_c end interface interface function PLASMA_Set_c(param, pval) & & bind(c, name='PLASMA_Set') use iso_c_binding implicit none integer(kind=c_int) :: PLASMA_Set_c integer(kind=c_int), value :: param integer(kind=c_int), value :: pval end function PLASMA_Set_c end interface interface function PLASMA_Get_c(param, pval) & & bind(c, name='PLASMA_Get') use iso_c_binding implicit none integer(kind=c_int) :: PLASMA_Get_c integer(kind=c_int), value :: param type(c_ptr), value :: pval end function PLASMA_Get_c end interface interface function PLASMA_Enable_c(param) & & bind(c, name='PLASMA_Enable') use iso_c_binding implicit none integer(kind=c_int) :: PLASMA_Enable_c integer(kind=c_int), value :: param end function PLASMA_Enable_c end interface interface function PLASMA_Disable_c(param) & & bind(c, name='PLASMA_Disable') use iso_c_binding implicit none integer(kind=c_int) :: PLASMA_Disable_c integer(kind=c_int), value :: param end function PLASMA_Disable_c end interface interface function PLASMA_Lapack_to_Tile_c(a_lpk,lda,a_pma) & & bind(c, name='PLASMA_Lapack_to_Tile') use iso_c_binding integer(kind=c_int) :: PLASMA_Lapack_to_Tile_c type(c_ptr), value :: a_lpk, a_pma integer(kind=c_int), value :: lda end function PLASMA_Lapack_to_Tile_c end interface interface function PLASMA_Tile_to_Lapack_c(a_pma,a_lpk,lda) & & bind(c, name='PLASMA_Tile_to_Lapack') use iso_c_binding integer(kind=c_int) :: PLASMA_Tile_to_Lapack_c type(c_ptr), value :: a_lpk, a_pma integer(kind=c_int), value :: lda end function PLASMA_Tile_to_Lapack_c end interface interface function PLASMA_Desc_Create_c(desc, mat, dtyp, mb, nb, bsiz, lm, ln, i, j, m, n) & & bind(c, name='PLASMA_Desc_Create') use iso_c_binding integer(kind=c_int) :: PLASMA_Desc_Create_c type(c_ptr) :: desc type(c_ptr), value :: mat integer(kind=c_int), value :: dtyp integer(kind=c_int), value :: mb, nb, bsiz, lm, ln, i, j, m, n end function PLASMA_Desc_Create_c end interface interface function PLASMA_Desc_Destroy_c(desc) & & bind(c, name='PLASMA_Desc_Destroy') use iso_c_binding integer(kind=c_int) :: PLASMA_Desc_Destroy_c type(c_ptr) :: desc end function PLASMA_Desc_Destroy_c end interface interface subroutine free_c(ptr) bind(c, name='free') use iso_c_binding implicit none type(c_ptr), value :: ptr end subroutine free_c end interface interface function PLASMA_Version_c(maj,min,mic) & & bind(c, name='PLASMA_Version') use iso_c_binding integer(kind=c_int) :: PLASMA_Version_c type(c_ptr), value :: maj,min,mic end function PLASMA_Version_c end interface interface function PLASMA_Init_Affinity_c(cores,bindtab) & & bind(c, name='PLASMA_Init_Affinity') use iso_c_binding integer(kind=c_int) :: PLASMA_Init_Affinity_c integer(kind=c_int), value :: cores type(c_ptr), value :: bindtab end function PLASMA_Init_Affinity_c end interface interface function PLASMA_Dealloc_Handle_c(handle) & & bind(c, name='PLASMA_Dealloc_Handle') use iso_c_binding integer(kind=c_int) :: PLASMA_Dealloc_Handle_c type(c_ptr) :: handle end function PLASMA_Dealloc_Handle_c end interface interface function PLASMA_Dealloc_Handle_Tile_c(desc) & & bind(c, name='PLASMA_Dealloc_Handle_Tile') use iso_c_binding integer(kind=c_int) :: PLASMA_Dealloc_Handle_Tile_c type(c_ptr) :: desc end function PLASMA_Dealloc_Handle_Tile_c end interface interface function PLASMA_Sequence_Create_c(seq) & & bind(c, name='PLASMA_Sequence_Create') use iso_c_binding integer(kind=c_int) :: PLASMA_Sequence_Create_c type(c_ptr) :: seq end function PLASMA_Sequence_Create_c end interface interface function PLASMA_Sequence_Destroy_c(seq) & & bind(c, name='PLASMA_Sequence_Destroy') use iso_c_binding integer(kind=c_int) :: PLASMA_Sequence_Destroy_c type(c_ptr), value :: seq end function PLASMA_Sequence_Destroy_c end interface interface function PLASMA_Sequence_Wait_c(seq) & & bind(c, name='PLASMA_Sequence_Wait') use iso_c_binding integer(kind=c_int) :: PLASMA_Sequence_Wait_c type(c_ptr), value :: seq end function PLASMA_Sequence_Wait_c end interface interface function PLASMA_Sequence_Flush_c(seq,req) & & bind(c, name='PLASMA_Sequence_Flush') use iso_c_binding integer(kind=c_int) :: PLASMA_Sequence_Flush_c type(c_ptr), value :: seq type(c_ptr), value :: req end function PLASMA_Sequence_Flush_c end interface interface plasma_lapack_to_tile module procedure plasma_lapack_to_tile_s module procedure plasma_lapack_to_tile_d module procedure plasma_lapack_to_tile_cpx module procedure plasma_lapack_to_tile_z end interface plasma_lapack_to_tile interface plasma_tile_to_lapack module procedure plasma_tile_to_lapack_s module procedure plasma_tile_to_lapack_d module procedure plasma_tile_to_lapack_cpx module procedure plasma_tile_to_lapack_z end interface plasma_tile_to_lapack interface plasma_desc_create module procedure plasma_desc_create_s module procedure plasma_desc_create_d module procedure plasma_desc_create_cpx module procedure plasma_desc_create_z end interface plasma_desc_create contains subroutine plasma_init(ncores,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: ncores integer(kind=c_int), intent(out) :: info info = plasma_init_c(ncores) plasma_initialized = .true. end subroutine plasma_init subroutine plasma_finalize(info) use iso_c_binding implicit none integer(kind=c_int), intent(out) :: info info = plasma_finalize_c() plasma_initialized = .false. end subroutine plasma_finalize subroutine plasma_set(param,pval,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: param integer(kind=c_int), intent(in) :: pval integer(kind=c_int), intent(out) :: info info = plasma_set_c(param,pval) end subroutine plasma_set subroutine plasma_get(param,pval,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: param integer(kind=c_int), intent(out), target :: pval integer(kind=c_int), intent(out) :: info info = plasma_get_c(param,c_loc(pval)) end subroutine plasma_get subroutine plasma_enable(param,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: param integer(kind=c_int), intent(out) :: info info = plasma_enable_c(param) end subroutine plasma_enable subroutine plasma_disable(param,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: param integer(kind=c_int), intent(out) :: info info = plasma_disable_c(param) end subroutine plasma_disable ! overloaded: single precision subroutine plasma_lapack_to_tile_s(a_lpk,lda,a_pma,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: lda real(kind=sp), intent(out), target :: a_lpk(lda,*) type(c_ptr), intent(out) :: a_pma integer(kind=c_int), intent(out) :: info info = plasma_lapack_to_tile_c(c_loc(a_lpk),lda,a_pma) end subroutine plasma_lapack_to_tile_s ! overloaded: double precision subroutine plasma_lapack_to_tile_d(a_lpk,lda,a_pma,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: lda real(kind=dp), intent(out), target :: a_lpk(lda,*) type(c_ptr), intent(out) :: a_pma integer(kind=c_int), intent(out) :: info info = plasma_lapack_to_tile_c(c_loc(a_lpk),lda,a_pma) end subroutine plasma_lapack_to_tile_d ! overloaded: single precision complex subroutine plasma_lapack_to_tile_cpx(a_lpk,lda,a_pma,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: lda complex(kind=sp), intent(out), target :: a_lpk(lda,*) type(c_ptr), intent(out) :: a_pma integer(kind=c_int), intent(out) :: info info = plasma_lapack_to_tile_c(c_loc(a_lpk),lda,a_pma) end subroutine plasma_lapack_to_tile_cpx ! overloaded: double precision complex subroutine plasma_lapack_to_tile_z(a_lpk,lda,a_pma,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: lda complex(kind=dp), intent(out), target :: a_lpk(lda,*) type(c_ptr), intent(out) :: a_pma integer(kind=c_int), intent(out) :: info info = plasma_lapack_to_tile_c(c_loc(a_lpk),lda,a_pma) end subroutine plasma_lapack_to_tile_z ! overloaded: single precision subroutine plasma_tile_to_lapack_s(a_pma,a_lpk,lda,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: lda real(kind=sp), intent(out), target :: a_lpk(lda,*) type(c_ptr), intent(in) :: a_pma integer(kind=c_int), intent(out) :: info info = plasma_tile_to_lapack_c(a_pma,c_loc(a_lpk),lda) end subroutine plasma_tile_to_lapack_s ! overloaded: double precision subroutine plasma_tile_to_lapack_d(a_pma,a_lpk,lda,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: lda real(kind=dp), intent(out), target :: a_lpk(lda,*) type(c_ptr), intent(in) :: a_pma integer(kind=c_int), intent(out) :: info info = plasma_tile_to_lapack_c(a_pma,c_loc(a_lpk),lda) end subroutine plasma_tile_to_lapack_d ! overloaded: single precision complex subroutine plasma_tile_to_lapack_cpx(a_pma,a_lpk,lda,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: lda complex(kind=sp), intent(out), target :: a_lpk(lda,*) type(c_ptr), intent(in) :: a_pma integer(kind=c_int), intent(out) :: info info = plasma_tile_to_lapack_c(a_pma,c_loc(a_lpk),lda) end subroutine plasma_tile_to_lapack_cpx ! overloaded: double precision complex subroutine plasma_tile_to_lapack_z(a_pma,a_lpk,lda,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: lda complex(kind=dp), intent(out), target :: a_lpk(lda,*) type(c_ptr), intent(in) :: a_pma integer(kind=c_int), intent(out) :: info info = plasma_tile_to_lapack_c(a_pma,c_loc(a_lpk),lda) end subroutine plasma_tile_to_lapack_z ! overloaded: single precision subroutine plasma_desc_create_s(desc,mat,dtyp,mb,nb,bsiz,lm,ln,i,j,m,n,info) use iso_c_binding implicit none type(c_ptr), intent(out) :: desc integer(kind=c_int), intent(in) :: mb, nb, bsiz, lm, ln, i, j, m, n real(kind=sp), intent(in), target :: mat(lm,*) integer(kind=c_int), intent(in) :: dtyp integer(kind=c_int), intent(out) :: info info = plasma_desc_create_c(desc,c_loc(mat),dtyp,mb,nb,bsiz,lm,ln,i,j,m,n) end subroutine plasma_desc_create_s ! overloaded: double precision subroutine plasma_desc_create_d(desc,mat,dtyp,mb,nb,bsiz,lm,ln,i,j,m,n,info) use iso_c_binding implicit none type(c_ptr), intent(out) :: desc integer(kind=c_int), intent(in) :: mb, nb, bsiz, lm, ln, i, j, m, n real(kind=dp), intent(in), target :: mat(lm,*) integer(kind=c_int), intent(in) :: dtyp integer(kind=c_int), intent(out) :: info info = plasma_desc_create_c(desc,c_loc(mat),dtyp,mb,nb,bsiz,lm,ln,i,j,m,n) end subroutine plasma_desc_create_d ! overloaded: single precision complex subroutine plasma_desc_create_cpx(desc,mat,dtyp,mb,nb,bsiz,lm,ln,i,j,m,n,info) use iso_c_binding implicit none type(c_ptr), intent(out) :: desc integer(kind=c_int), intent(in) :: mb, nb, bsiz, lm, ln, i, j, m, n complex(kind=sp), intent(in), target :: mat(lm,*) integer(kind=c_int), intent(in) :: dtyp integer(kind=c_int), intent(out) :: info info = plasma_desc_create_c(desc,c_loc(mat),dtyp,mb,nb,bsiz,lm,ln,i,j,m,n) end subroutine plasma_desc_create_cpx ! overloaded: double precision complex subroutine plasma_desc_create_z(desc,mat,dtyp,mb,nb,bsiz,lm,ln,i,j,m,n,info) use iso_c_binding implicit none type(c_ptr), intent(out) :: desc integer(kind=c_int), intent(in) :: mb, nb, bsiz, lm, ln, i, j, m, n complex(kind=dp), intent(in), target :: mat(lm,*) integer(kind=c_int), intent(in) :: dtyp integer(kind=c_int), intent(out) :: info info = plasma_desc_create_c(desc,c_loc(mat),dtyp,mb,nb,bsiz,lm,ln,i,j,m,n) end subroutine plasma_desc_create_z subroutine plasma_desc_destroy(desc,info) use iso_c_binding implicit none type(c_ptr), intent(inout) :: desc integer(kind=c_int), intent(out) :: info info = plasma_desc_destroy_c(desc) end subroutine plasma_desc_destroy subroutine plasma_free(ptr) use iso_c_binding implicit none type(c_ptr), intent(in) :: ptr call free_c(ptr) end subroutine plasma_free subroutine plasma_version(ver_major,ver_minor,ver_micro,info) use iso_c_binding implicit none integer(kind=c_int), intent(out), target :: ver_major,ver_minor,ver_micro integer(kind=c_int), intent(out) :: info info = plasma_version_c(c_loc(ver_major),c_loc(ver_minor),c_loc(ver_micro)) end subroutine plasma_version subroutine plasma_init_affinity(cores,bindtab,info) use iso_c_binding implicit none integer(kind=c_int), intent(in) :: cores integer(kind=c_int), intent(out), target :: bindtab integer(kind=c_int), intent(out) :: info info = plasma_init_affinity_c(cores,c_loc(bindtab)) end subroutine plasma_init_affinity subroutine plasma_dealloc_handle(handle,info) use iso_c_binding implicit none type(c_ptr), intent(inout) :: handle integer(kind=c_int), intent(out) :: info info = plasma_dealloc_handle_c(handle) end subroutine plasma_dealloc_handle subroutine plasma_dealloc_handle_tile(desc,info) use iso_c_binding implicit none type(c_ptr), intent(inout) :: desc integer(kind=c_int), intent(out) :: info info = plasma_dealloc_handle_tile_c(desc) end subroutine plasma_dealloc_handle_tile subroutine plasma_sequence_create(sequence,info) use iso_c_binding implicit none type(c_ptr), intent(out) :: sequence integer(kind=c_int), intent(out) :: info info = plasma_sequence_create_c(sequence) end subroutine plasma_sequence_create subroutine plasma_sequence_destroy(sequence,info) use iso_c_binding implicit none type(c_ptr), intent(in) :: sequence integer(kind=c_int), intent(out) :: info info = plasma_sequence_destroy_c(sequence) end subroutine plasma_sequence_destroy subroutine plasma_sequence_wait(sequence,info) use iso_c_binding implicit none type(c_ptr), intent(in) :: sequence integer(kind=c_int), intent(out) :: info info = plasma_sequence_wait_c(sequence) end subroutine plasma_sequence_wait subroutine plasma_sequence_flush(sequence,request,info) use iso_c_binding implicit none type(c_ptr), intent(in) :: sequence, request integer(kind=c_int), intent(out) :: info info = plasma_sequence_flush_c(sequence,request) end subroutine plasma_sequence_flush end module plasma
{"hexsha": "498593b19933250f0d2660337d73deb4d35f6e2b", "size": 19427, "ext": "f90", "lang": "FORTRAN", "max_stars_repo_path": "control/plasma_f90.f90", "max_stars_repo_name": "zhuangsc/Plasma-ompss1", "max_stars_repo_head_hexsha": "bcc99c164a256bc7df7c936b9c43afd38c12aea2", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "control/plasma_f90.f90", "max_issues_repo_name": "zhuangsc/Plasma-ompss1", "max_issues_repo_head_hexsha": "bcc99c164a256bc7df7c936b9c43afd38c12aea2", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "control/plasma_f90.f90", "max_forks_repo_name": "zhuangsc/Plasma-ompss1", "max_forks_repo_head_hexsha": "bcc99c164a256bc7df7c936b9c43afd38c12aea2", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.2879078695, "max_line_length": 91, "alphanum_fraction": 0.6649508416, "num_tokens": 4921}
[STATEMENT] lemma O'_O: assumes "Orig.validFrom s tr" and "Orig.reach s" shows "Prime.O (translateTrace tr) = translateO (Orig.O tr)" [PROOF STATE] proof (prove) goal (1 subgoal): 1. O (translateTrace tr) = translateO (Orig.O tr) [PROOF STEP] using assms [PROOF STATE] proof (prove) using this: Orig.validFrom s tr Orig.reach s goal (1 subgoal): 1. O (translateTrace tr) = translateO (Orig.O tr) [PROOF STEP] unfolding translateTrace_def translateO_def [PROOF STATE] proof (prove) using this: Orig.validFrom s tr Orig.reach s goal (1 subgoal): 1. O (map translateTrans tr) = these (map translateObs (Orig.O tr)) [PROOF STEP] proof (induction tr arbitrary: s) [PROOF STATE] proof (state) goal (2 subgoals): 1. \<And>s. \<lbrakk>Orig.validFrom s []; Orig.reach s\<rbrakk> \<Longrightarrow> O (map translateTrans []) = these (map translateObs (Orig.O [])) 2. \<And>a tr s. \<lbrakk>\<And>s. \<lbrakk>Orig.validFrom s tr; Orig.reach s\<rbrakk> \<Longrightarrow> O (map translateTrans tr) = these (map translateObs (Orig.O tr)); Orig.validFrom s (a # tr); Orig.reach s\<rbrakk> \<Longrightarrow> O (map translateTrans (a # tr)) = these (map translateObs (Orig.O (a # tr))) [PROOF STEP] case (Cons trn tr s) [PROOF STATE] proof (state) this: \<lbrakk>Orig.validFrom ?s tr; Orig.reach ?s\<rbrakk> \<Longrightarrow> O (map translateTrans tr) = these (map translateObs (Orig.O tr)) Orig.validFrom s (trn # tr) Orig.reach s goal (2 subgoals): 1. \<And>s. \<lbrakk>Orig.validFrom s []; Orig.reach s\<rbrakk> \<Longrightarrow> O (map translateTrans []) = these (map translateObs (Orig.O [])) 2. \<And>a tr s. \<lbrakk>\<And>s. \<lbrakk>Orig.validFrom s tr; Orig.reach s\<rbrakk> \<Longrightarrow> O (map translateTrans tr) = these (map translateObs (Orig.O tr)); Orig.validFrom s (a # tr); Orig.reach s\<rbrakk> \<Longrightarrow> O (map translateTrans (a # tr)) = these (map translateObs (Orig.O (a # tr))) [PROOF STEP] then [PROOF STATE] proof (chain) picking this: \<lbrakk>Orig.validFrom ?s tr; Orig.reach ?s\<rbrakk> \<Longrightarrow> O (map translateTrans tr) = these (map translateObs (Orig.O tr)) Orig.validFrom s (trn # tr) Orig.reach s [PROOF STEP] have "validTrans trn" "srcOf trn = s" "Orig.validFrom (tgtOf trn) tr" "Orig.reach (tgtOf trn)" [PROOF STATE] proof (prove) using this: \<lbrakk>Orig.validFrom ?s tr; Orig.reach ?s\<rbrakk> \<Longrightarrow> O (map translateTrans tr) = these (map translateObs (Orig.O tr)) Orig.validFrom s (trn # tr) Orig.reach s goal (1 subgoal): 1. (validTrans trn &&& srcOf trn = s) &&& Orig.validFrom (tgtOf trn) tr &&& Orig.reach (tgtOf trn) [PROOF STEP] unfolding Orig.validFrom_Cons [PROOF STATE] proof (prove) using this: \<lbrakk>Orig.validFrom ?s tr; Orig.reach ?s\<rbrakk> \<Longrightarrow> O (map translateTrans tr) = these (map translateObs (Orig.O tr)) validTrans trn \<and> srcOf trn = s \<and> Orig.validFrom (tgtOf trn) tr Orig.reach s goal (1 subgoal): 1. (validTrans trn &&& srcOf trn = s) &&& Orig.validFrom (tgtOf trn) tr &&& Orig.reach (tgtOf trn) [PROOF STEP] by (auto intro: Orig.reach.Step[of s trn "tgtOf trn"]) [PROOF STATE] proof (state) this: validTrans trn srcOf trn = s Orig.validFrom (tgtOf trn) tr Orig.reach (tgtOf trn) goal (2 subgoals): 1. \<And>s. \<lbrakk>Orig.validFrom s []; Orig.reach s\<rbrakk> \<Longrightarrow> O (map translateTrans []) = these (map translateObs (Orig.O [])) 2. \<And>a tr s. \<lbrakk>\<And>s. \<lbrakk>Orig.validFrom s tr; Orig.reach s\<rbrakk> \<Longrightarrow> O (map translateTrans tr) = these (map translateObs (Orig.O tr)); Orig.validFrom s (a # tr); Orig.reach s\<rbrakk> \<Longrightarrow> O (map translateTrans (a # tr)) = these (map translateObs (Orig.O (a # tr))) [PROOF STEP] then [PROOF STATE] proof (chain) picking this: validTrans trn srcOf trn = s Orig.validFrom (tgtOf trn) tr Orig.reach (tgtOf trn) [PROOF STEP] show ?case [PROOF STATE] proof (prove) using this: validTrans trn srcOf trn = s Orig.validFrom (tgtOf trn) tr Orig.reach (tgtOf trn) goal (1 subgoal): 1. O (map translateTrans (trn # tr)) = these (map translateObs (Orig.O (trn # tr))) [PROOF STEP] using \<gamma>'_\<gamma>[of trn] \<gamma>_\<gamma>'[of trn] Cons(3) Cons.IH [PROOF STATE] proof (prove) using this: validTrans trn srcOf trn = s Orig.validFrom (tgtOf trn) tr Orig.reach (tgtOf trn) \<lbrakk>validTrans trn; Orig.reach (srcOf trn); \<gamma>' (translateTrans trn)\<rbrakk> \<Longrightarrow> \<gamma> trn \<and> translateObs (g trn) = Some (g' (translateTrans trn)) \<lbrakk>validTrans trn; Orig.reach (srcOf trn); \<gamma> trn\<rbrakk> \<Longrightarrow> \<gamma>' (translateTrans trn) \<or> translateObs (g trn) = None Orig.reach s \<lbrakk>Orig.validFrom ?s tr; Orig.reach ?s\<rbrakk> \<Longrightarrow> O (map translateTrans tr) = these (map translateObs (Orig.O tr)) goal (1 subgoal): 1. O (map translateTrans (trn # tr)) = these (map translateObs (Orig.O (trn # tr))) [PROOF STEP] by (cases "\<gamma> trn"; cases "\<gamma>' (translateTrans trn)") auto [PROOF STATE] proof (state) this: O (map translateTrans (trn # tr)) = these (map translateObs (Orig.O (trn # tr))) goal (1 subgoal): 1. \<And>s. \<lbrakk>Orig.validFrom s []; Orig.reach s\<rbrakk> \<Longrightarrow> O (map translateTrans []) = these (map translateObs (Orig.O [])) [PROOF STEP] qed auto
{"llama_tokens": 2115, "file": "BD_Security_Compositional_Transporting_Security", "length": 13}
#! /usr/bin/env python import os import logging import re import pathlib from datetime import date, datetime from collections import namedtuple import time as timer import scipy.io as spio import numpy as np import pandas as pd import decimal import warnings import datajoint as dj from pybpodgui_api.models.project import Project as BPodProject from . import util, InvalidBehaviorTrialError from pipeline import lab, experiment from pipeline import get_schema_name, dict_to_hash schema = dj.schema(get_schema_name('ingest_behavior')) warnings.simplefilter(action='ignore', category=FutureWarning) log = logging.getLogger(__name__) # ================ PHOTOSTIM PROTOCOL =============== photostim_duration = 0.5 # (s) skull_ref = 'Bregma' photostims = { 4: {'photo_stim': 4, 'photostim_device': 'OBIS470', 'duration': photostim_duration, 'locations': [{'skull_reference': skull_ref, 'brain_area': 'ALM', 'ap_location': 2500, 'ml_location': -1500, 'depth': 0, 'theta': 15, 'phi': 15}]}, 5: {'photo_stim': 5, 'photostim_device': 'OBIS470', 'duration': photostim_duration, 'locations': [{'skull_reference': skull_ref, 'brain_area': 'ALM', 'ap_location': 2500, 'ml_location': 1500, 'depth': 0, 'theta': 15, 'phi': 15}]}, 6: {'photo_stim': 6, 'photostim_device': 'OBIS470', 'duration': photostim_duration, 'locations': [{'skull_reference': skull_ref, 'brain_area': 'ALM', 'ap_location': 2500, 'ml_location': -1500, 'depth': 0, 'theta': 15, 'phi': 15}, {'skull_reference': skull_ref, 'brain_area': 'ALM', 'ap_location': 2500, 'ml_location': 1500, 'depth': 0, 'theta': 15, 'phi': 15} ]}} def get_behavior_paths(): ''' retrieve behavior rig paths from dj.config config should be in dj.config of the format: dj.config = { ..., 'custom': { 'behavior_data_paths': [ ["RRig", "/path/string", 0], ["RRig2", "/path2/string2", 1] ], } ... } where 'behavior_data_paths' is a list of multiple possible path for behavior data, each in format: [rig name, rig full path, search order] ''' paths = dj.config.get('custom', {}).get('behavior_data_paths', None) if paths is None: raise ValueError("Missing 'behavior_data_paths' in dj.config['custom']") return sorted(paths, key=lambda x: x[-1]) def get_session_user(): ''' Determine desired 'session user' for a session. - 1st, try dj.config['custom']['session.user'] - 2nd, try dj.config['database.user'] - else, use 'unknown' TODO: multi-user / bulk ingest support ''' session_user = dj.config.get('custom', {}).get('session.user', None) session_user = (dj.config.get('database.user') if not session_user else session_user) if len(lab.Person() & {'username': session_user}): return session_user else: return 'unknown' @schema class BehaviorIngest(dj.Imported): definition = """ -> experiment.Session """ class BehaviorFile(dj.Part): ''' files in rig-specific storage ''' definition = """ -> master behavior_file: varchar(255) # behavior file name """ class CorrectedTrialEvents(dj.Part): ''' TrialEvents containing auto-corrected data ''' definition = """ -> BehaviorIngest -> experiment.TrialEvent """ @property def key_source(self): # 2 letters, anything, _, anything, 8 digits, _, 6 digits, .mat # where: # (2 letters, anything): water restriction # (anything): task name # (8 digits): date YYYYMMDD # (6 digits): time HHMMSS rexp = '^[a-zA-Z]{2}.*_.*_[0-9]{8}_[0-9]{6}.mat$' # water_restriction_number -> subject h2os = {k: v for k, v in zip(*lab.WaterRestriction().fetch( 'water_restriction_number', 'subject_id'))} def buildrec(rig, rigpath, root, f): if not re.match(rexp, f): log.debug("{f} skipped - didn't match rexp".format(f=f)) return log.debug('found file {f}'.format(f=f)) fullpath = pathlib.Path(root, f) subpath = fullpath.relative_to(rigpath) fsplit = subpath.stem.split('_') h2o = fsplit[0] ymd = fsplit[-2:-1][0] if h2o not in h2os: log.warning('{f} skipped - no animal for {h2o}'.format( f=f, h2o=h2o)) return animal = h2os[h2o] log.debug('animal is {animal}'.format(animal=animal)) return { 'subject_id': animal, 'session_date': date( int(ymd[0:4]), int(ymd[4:6]), int(ymd[6:8])), 'rig': rig, 'rig_data_path': rigpath.as_posix(), 'subpath': subpath.as_posix() } recs = [] found = set() known = set(BehaviorIngest.BehaviorFile().fetch('behavior_file')) rigs = get_behavior_paths() for (rig, rigpath, _) in rigs: rigpath = pathlib.Path(rigpath) log.info('RigDataFile.make(): traversing {}'.format(rigpath)) for root, dirs, files in os.walk(rigpath): log.debug('RigDataFile.make(): entering {}'.format(root)) for f in files: log.debug('RigDataFile.make(): visiting {}'.format(f)) r = buildrec(rig, rigpath, root, f) if not r: continue if f in set.union(known, found): log.info('skipping already ingested file {}'.format( r['subpath'])) else: found.add(f) # block duplicate path conf recs.append(r) return recs def populate(self, *args, **kwargs): # 'populate' which won't require upstream tables # 'reserve_jobs' not parallel, overloaded to mean "don't exit on error" for k in self.key_source: try: with dj.conn().transaction: self.make(k) except Exception as e: log.warning('session key {} error: {}'.format(k, repr(e))) if not kwargs.get('reserve_jobs', False): raise def make(self, key): log.info('BehaviorIngest.make(): key: {key}'.format(key=key)) # File paths conform to the pattern: # dl7/TW_autoTrain/Session Data/dl7_TW_autoTrain_20180104_132813.mat # which is, more generally: # {h2o}/{training_protocol}/Session Data/{h2o}_{training protocol}_{YYYYMMDD}_{HHMMSS}.mat path = pathlib.Path(key['rig_data_path'], key['subpath']) # distinguishing "delay-response" task or "multi-target-licking" task task_type = detect_task_type(path) # skip too small behavior file (only for 'delay-response' task) if task_type == 'delay-response' and os.stat(path).st_size / 1024 < 1000: log.info('skipping file {} - too small'.format(path)) return log.debug('loading file {}'.format(path)) # Read from behavior file and parse all trial info (the heavy lifting here) skey, rows = BehaviorIngest._load(key, path, task_type) # Session Insertion log.info('BehaviorIngest.make(): adding session record') experiment.Session.insert1(skey) # Behavior Insertion log.info('BehaviorIngest.make(): bulk insert phase') log.info('BehaviorIngest.make(): saving ingest {d}'.format(d=skey)) self.insert1(skey, ignore_extra_fields=True, allow_direct_insert=True) log.info('BehaviorIngest.make(): ... experiment.Session.Trial') experiment.SessionTrial.insert( rows['trial'], ignore_extra_fields=True, allow_direct_insert=True) log.info('BehaviorIngest.make(): ... experiment.BehaviorTrial') experiment.BehaviorTrial.insert( rows['behavior_trial'], ignore_extra_fields=True, allow_direct_insert=True) log.info('BehaviorIngest.make(): ... experiment.TrialNote') experiment.TrialNote.insert( rows['trial_note'], ignore_extra_fields=True, allow_direct_insert=True) log.info('BehaviorIngest.make(): ... experiment.TrialEvent') experiment.TrialEvent.insert( rows['trial_event'], ignore_extra_fields=True, allow_direct_insert=True, skip_duplicates=True) log.info('BehaviorIngest.make(): ... experiment.ActionEvent') experiment.ActionEvent.insert( rows['action_event'], ignore_extra_fields=True, allow_direct_insert=True) # Photostim Insertion photostim_ids = np.unique( [r['photo_stim'] for r in rows['photostim_trial_event']]) unknown_photostims = np.setdiff1d( photostim_ids, list(photostims.keys())) if unknown_photostims: raise ValueError( 'Unknown photostim protocol: {}'.format(unknown_photostims)) if photostim_ids.size > 0: log.info('BehaviorIngest.make(): ... experiment.Photostim') for stim in photostim_ids: experiment.Photostim.insert1( dict(skey, **photostims[stim]), ignore_extra_fields=True) experiment.Photostim.PhotostimLocation.insert( (dict(skey, **loc, photo_stim=photostims[stim]['photo_stim']) for loc in photostims[stim]['locations']), ignore_extra_fields=True) log.info('BehaviorIngest.make(): ... experiment.PhotostimTrial') experiment.PhotostimTrial.insert(rows['photostim_trial'], ignore_extra_fields=True, allow_direct_insert=True) log.info('BehaviorIngest.make(): ... experiment.PhotostimTrialEvent') experiment.PhotostimEvent.insert(rows['photostim_trial_event'], ignore_extra_fields=True, allow_direct_insert=True) if task_type == 'multi-target-licking': # Multi-target-licking specifics log.info('BehaviorIngest.make(): ... experiment.MultiTargetLickingSessionBlock') experiment.MultiTargetLickingSessionBlock.insert( rows['session_block'], ignore_extra_fields=True, allow_direct_insert=True) log.info('BehaviorIngest.make(): ... experiment.MultiTargetLickingSessionBlock.WaterPort') experiment.MultiTargetLickingSessionBlock.WaterPort.insert( rows['session_block_waterport'], ignore_extra_fields=True, allow_direct_insert=True) log.info('BehaviorIngest.make(): ... experiment.MultiTargetLickingSessionBlock.BlockTrial') experiment.MultiTargetLickingSessionBlock.BlockTrial.insert( rows['session_block_trial'], ignore_extra_fields=True, allow_direct_insert=True) # Behavior Ingest Insertion log.info('BehaviorIngest.make(): ... BehaviorIngest.BehaviorFile') BehaviorIngest.BehaviorFile.insert1( dict(skey, behavior_file=os.path.basename(key['subpath'])), ignore_extra_fields=True, allow_direct_insert=True) @classmethod def _load(cls, key, path, task_type): """ Method to load the behavior file (.mat), parse trial info and prepare for insertion (no table insertion is done here) :param key: session_key :param path: (str) filepath of the behavior file (.mat) :param task_type: (str) "delay-response" or "multi-target-licking" :return: skey, rows + skey: session_key + rows: a dictionary containing all per-trial information to be inserted """ path = pathlib.Path(path) h2o = (lab.WaterRestriction() & {'subject_id': key['subject_id']}).fetch1( 'water_restriction_number') ymd = key['session_date'] datestr = ymd.strftime('%Y%m%d') log.info('h2o: {h2o}, date: {d}'.format(h2o=h2o, d=datestr)) # session key skey = {} skey['subject_id'] = key['subject_id'] skey['session_date'] = ymd skey['username'] = get_session_user() skey['rig'] = key['rig'] skey['h2o'] = h2o # synthesizing session ID log.debug('synthesizing session ID') session = (dj.U().aggr(experiment.Session() & {'subject_id': skey['subject_id']}, n='max(session)').fetch1('n') or 0) + 1 log.info('generated session id: {session}'.format(session=session)) skey['session'] = session if task_type == 'multi-target-licking': rows = load_multi_target_licking_matfile(skey, path) elif task_type == 'delay-response': rows = load_delay_response_matfile(skey, path) else: raise ValueError('Unknown task-type: {}'.format(task_type)) return skey, rows @schema class BehaviorBpodIngest(dj.Imported): definition = """ -> experiment.Session """ class BehaviorFile(dj.Part): ''' files in rig-specific storage ''' definition = """ -> master behavior_file: varchar(255) # behavior file name """ water_port_name_mapper = {'left': 'L', 'right': 'R', 'middle': 'M'} @staticmethod def get_bpod_projects(): projectdirs = dj.config.get('custom', {}).get('behavior_bpod', []).get('project_paths') # construct a list of BPod Projects projects = [] for projectdir in projectdirs: projects.append(BPodProject()) projects[-1].load(projectdir) return projects @property def key_source(self): key_source = [] IDs = {k: v for k, v in zip(*lab.WaterRestriction().fetch( 'water_restriction_number', 'subject_id'))} for subject_now, subject_id_now in IDs.items(): meta_dir = dj.config.get('custom', {}).get('behavior_bpod', []).get('meta_dir') subject_csv = pathlib.Path(meta_dir) / '{}.csv'.format(subject_now) if subject_csv.exists(): df_wr = pd.read_csv(subject_csv) else: log.info('No metadata csv found for {}'.format(subject_now)) continue for r_idx, df_wr_row in df_wr.iterrows(): # we use it when both start and end times are filled in and Water during training > 0; restriction, freewater and handling is skipped if (df_wr_row['Time'] and isinstance(df_wr_row['Time'], str) and df_wr_row['Time-end'] and isinstance(df_wr_row['Time-end'], str) and df_wr_row['Training type'] != 'restriction' and df_wr_row['Training type'] != 'handling' and df_wr_row['Training type'] != 'freewater' and df_wr_row['Water during training'] > 0): try: date_now = datetime.strptime(df_wr_row.Date, '%Y-%m-%d').date() except: try: date_now = datetime.strptime(df_wr_row.Date, '%Y/%m/%d').date() except: log.info('Unable to parse session date: {}. Skipping...'.format( df_wr_row.Date)) continue if not (experiment.Session & {'subject_id': subject_id_now, 'session_date': date_now}): key_source.append({'subject_id': subject_id_now, 'session_date': date_now, 'session_comment': str(df_wr_row['Notes']), 'session_weight': df_wr_row['Weight'], 'session_water_earned': df_wr_row[ 'Water during training'], 'session_water_extra': df_wr_row['Extra water']}) return key_source def populate(self, *args, **kwargs): # Load project info (just once) self.projects = self.get_bpod_projects() # 'populate' which won't require upstream tables # 'reserve_jobs' not parallel, overloaded to mean "don't exit on error" for k in self.key_source: try: with dj.conn().transaction: self.make(k) except Exception as e: log.warning('session key {} error: {}'.format(k, repr(e))) if not kwargs.get('reserve_jobs', False): raise def make(self, key): log.info( '----------------------\nBehaviorBpodIngest.make(): key: {key}'.format(key=key)) subject_id_now = key['subject_id'] subject_now = (lab.WaterRestriction() & {'subject_id': subject_id_now}).fetch1( 'water_restriction_number') date_now_str = key['session_date'].strftime('%Y%m%d') log.info('h2o: {h2o}, date: {d}'.format(h2o=subject_now, d=date_now_str)) # ---- Ingest information for BPod projects ---- sessions_now, session_start_times_now, experimentnames_now = [], [], [] for proj in self.projects: # exps = proj.experiments for exp in exps: stps = exp.setups for stp in stps: for session in stp.sessions: if (session.subjects and session.subjects[0].find(subject_now) > -1 and session.name.startswith(date_now_str)): sessions_now.append(session) session_start_times_now.append(session.started) experimentnames_now.append(exp.name) bpodsess_order = np.argsort(session_start_times_now) # --- Handle missing BPod session --- if len(bpodsess_order) == 0: log.error('BPod session not found!') return # ---- Concatenate bpod sessions (and corresponding trials) into one datajoint session ---- tbls_2_insert = ('sess_trial', 'behavior_trial', 'trial_note', 'sess_block', 'sess_block_trial', 'trial_choice', 'trial_event', 'action_event', 'photostim', 'photostim_location', 'photostim_trial', 'photostim_trial_event', 'valve_setting', 'valve_open_dur', 'available_reward') # getting started concat_rows = {k: list() for k in tbls_2_insert} sess_key = None trial_num = 0 # trial numbering starts at 1 for s_idx, session_idx in enumerate(bpodsess_order): session = sessions_now[session_idx] experiment_name = experimentnames_now[session_idx] csvfilename = (pathlib.Path(session.path) / ( pathlib.Path(session.path).name + '.csv')) # ---- Special parsing for csv file ---- log.info('Load session file(s) ({}/{}): {}'.format(s_idx + 1, len(bpodsess_order), csvfilename)) df_behavior_session = util.load_and_parse_a_csv_file(csvfilename) # ---- Integrity check of the current bpodsess file --- # It must have at least one 'trial start' and 'trial end' trial_start_idxs = df_behavior_session[(df_behavior_session['TYPE'] == 'TRIAL') & ( df_behavior_session['MSG'] == 'New trial')].index if not len(trial_start_idxs): log.info('No "trial start" for {}. Skipping...'.format(csvfilename)) continue # Make sure 'start' exists, otherwise move on to try the next bpodsess file if exists trial_end_idxs = df_behavior_session[ (df_behavior_session['TYPE'] == 'TRANSITION') & ( df_behavior_session['MSG'] == 'End')].index if not len(trial_end_idxs): log.info('No "trial end" for {}. Skipping...'.format(csvfilename)) continue # Make sure 'end' exists, otherwise move on to try the next bpodsess file if exists # It must be a foraging session # extracting task protocol - hard-code implementation if 'foraging' in experiment_name.lower() or ( 'bari' in experiment_name.lower() and 'cohen' in experiment_name.lower()): if 'var:lickport_number' in df_behavior_session and \ df_behavior_session['var:lickport_number'][0] == 3: task = 'foraging 3lp' task_protocol = 101 lick_ports = ['left', 'right', 'middle'] else: task = 'foraging' task_protocol = 100 lick_ports = ['left', 'right'] else: log.info('ERROR: unhandled task name {}. Skipping...'.format(experiment_name)) continue # Make sure this is a foraging bpodsess, otherwise move on to try the next bpodsess file if exists # ---- New session - construct a session key (from the first bpodsess that passes the integrity check) ---- if sess_key is None: session_time = df_behavior_session['PC-TIME'][trial_start_idxs[0]] if session.setup_name.lower() in ['day1', 'tower-2', 'day2-7', 'day_1', 'real foraging']: setupname = 'Training-Tower-2' elif session.setup_name.lower() in ['tower-3', 'tower-3beh', ' tower-3', '+', 'tower 3']: setupname = 'Training-Tower-3' elif session.setup_name.lower() in ['tower-1']: setupname = 'Training-Tower-1' elif session.setup_name.lower() in ['ephys_han']: setupname = 'Ephys-Han' else: log.info('ERROR: unhandled setup name {} (from {}). Skipping...'.format( session.setup_name, session.path)) continue # Another integrity check here log.debug('synthesizing session ID') key['session'] = (dj.U().aggr(experiment.Session() & {'subject_id': subject_id_now}, n='max(session)').fetch1('n') or 0) + 1 sess_key = {**key, 'session_time': session_time.time(), 'username': df_behavior_session['experimenter'][0], 'rig': setupname} # ---- channel for water ports ---- water_port_channels = {} for lick_port in lick_ports: chn_varname = 'var:WaterPort_{}_ch_in'.format( self.water_port_name_mapper[lick_port]) if chn_varname not in df_behavior_session: log.error( 'Bpod CSV KeyError: {} - Available columns: {}'.format(chn_varname, df_behavior_session.columns)) return water_port_channels[lick_port] = df_behavior_session[chn_varname][0] # ---- Ingestion of trials ---- # extracting trial data session_start_time = datetime.combine(sess_key['session_date'], sess_key['session_time']) trial_start_idxs = df_behavior_session[(df_behavior_session['TYPE'] == 'TRIAL') & (df_behavior_session['MSG'] == 'New trial')].index trial_start_idxs -= 2 # To reflect the change that bitcode is moved before the "New trial" line trial_start_idxs = pd.Index([0]).append(trial_start_idxs[1:]) # so the random seed will be present trial_end_idxs = trial_start_idxs[1:].append(pd.Index([(max(df_behavior_session.index))])) # trial_end_idxs = df_behavior_session[(df_behavior_session['TYPE'] == 'END-TRIAL')].index prevtrialstarttime = np.nan blocknum_local_prev = np.nan # getting ready rows = {k: list() for k in tbls_2_insert} # lists of various records for batch-insert for trial_start_idx, trial_end_idx in zip(trial_start_idxs, trial_end_idxs): df_behavior_trial = df_behavior_session[trial_start_idx:trial_end_idx + 1] # Trials without GoCue are skipped if not len( df_behavior_trial[(df_behavior_trial['MSG'] == 'GoCue') & ( df_behavior_trial['TYPE'] == 'STATE')]): continue # ---- session trial ---- trial_num += 1 # increment trial number trial_uid = len(experiment.SessionTrial & {'subject_id': subject_id_now}) + trial_num # Fix trial_uid here # Note that the following trial_start/stop_time SHOULD NEVER BE USED in ephys related analysis # because they are PC-TIME, which is not accurate (4 ms average delay, sometimes up to several seconds!)! # In fact, from bpod.csv, we can only accurately retrieve (local) trial-wise, but not (global) session-wise, times # See comments below. trial_start_time = df_behavior_session['PC-TIME'][ trial_start_idx].to_pydatetime() - session_start_time trial_stop_time = df_behavior_session['PC-TIME'][ trial_end_idx].to_pydatetime() - session_start_time sess_trial_key = {**sess_key, 'trial': trial_num, 'trial_uid': trial_uid, 'start_time': trial_start_time.total_seconds(), 'stop_time': trial_stop_time.total_seconds()} rows['sess_trial'].append(sess_trial_key) # ---- session block ---- if 'Block_number' in df_behavior_session: if np.isnan(df_behavior_trial['Block_number'].to_list()[0]): blocknum_local = 0 if np.isnan( blocknum_local_prev) else blocknum_local_prev else: blocknum_local = int( df_behavior_trial['Block_number'].to_list()[0]) - 1 blocknum_local_prev = blocknum_local reward_probability = {} for lick_port in lick_ports: p_reward_varname = 'var:reward_probabilities_{}'.format( self.water_port_name_mapper[lick_port]) reward_probability[lick_port] = decimal.Decimal( df_behavior_session[p_reward_varname][0][blocknum_local]).quantize( decimal.Decimal( '.001')) # Note: Reward probabilities never changes during a **bpod** session # determine if this is a new block: compare reward probability with the previous block if rows['sess_block']: itsanewblock = dict_to_hash(reward_probability) != dict_to_hash( rows['sess_block'][-1]['reward_probability']) else: itsanewblock = True if itsanewblock: all_blocks = [b['block'] for b in rows['sess_block'] + concat_rows['sess_block']] block_num = (np.max(all_blocks) + 1 if all_blocks else 1) rows['sess_block'].append({**sess_key, 'block': block_num, 'block_start_time': trial_start_time.total_seconds(), 'reward_probability': reward_probability}) else: block_num = rows['sess_block'][-1]['block'] rows['sess_block_trial'].append({**sess_trial_key, 'block': block_num}) # ====== Event times ====== # Foraging trial structure: (*...*: events of interest in experiment.EventType; [...]: optional) # -> (ITI) -> *bitcodestart* -> bitcode -> lickport movement -> *delay* (lickport in position) # -> [effective delay period] -> *go* -> [*choice*] -> [*reward*] -> *trialend* -> (ITI) -> # Notes: # 1. Differs from the delay-task: # (1) no sample and presample epoch # (2) effective delay period could be zero (ITI as an inherent delay). # Also note that if the delay_period in bpod protocol < lickport movement time (~100 ms), the effective delay period is also zero, # where the go-cue sound actually appears BEFORE the lickport stops moving. # (3) we are interested in not only go-cue aligned PSTH (ephys.Unit.TrialSpikes), but need more flexible event alignments, especially ITI firings. # So we should use the session-wise untrialized spike times stored in ephys.Unit['spike_times']. See below. # 2. Two "trial start"s: # (1) *bitcodestart* = onset of the first bitcode = *sTrig* in NIDQ bitcode.mat # (2) `trial_start_idx` in this for loop = the start of bpod-trial ('New Trial' in bpod csv file) # = the reference point of BPOD-TIME = NIDQ bpod-trial channel # They are far from each other because I start the bpod trial at the middle of ITI (Foraging_bpod: e9a8ffd6) to cover video recording during ITI. # 3. In theory, *bitcodestart* = *delay* (since there's no sample period), # but in practice, the bitcode (21*20=420 ms) and lickport movement (~100 ms) also take some time. # Note that bpod doesn't know the exact time when lickports are in place, so we can get *delay* only from NIDQ zaber channel (ephys.TrialEvent.'zaberinposition'). # 4. In early lick trials, effective delay start should be the last 'DelayStart' (?) # 5. Finally, to perform session-wise alignment between behavior and ephys, there are two ways, which could be cross-checked with each other: # (1) (most straightforward) use all event markers directly from NIDQ bitcode.mat, # then align them to ephys.Unit['spike_times'] by looking at the *sTrig* of the first trial of a session # (2) (can be used as a sanity check) extract trial-wise BPOD-TIME from pybpod.csv, # and then convert the local trial-wise times to global session-wise times by aligning # the same events from pybpod.csv and bitcode.mat across all trials, e.g., *bitcodestart* <--> *sTrig*, or 0 <--> NIDQ bpod-"trial trigger" channel # Note that one should NEVER use PC-TIME from the bpod csv files (at least for ephys-related alignment)!!! # ----- BPOD STATES (all events except licks) ----- bpod_states_this_trial = df_behavior_trial[(df_behavior_trial['TYPE'] == 'STATE') & (df_behavior_trial['BPOD-INITIAL-TIME'] > 0)] # All states of this trial trial_event_count = 0 # Use BPOD-INITIAL-TIME and BPOD-FINAL-TIME (all relative to bpod-trialstart) bpod_states_of_interest = { # experiment.TrialEventType: Bpod state name 'videostart': ['ITIBeforeVideoOn'], 'bitcodestart': ['Start'], 'delay': ['DelayStart'], # (1) in a non early lick trial, effective delay start = max(DelayStart, LickportInPosition). # where LickportIntInPosition is only available from NIDQ # (2) in an early lick trial, there are multiple DelayStarts, the last of which is the effective delay start 'go': ['GoCue'], 'choice': [f'Choice_{lickport}' for lickport in self.water_port_name_mapper.values()], 'reward': [f'Reward_{lickport}' for lickport in self.water_port_name_mapper.values()], 'doubledip': ['Double_dipped'], # Only for non-double-dipped trials, ITI = last lick + 1 sec (maybe I should not use double dipping punishment for ehpys?) 'trialend': ['ITI'], 'videoend': ['ITIAfterVideoOff'], } for trial_event_type, bpod_state in bpod_states_of_interest.items(): _idx = bpod_states_this_trial.index[bpod_states_this_trial['MSG'].isin(bpod_state)] # One state could have multiple appearances, such as DelayStart in early-lick trials if not len(_idx): continue initials, finals = bpod_states_this_trial.loc[_idx][['BPOD-INITIAL-TIME', 'BPOD-FINAL-TIME']].values.T.astype(float) initials[initials > 9999] = 9999 # Wordaround for bug #9: BPod protocol was paused and then resumed after an impossible long period of time (> decimal(8, 4)). finals[finals > 9999] = 9999 # cache event times for idx, (initial, final) in enumerate(zip(initials, finals)): rows['trial_event'].extend( [{**sess_trial_key, 'trial_event_id': trial_event_count + idx, 'trial_event_type': trial_event_type, 'trial_event_time': initial, 'duration': final - initial}]) # list comprehension doesn't work here trial_event_count += len(initials) # save gocue time for early-lick below if trial_event_type == 'go': gocue_time = initials[0] # ------ Licks (use EVENT instead of STATE because not all licks triggered a state change) ------- lick_times = {} for lick_port in lick_ports: lick_times[lick_port] = df_behavior_trial['BPOD-INITIAL-TIME'][( df_behavior_trial['+INFO'] == water_port_channels[lick_port])].to_numpy() # cache licks all_lick_types = np.concatenate( [[ltype] * len(ltimes) for ltype, ltimes in lick_times.items()]) all_lick_times = np.concatenate( [ltimes for ltimes in lick_times.values()]) # sort by lick times sorted_licks = sorted(zip(all_lick_types, all_lick_times), key=lambda x: x[-1]) rows['action_event'].extend([{**sess_trial_key, 'action_event_id': idx, 'action_event_type': '{} lick'.format(ltype), 'action_event_time': ltime} for idx, (ltype, ltime) in enumerate(sorted_licks)]) # ====== Trial facts (nontemporal) ====== # WaterPort Choice trial_choice = {'water_port': None} for lick_port in lick_ports: if any((df_behavior_trial['MSG'] == 'Choice_{}'.format( self.water_port_name_mapper[lick_port])) & (df_behavior_trial['TYPE'] == 'TRANSITION')): trial_choice['water_port'] = lick_port break rows['trial_choice'].append({**sess_trial_key, **trial_choice}) # early lick early_lick = 'no early' if any(all_lick_times < gocue_time): early_lick = 'early' # outcome outcome = 'miss' if trial_choice['water_port'] else 'ignore' for lick_port in lick_ports: if any((df_behavior_trial['MSG'] == 'Reward_{}'.format( self.water_port_name_mapper[lick_port])) & (df_behavior_trial['TYPE'] == 'TRANSITION')): outcome = 'hit' break # ---- accumulated reward ---- for lick_port in lick_ports: reward_var_name = 'reward_{}_accumulated'.format( self.water_port_name_mapper[lick_port]) if reward_var_name not in df_behavior_trial: log.error('Bpod CSV KeyError: {} - Available columns: {}'.format( reward_var_name, df_behavior_trial.columns)) return reward = df_behavior_trial[reward_var_name].values[0] rows['available_reward'].append({ **sess_trial_key, 'water_port': lick_port, 'reward_available': False if np.isnan(reward) else reward}) # ---- auto water and notes ---- auto_water = False auto_water_times = {} for lick_port in lick_ports: auto_water_varname = 'Auto_Water_{}'.format( self.water_port_name_mapper[lick_port]) auto_water_ind = (df_behavior_trial['TYPE'] == 'STATE') & ( df_behavior_trial['MSG'] == auto_water_varname) if any(auto_water_ind): auto_water = True auto_water_times[lick_port] = float( df_behavior_trial['+INFO'][auto_water_ind.idxmax()]) if auto_water_times: auto_water_ports = [k for k, v in auto_water_times.items() if v > 0.001] rows['trial_note'].append({**sess_trial_key, 'trial_note_type': 'autowater', 'trial_note': 'and '.join(auto_water_ports)}) # add random seed start note if any(df_behavior_trial['MSG'] == 'Random seed:'): seedidx = (df_behavior_trial['MSG'] == 'Random seed:').idxmax() + 1 rows['trial_note'].append({**sess_trial_key, 'trial_note_type': 'random_seed_start', 'trial_note': str(df_behavior_trial['MSG'][seedidx])}) # add randomID (TrialBitCode) if any(df_behavior_trial['MSG'] == 'TrialBitCode: '): bitcode_ind = (df_behavior_trial['MSG'] == 'TrialBitCode: ').idxmax() + 1 rows['trial_note'].append({**sess_trial_key, 'trial_note_type': 'bitcode', 'trial_note': str(df_behavior_trial['MSG'][bitcode_ind])}) # ---- Behavior Trial ---- rows['behavior_trial'].append({**sess_trial_key, 'task': task, 'task_protocol': task_protocol, 'trial_instruction': 'none', 'early_lick': early_lick, 'outcome': outcome, 'auto_water': auto_water, 'free_water': False}) # TODO: verify this # ---- Water Valve Setting ---- valve_setting = {**sess_trial_key} if 'var_motor:LickPort_Lateral_pos' in df_behavior_trial.keys(): valve_setting['water_port_lateral_pos'] = \ df_behavior_trial['var_motor:LickPort_Lateral_pos'].values[0] if 'var_motor:LickPort_RostroCaudal_pos' in df_behavior_trial.keys(): valve_setting['water_port_rostrocaudal_pos'] = \ df_behavior_trial['var_motor:LickPort_RostroCaudal_pos'].values[0] if 'var_motor:LickPort_DorsoVentral_pos' in df_behavior_trial.keys(): valve_setting['water_port_dorsoventral_pos'] = \ df_behavior_trial['var_motor:LickPort_DorsoVentral_pos'].values[0] rows['valve_setting'].append(valve_setting) for lick_port in lick_ports: valve_open_varname = 'var:ValveOpenTime_{}'.format( self.water_port_name_mapper[lick_port]) if valve_open_varname in df_behavior_trial: rows['valve_open_dur'].append({ **sess_trial_key, 'water_port': lick_port, 'open_duration': df_behavior_trial[valve_open_varname].values[0]}) # add to the session-concat for tbl in tbls_2_insert: concat_rows[tbl].extend(rows[tbl]) # ---- The insertions to relevant tables ---- # Session, SessionComment, SessionDetails insert log.info('BehaviorIngest.make(): adding session record') experiment.Session.insert1(sess_key, ignore_extra_fields=True) experiment.SessionComment.insert1(sess_key, ignore_extra_fields=True) experiment.SessionDetails.insert1(sess_key, ignore_extra_fields=True) # Behavior Insertion insert_settings = {'ignore_extra_fields': True, 'allow_direct_insert': True} log.info('BehaviorIngest.make(): bulk insert phase') log.info('BehaviorIngest.make(): ... experiment.Session.Trial') experiment.SessionTrial.insert(concat_rows['sess_trial'], **insert_settings) log.info('BehaviorIngest.make(): ... experiment.BehaviorTrial') experiment.BehaviorTrial.insert(concat_rows['behavior_trial'], **insert_settings) log.info('BehaviorIngest.make(): ... experiment.WaterPortChoice') experiment.WaterPortChoice.insert(concat_rows['trial_choice'], **insert_settings) log.info('BehaviorIngest.make(): ... experiment.TrialNote') experiment.TrialNote.insert(concat_rows['trial_note'], **insert_settings) log.info('BehaviorIngest.make(): ... experiment.TrialEvent') experiment.TrialEvent.insert(concat_rows['trial_event'], **insert_settings) log.info('BehaviorIngest.make(): ... experiment.ActionEvent') experiment.ActionEvent.insert(concat_rows['action_event'], **insert_settings) log.info('BehaviorIngest.make(): ... experiment.SessionBlock') experiment.SessionBlock.insert(concat_rows['sess_block'], **insert_settings) experiment.SessionBlock.BlockTrial.insert(concat_rows['sess_block_trial'], **insert_settings) block_reward_prob = [] for block in concat_rows['sess_block']: block_reward_prob.extend( [{**block, 'water_port': water_port, 'reward_probability': reward_p} for water_port, reward_p in block.pop('reward_probability').items()]) experiment.SessionBlock.WaterPortRewardProbability.insert(block_reward_prob, **insert_settings) log.info('BehaviorIngest.make(): ... experiment.TrialAvailableReward') experiment.TrialAvailableReward.insert(concat_rows['available_reward'], **insert_settings) log.info('BehaviorIngest.make(): ... experiment.WaterValveSetting') experiment.WaterPortSetting.insert(concat_rows['valve_setting'], **insert_settings) experiment.WaterPortSetting.OpenDuration.insert(concat_rows['valve_open_dur'], **insert_settings) # Behavior Ingest Insertion log.info('BehaviorBpodIngest.make(): saving ingest {}'.format(sess_key)) self.insert1(sess_key, **insert_settings) self.BehaviorFile.insert( [{**sess_key, 'behavior_file': pathlib.Path(s.path).as_posix()} for s in sessions_now], **insert_settings) # --------------------- HELPER LOADER FUNCTIONS ----------------- def detect_task_type(path): """ Method to detect if a behavior matlab file is for "delay-response" or "multi-target-licking" task :param path: (str) filepath of the behavior file (.mat) :return task_type: (str) "delay-response" or "multi-target-licking" """ # distinguishing "delay-response" task or "multi-target-licking" task mat = spio.loadmat(path.as_posix(), squeeze_me=True, struct_as_record=False) GUI_fields = set(mat['SessionData'].SettingsFile.GUI._fieldnames) if ({'X_center', 'Y_center', 'Z_center'}.issubset(GUI_fields) and not {'SamplePeriod', 'DelayPeriod'}.issubset(GUI_fields)): task_type = 'multi-target-licking' else: task_type = 'delay-response' return task_type def load_delay_response_matfile(skey, matlab_filepath): """ Loading routine for delay-response task - from .mat behavior data :param skey: session_key :param matlab_filepath: full-path to the .mat file containing the delay-response behavior data :return: nested list of all rows to be inserted into the various experiment-related tables """ matlab_filepath = pathlib.Path(matlab_filepath) h2o = skey.pop('h2o') SessionData = spio.loadmat(matlab_filepath.as_posix(), squeeze_me=True, struct_as_record=False)['SessionData'] # parse session datetime session_datetime_str = str('').join((str(SessionData.Info.SessionDate), ' ', str(SessionData.Info.SessionStartTime_UTC))) session_datetime = datetime.strptime( session_datetime_str, '%d-%b-%Y %H:%M:%S') AllTrialTypes = SessionData.TrialTypes AllTrialSettings = SessionData.TrialSettings AllTrialStarts = SessionData.TrialStartTimestamp AllTrialStarts = AllTrialStarts - AllTrialStarts[0] # real 1st trial RawData = SessionData.RawData AllStateNames = RawData.OriginalStateNamesByNumber AllStateData = RawData.OriginalStateData AllEventData = RawData.OriginalEventData AllStateTimestamps = RawData.OriginalStateTimestamps AllEventTimestamps = RawData.OriginalEventTimestamps AllRawEvents = SessionData.RawEvents.Trial # verify trial-related data arrays are all same length assert (all((x.shape[0] == AllStateTimestamps.shape[0] for x in (AllTrialTypes, AllTrialSettings, AllStateNames, AllStateData, AllEventData, AllEventTimestamps, AllTrialStarts, AllTrialStarts, AllRawEvents)))) # AllStimTrials optional special case if 'StimTrials' in SessionData._fieldnames: log.debug('StimTrials detected in session - will include') AllStimTrials = SessionData.StimTrials assert (AllStimTrials.shape[0] == AllStateTimestamps.shape[0]) else: log.debug('StimTrials not detected in session - will skip') AllStimTrials = np.array([ None for _ in enumerate(range(AllStateTimestamps.shape[0]))]) # AllFreeTrials optional special case if 'FreeTrials' in SessionData._fieldnames: log.debug('FreeTrials detected in session - will include') AllFreeTrials = SessionData.FreeTrials assert (AllFreeTrials.shape[0] == AllStateTimestamps.shape[0]) else: log.debug('FreeTrials not detected in session - synthesizing') AllFreeTrials = np.zeros(AllStateTimestamps.shape[0], dtype=np.uint8) # Photostim Period: early-delay, late-delay (default is early-delay) # Infer from filename for now, only applicable to Susu's sessions (i.e. "SC" in h2o) # If RecordingRig3, then 'late-delay' photostim_period = 'early-delay' rig_name = re.search('Recording(Rig\d)_', matlab_filepath.name) if re.match('SC', h2o) and rig_name: rig_name = rig_name.groups()[0] if rig_name == "Rig3": photostim_period = 'late-delay' log.info('Photostim Period: {}'.format(photostim_period)) trials = list(zip(AllTrialTypes, AllStimTrials, AllFreeTrials, AllTrialSettings, AllStateTimestamps, AllStateNames, AllStateData, AllEventData, AllEventTimestamps, AllTrialStarts, AllRawEvents)) if not trials: log.warning('skipping date {d}, no valid files'.format(d=date)) return # # Trial data seems valid; synthesize session id & add session record # XXX: note - later breaks can result in Sessions without valid trials # assert skey['session_date'] == session_datetime.date() skey['session_date'] = session_datetime.date() skey['session_time'] = session_datetime.time() # # Actually load the per-trial data # log.info('BehaviorIngest.make(): trial parsing phase') # lists of various records for batch-insert rows = {k: list() for k in ('trial', 'behavior_trial', 'trial_note', 'trial_event', 'corrected_trial_event', 'action_event', 'photostim', 'photostim_location', 'photostim_trial', 'photostim_trial_event')} trial = namedtuple( # simple structure to track per-trial vars 'trial', ('ttype', 'stim', 'free', 'settings', 'state_times', 'state_names', 'state_data', 'event_data', 'event_times', 'trial_start', 'trial_raw_events')) trial_number = 0 # trial numbering starts at 1 for t in trials: # # Misc # t = trial(*t) # convert list of items to a 'trial' structure trial_number += 1 # increment trial counter log.debug('BehaviorIngest.make(): parsing trial {i}'.format(i=trial_number)) # covert state data names into a lookup dictionary # # names (seem to be? are?): # # Trigtrialstart, PreSamplePeriod, SamplePeriod, DelayPeriod # EarlyLickDelay, EarlyLickSample, ResponseCue, GiveLeftDrop # GiveRightDrop, GiveLeftDropShort, GiveRightDropShort # AnswerPeriod, Reward, RewardConsumption, NoResponse # TimeOut, StopLicking, StopLickingReturn, TrialEnd # states = {k: (v + 1) for v, k in enumerate(t.state_names)} required_states = ('PreSamplePeriod', 'SamplePeriod', 'DelayPeriod', 'ResponseCue', 'StopLicking', 'TrialEnd') missing = list(k for k in required_states if k not in states) if len(missing): log.warning('skipping trial {i}; missing {m}' .format(i=trial_number, m=missing)) continue gui = t.settings.GUI # ProtocolType - only ingest protocol >= 3 # # 1 Water-Valve-Calibration 2 Licking 3 Autoassist # 4 No autoassist 5 DelayEnforce 6 SampleEnforce 7 Fixed # if 'ProtocolType' not in gui._fieldnames: log.warning('skipping trial {i}; protocol undefined' .format(i=trial_number)) continue protocol_type = gui.ProtocolType if gui.ProtocolType < 3: log.warning('skipping trial {i}; protocol {n} < 3' .format(i=trial_number, n=gui.ProtocolType)) continue # # Top-level 'Trial' record # tkey = dict(skey) startindex = np.where(t.state_data == states['PreSamplePeriod'])[0] endindex = np.where(t.state_data == states['TrialEnd'])[0] log.debug('states\n' + str(states)) log.debug('state_data\n' + str(t.state_data)) log.debug('startindex\n' + str(startindex)) log.debug('endindex\n' + str(endindex)) if not (len(startindex) and len(endindex)): log.warning('skipping {}: start/end mismatch: {}/{}'.format( trial_number, str(startindex), str(endindex))) continue try: tkey['trial'] = trial_number tkey['trial_uid'] = trial_number tkey['start_time'] = t.trial_start tkey['stop_time'] = t.trial_start + t.state_times[endindex][0] except IndexError: log.warning('skipping {}: IndexError: {}/{} -> {}'.format( trial_number, str(startindex), str(endindex), str(t.state_times))) continue log.debug('tkey' + str(tkey)) rows['trial'].append(tkey) # # Specific BehaviorTrial information for this trial # bkey = dict(tkey) bkey['task'] = 'audio delay' # hard-coded here bkey['task_protocol'] = 1 # hard-coded here # determine trial instruction trial_instruction = 'left' # hard-coded here if gui.Reversal == 1: if t.ttype == 1: trial_instruction = 'left' elif t.ttype == 0: trial_instruction = 'right' elif gui.Reversal == 2: if t.ttype == 1: trial_instruction = 'right' elif t.ttype == 0: trial_instruction = 'left' bkey['trial_instruction'] = trial_instruction # determine early lick early_lick = 'no early' if (protocol_type >= 5 and 'EarlyLickDelay' in states and np.any(t.state_data == states['EarlyLickDelay'])): early_lick = 'early' if (protocol_type >= 5 and ('EarlyLickSample' in states and np.any(t.state_data == states['EarlyLickSample']))): early_lick = 'early' bkey['early_lick'] = early_lick # determine outcome outcome = 'ignore' if ('Reward' in states and np.any(t.state_data == states['Reward'])): outcome = 'hit' elif ('TimeOut' in states and np.any(t.state_data == states['TimeOut'])): outcome = 'miss' elif ('NoResponse' in states and np.any(t.state_data == states['NoResponse'])): outcome = 'ignore' bkey['outcome'] = outcome # Determine free/autowater (Autowater 1 == enabled, 2 == disabled) bkey['auto_water'] = int(gui.Autowater == 1 or np.any(t.settings.GaveFreeReward[:2])) bkey['free_water'] = t.free rows['behavior_trial'].append(bkey) # # Add 'protocol' note # nkey = dict(tkey) nkey['trial_note_type'] = 'protocol #' nkey['trial_note'] = str(protocol_type) rows['trial_note'].append(nkey) # # Add 'autolearn' note # nkey = dict(tkey) nkey['trial_note_type'] = 'autolearn' nkey['trial_note'] = str(gui.Autolearn) rows['trial_note'].append(nkey) # # Add 'bitcode' note # if 'randomID' in gui._fieldnames: nkey = dict(tkey) nkey['trial_note_type'] = 'bitcode' nkey['trial_note'] = str(gui.randomID) rows['trial_note'].append(nkey) # ==== TrialEvents ==== trial_event_types = [('PreSamplePeriod', 'presample'), ('SamplePeriod', 'sample'), ('DelayPeriod', 'delay'), ('ResponseCue', 'go'), ('TrialEnd', 'trialend')] for tr_state, trial_event_type in trial_event_types: tr_events = getattr(t.trial_raw_events.States, tr_state) tr_events = np.array([tr_events]) if tr_events.ndim < 2 else tr_events for (s_start, s_end) in tr_events: ekey = dict(tkey) ekey['trial_event_id'] = len(rows['trial_event']) ekey['trial_event_type'] = trial_event_type ekey['trial_event_time'] = s_start ekey['duration'] = s_end - s_start rows['trial_event'].append(ekey) if trial_event_type == 'delay': this_trial_delay_duration = s_end - s_start # ==== ActionEvents ==== # # Add lick events # lickleft = np.where(t.event_data == 69)[0] log.debug('... lickleft: {r}'.format(r=str(lickleft))) action_event_count = len(rows['action_event']) if len(lickleft): [rows['action_event'].append( dict(tkey, action_event_id=action_event_count + idx, action_event_type='left lick', action_event_time=t.event_times[l])) for idx, l in enumerate(lickleft)] lickright = np.where(t.event_data == 71)[0] log.debug('... lickright: {r}'.format(r=str(lickright))) action_event_count = len(rows['action_event']) if len(lickright): [rows['action_event'].append( dict(tkey, action_event_id=action_event_count + idx, action_event_type='right lick', action_event_time=t.event_times[r])) for idx, r in enumerate(lickright)] # ==== PhotostimEvents ==== # # Photostim Events # if photostim_period == 'early-delay': valid_protocol = protocol_type == 5 elif photostim_period == 'late-delay': valid_protocol = protocol_type > 4 if t.stim and valid_protocol and gui.Autolearn == 4 and this_trial_delay_duration == 1.2: log.debug('BehaviorIngest.make(): t.stim == {}'.format(t.stim)) rows['photostim_trial'].append(tkey) if photostim_period == 'early-delay': # same as the delay-onset delay_periods = t.trial_raw_events.States.DelayPeriod delay_periods = np.array( [delay_periods]) if delay_periods.ndim < 2 else delay_periods stim_onset = delay_periods[-1][0] elif photostim_period == 'late-delay': # 0.5 sec prior to the go-cue stim_onset = t.trial_raw_events.States.ResponseCue[0] - 0.5 rows['photostim_trial_event'].append( dict(tkey, photo_stim=t.stim, photostim_event_id=len( rows['photostim_trial_event']), photostim_event_time=stim_onset, power=5.5)) # end of trial loop. return rows def load_multi_target_licking_matfile(skey, matlab_filepath): """ Loading routine for delay-response task - from .mat behavior data :param skey: session_key :param matlab_filepath: full-path to the .mat file containing the delay-response behavior data :return: nested list of all rows to be inserted into the various experiment-related tables """ matlab_filepath = pathlib.Path(matlab_filepath) h2o = skey.pop('h2o') SessionData = spio.loadmat(matlab_filepath.as_posix(), squeeze_me=True, struct_as_record=False)['SessionData'] # parse session datetime session_datetime_str = str('').join((str(SessionData.Info.SessionDate), ' ', str(SessionData.Info.SessionStartTime_UTC))) session_datetime = datetime.strptime( session_datetime_str, '%d-%b-%Y %H:%M:%S') valid_trial_ind = np.where(SessionData.MATLABStartTimes != 0)[0] valid_trial_mapper = {trial_number: orig_trial_number for trial_number, orig_trial_number in zip(np.arange(len(valid_trial_ind)) + 1, valid_trial_ind + 1)} # "+ 1" as trial numbering starts at 1 AllTrialTypes = SessionData.TrialTypes AllTrialSettings = SessionData.TrialSettings AllTrialStarts = SessionData.TrialStartTimestamp AllTrialStarts = AllTrialStarts - AllTrialStarts[0] # real 1st trial RawData = SessionData.RawData AllStateNames = RawData.OriginalStateNamesByNumber AllStateData = RawData.OriginalStateData AllEventData = RawData.OriginalEventData AllStateTimestamps = RawData.OriginalStateTimestamps AllEventTimestamps = RawData.OriginalEventTimestamps AllRawEvents = SessionData.RawEvents.Trial # assign SessionBlock and SessionTrial association AllBlockTrials = np.cumsum(np.where(SessionData.TrialBlockOrder == 1, 1, 0)) # index to only valid trials AllTrialTypes = AllTrialTypes[valid_trial_ind] AllTrialSettings = AllTrialSettings[valid_trial_ind] AllBlockTrials = AllBlockTrials[valid_trial_ind] # verify trial-related data arrays are all same length assert (all((x.shape[0] == AllStateTimestamps.shape[0] for x in (AllTrialTypes, AllTrialSettings, AllStateNames, AllStateData, AllEventData, AllEventTimestamps, AllTrialStarts, AllTrialStarts, AllRawEvents, AllBlockTrials)))) # AllStimTrials optional special case if 'StimTrials' in SessionData._fieldnames and len(SessionData.StimTrials): log.debug('StimTrials detected in session - will include') AllStimTrials = SessionData.StimTrials assert (AllStimTrials.shape[0] == AllStateTimestamps.shape[0]) else: log.debug('StimTrials not detected in session - will skip') AllStimTrials = np.array([ None for _ in enumerate(range(AllStateTimestamps.shape[0]))]) # AllFreeTrials optional special case if 'FreeTrials' in SessionData._fieldnames: log.debug('FreeTrials detected in session - will include') AllFreeTrials = SessionData.FreeTrials assert (AllFreeTrials.shape[0] == AllStateTimestamps.shape[0]) else: log.debug('FreeTrials not detected in session - synthesizing') AllFreeTrials = np.zeros(AllStateTimestamps.shape[0], dtype=np.uint8) trials = list(zip(AllTrialTypes, AllStimTrials, AllFreeTrials, AllTrialSettings, AllStateTimestamps, AllStateNames, AllStateData, AllEventData, AllEventTimestamps, AllTrialStarts, AllRawEvents, AllBlockTrials)) if not trials: log.warning('skipping date {d}, no valid files'.format(d=date)) raise InvalidBehaviorTrialError('skipping date {d}, no valid files'.format(d=date)) assert skey['session_date'] == session_datetime.date() skey['session_date'] = session_datetime.date() skey['session_time'] = session_datetime.time() # # Actually load the per-trial data # log.info('BehaviorIngest.make(): trial parsing phase') # lists of various records for batch-insert rows = {k: list() for k in ( 'trial', 'behavior_trial', 'trial_note', 'trial_event', 'corrected_trial_event', 'action_event', 'photostim', 'photostim_location', 'photostim_trial', 'photostim_trial_event', 'session_block', 'session_block_waterport', 'session_block_trial')} # simple structure to track per-trial vars trial = namedtuple('trial', ('ttype', 'stim', 'free', 'settings', 'state_times', 'state_names', 'state_data', 'event_data', 'event_times', 'trial_start', 'trial_raw_events', 'trial_block')) trial_number = 0 # trial numbering starts at 1 for t in trials: # # Misc # t = trial(*t) # convert list of items to a 'trial' structure trial_number += 1 # increment trial counter log.debug('BehaviorIngest.make(): parsing trial {i}'.format(i=trial_number)) states = {k: (v + 1) for v, k in enumerate(t.state_names)} gui = t.settings.GUI protocol_type = gui.ProtocolType # # Top-level 'Trial' record # tkey = dict(skey) startindex = np.where(t.state_data == states['TrigTrialStart'])[0] endindex = np.where(t.state_data == states['TrialEnd'])[0] log.debug('states\n' + str(states)) log.debug('state_data\n' + str(t.state_data)) log.debug('startindex\n' + str(startindex)) log.debug('endindex\n' + str(endindex)) if not (len(startindex) and len(endindex)): log.warning('skipping {}: start/end mismatch: {}/{}'.format( trial_number, str(startindex), str(endindex))) continue try: tkey['trial'] = trial_number tkey['trial_uid'] = trial_number tkey['start_time'] = t.trial_start tkey['stop_time'] = t.trial_start + t.state_times[endindex][0] except IndexError: log.warning('skipping {}: IndexError: {}/{} -> {}'.format( trial_number, str(startindex), str(endindex), str(t.state_times))) continue log.debug('tkey' + str(tkey)) rows['trial'].append(tkey) # # Specific Multi-target-licking blocks information for this trial # trial_block = t.trial_block block_key = {**skey, 'block': trial_block} # check if first trial in block if (not rows['session_block'] or rows['session_block'][-1]['block'] != trial_block): auto_water = True # first trial in a block is always auto-water trial block_trial_number = 1 # block details rows['session_block'].append({ **block_key, 'block_start_time': tkey['start_time'], 'trial_count': sum(AllBlockTrials == trial_block), 'num_licks_for_reward': gui.NumLicksForReward, 'roll_deg': gui.RollDeg, 'position_x_bins': gui.num_bins, 'position_y_bins': 1, 'position_z_bins': gui.num_bins }) # block's water-port details row_idx, col_idx = np.where(SessionData.trial_type_mat[trial_number-1] == t.ttype) rows['session_block_waterport'].append({ **block_key, 'water_port': 'mtl-{}'.format(t.ttype), 'position_x': SessionData.X_positions_mat[trial_number-1][row_idx[0], col_idx[0]], 'position_y': gui.Y_center, 'position_z': SessionData.Z_positions_mat[trial_number-1][row_idx[0], col_idx[0]] }) else: auto_water = False block_trial_number = rows['session_block_trial'][-1]['block_trial_number'] + 1 # block's trial details rows['session_block_trial'].append({ **block_key, **tkey, 'block_trial_number': block_trial_number}) # # Specific BehaviorTrial information for this trial # bkey = dict(tkey) bkey['task'] = 'multi-target-licking' # hard-coded here bkey['task_protocol'] = int(protocol_type) # trial instruction - 'none' - no notion of "trial instruction" for this task bkey['trial_instruction'] = 'none' # hard-coded here # determine early lick - no notion of "early lick" for this task bkey['early_lick'] = 'no early' # determine outcome - no notion of "outcome" for this task bkey['outcome'] = 'N/A' # Determine autowater (Autowater 1 == enabled, 2 == disabled) auto_water = gui.Autowater == 1 or auto_water bkey['auto_water'] = int(auto_water) # Determine freewater bkey['free_water'] = int(bool(t.free)) rows['behavior_trial'].append(bkey) # # Add 'protocol' note # nkey = dict(tkey) nkey['trial_note_type'] = 'protocol #' nkey['trial_note'] = str(protocol_type) rows['trial_note'].append(nkey) # # Add 'bitcode' note # # binary representation of the trial-number as a string # using the original trial numbering (to match with ephys's bitcode) orig_trial_number = valid_trial_mapper[tkey['trial']] nkey = dict(tkey) nkey['trial_note_type'] = 'bitcode' nkey['trial_note'] = np.binary_repr(orig_trial_number, 10)[::-1] rows['trial_note'].append(nkey) # ==== TrialEvents ==== trial_event_types = [('TrialEnd', 'trialend')] for tr_state, trial_event_type in trial_event_types: tr_events = getattr(t.trial_raw_events.States, tr_state) tr_events = np.array([tr_events]) if tr_events.ndim < 2 else tr_events for (s_start, s_end) in tr_events: ekey = dict(tkey) ekey['trial_event_id'] = len(rows['trial_event']) ekey['trial_event_type'] = trial_event_type ekey['trial_event_time'] = s_start ekey['duration'] = s_end - s_start rows['trial_event'].append(ekey) # ==== ActionEvents ==== # no action events for multi-target-licking task # end of trial loop. return rows
{"hexsha": "1d119e13fd297645eceb215fa081e4b3546bcaf1", "size": 71298, "ext": "py", "lang": "Python", "max_stars_repo_path": "pipeline/ingest/behavior.py", "max_stars_repo_name": "Yambottle/map-ephys", "max_stars_repo_head_hexsha": "bea24e29070a53ad97561a66d30a12fc4d8e5409", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "pipeline/ingest/behavior.py", "max_issues_repo_name": "Yambottle/map-ephys", "max_issues_repo_head_hexsha": "bea24e29070a53ad97561a66d30a12fc4d8e5409", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "pipeline/ingest/behavior.py", "max_forks_repo_name": "Yambottle/map-ephys", "max_forks_repo_head_hexsha": "bea24e29070a53ad97561a66d30a12fc4d8e5409", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 45.0682680152, "max_line_length": 199, "alphanum_fraction": 0.560548683, "include": true, "reason": "import numpy,import scipy", "num_tokens": 15476}
import cv2 as cv import numpy as np img = cv.imread("img.png",0) img = cv.GaussianBlur(img,(9,9),10) th2 , ret2 = cv.threshold(img,0,255,cv.THRESH_BINARY + cv.THRESH_OTSU) kernel = np.ones((5,5)) ret2 = cv.morphologyEx(ret2, cv.MORPH_OPEN, kernel) ret2 = cv.dilate(ret2 , kernel,50) cv.imshow("the",ret2) label, ret = cv.connectedComponents(ret2) # Map component labels to hue val label_hue = np.uint8(179*ret/np.max(ret)) blank_ch = 255*np.ones_like(label_hue) labeled_img = cv.merge([label_hue, blank_ch, blank_ch]) print("Number of Objects "+str(label)) # cvt to BGR for display labeled_img = cv.cvtColor(labeled_img, cv.COLOR_HSV2BGR) # set bg label to black labeled_img[label_hue==0] = 0 cv.imshow('labeled.png', labeled_img) cv.waitKey() cv.imwrite("result.png",labeled_img) raw = cv.imread("img.png") #height , width , depth = raw #for
{"hexsha": "903434185fa9189a5a59b7911f75378f87f9af50", "size": 887, "ext": "py", "lang": "Python", "max_stars_repo_path": "lab 10/main.py", "max_stars_repo_name": "AbdulMoeed-140212/DIP-Labs", "max_stars_repo_head_hexsha": "0b083e381ef9f9e2a780dc64ef6a4f04bcde6946", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lab 10/main.py", "max_issues_repo_name": "AbdulMoeed-140212/DIP-Labs", "max_issues_repo_head_hexsha": "0b083e381ef9f9e2a780dc64ef6a4f04bcde6946", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lab 10/main.py", "max_forks_repo_name": "AbdulMoeed-140212/DIP-Labs", "max_forks_repo_head_hexsha": "0b083e381ef9f9e2a780dc64ef6a4f04bcde6946", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.3428571429, "max_line_length": 71, "alphanum_fraction": 0.6956031567, "include": true, "reason": "import numpy", "num_tokens": 270}
subroutine nut_nrain !! ~ ~ ~ PURPOSE ~ ~ ~ !! this subroutine adds nitrate from rainfall to the soil profile !! ~ ~ ~ INCOMING VARIABLES ~ ~ ~ !! name |units |definition !! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ !! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ !! ~ ~ ~ OUTGOING VARIABLES ~ ~ ~ !! name |units |definition !! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ !! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ !! ~ ~ ~ LOCAL DEFINITIONS ~ ~ ~ !! name |units |definition !! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ !! j |none |HRU number !! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ !! ~ ~ ~ ~ ~ ~ END SPECIFICATIONS ~ ~ ~ ~ ~ ~ use basin_module use organic_mineral_mass_module use hydrograph_module use hru_module, only : hru, ihru, precipday, timest use climate_module use output_landscape_module implicit none integer :: iadep ! | integer :: j !none |counter integer :: iob ! | integer :: ist ! | real :: const ! |constant used for rate, days, etc j = ihru iob = hru(j)%obj_no iwst = ob(iob)%wst iadep = wst(iwst)%wco%atmodep ist = atmodep_cont%ts !! calculate nitrogen in precipitation - mg/l *mm -> kg/ha !! (mg/l*mm) * kg/1,000,000 mg *1,00 l/m3 * m3/1,000 mm * 10,000 m2/ha = 0.01 if (ist > 0 .and. ist <= atmodep_cont%num) then if (atmodep_cont%timestep == "mo") then const = float (ndays(time%mo + 1) - ndays(time%mo)) hnb_d(j)%no3atmo = .01 * atmodep(iadep)%no3_rfmo(ist) * precipday + atmodep(iadep)%no3_drymo(ist) / const soil1(j)%mn(1)%no3 = hnb_d(j)%no3atmo + soil1(j)%mn(1)%no3 hnb_d(j)%nh4atmo = .01 * atmodep(iadep)%nh4_rfmo(ist) * precipday + atmodep(iadep)%nh4_drymo(ist) / const soil1(j)%mn(1)%nh4 = soil1(j)%mn(1)%nh4 + hnb_d(j)%nh4atmo end if if (atmodep_cont%timestep == "yr") then hnb_d(j)%no3atmo = .01 * atmodep(iadep)%no3_rfyr(ist) * precipday + atmodep(iadep)%no3_dryyr(ist) / 365. soil1(j)%mn(1)%no3 = hnb_d(j)%no3atmo + soil1(j)%mn(1)%no3 hnb_d(j)%nh4atmo = .01 * atmodep(iadep)%nh4_rfyr(ist) * precipday + atmodep(iadep)%nh4_dryyr(ist) / 365. soil1(j)%mn(1)%nh4 = soil1(j)%mn(1)%nh4 + hnb_d(j)%nh4atmo endif end if if (atmodep_cont%timestep == "aa") then hnb_d(j)%no3atmo = .01 * atmodep(iadep)%no3_rf * precipday + atmodep(iadep)%no3_dry / 365. soil1(j)%mn(1)%no3 = hnb_d(j)%no3atmo + soil1(j)%mn(1)%no3 hnb_d(j)%nh4atmo = .01 * atmodep(iadep)%nh4_rf * precipday + atmodep(iadep)%nh4_dry / 365. soil1(j)%mn(1)%nh4 = soil1(j)%mn(1)%nh4 + hnb_d(j)%nh4atmo endif return end subroutine nut_nrain
{"hexsha": "f92774bf788325a2ded70fa878b8bebbf76c9680", "size": 3183, "ext": "f90", "lang": "FORTRAN", "max_stars_repo_path": "tests/data/program_analysis/multifile_multimod/mfmm_02/nut_nrain.f90", "max_stars_repo_name": "mikiec84/delphi", "max_stars_repo_head_hexsha": "2e517f21e76e334c7dfb14325d25879ddf26d10d", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 25, "max_stars_repo_stars_event_min_datetime": "2018-03-03T11:57:57.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-16T21:19:54.000Z", "max_issues_repo_path": "tests/data/program_analysis/multifile_multimod/mfmm_02/nut_nrain.f90", "max_issues_repo_name": "mikiec84/delphi", "max_issues_repo_head_hexsha": "2e517f21e76e334c7dfb14325d25879ddf26d10d", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 385, "max_issues_repo_issues_event_min_datetime": "2018-02-21T16:52:06.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-17T07:44:56.000Z", "max_forks_repo_path": "tests/data/program_analysis/multifile_multimod/mfmm_02/nut_nrain.f90", "max_forks_repo_name": "mikiec84/delphi", "max_forks_repo_head_hexsha": "2e517f21e76e334c7dfb14325d25879ddf26d10d", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 19, "max_forks_repo_forks_event_min_datetime": "2018-03-20T01:08:11.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-29T01:04:49.000Z", "avg_line_length": 46.1304347826, "max_line_length": 115, "alphanum_fraction": 0.4586867735, "num_tokens": 1191}
import numpy as np from scipy.interpolate import UnivariateSpline from scipy.optimize import fmin_slsqp from quantecon import MarkovChain from scipy.optimize import root class RecursiveAllocation: ''' Compute the planner's allocation by solving Bellman equation. ''' def __init__(self, model, μgrid): self.β, self.π, self.G = model.β, model.π, model.G self.mc, self.S = MarkovChain(self.π), len(model.π) # Number of states self.Θ, self.model, self.μgrid = model.Θ, model, μgrid # Find the first best allocation self.solve_time1_bellman() self.T.time_0 = True # Bellman equation now solves time 0 problem def solve_time1_bellman(self): ''' Solve the time 1 Bellman equation for calibration model and initial grid μgrid0 ''' model, μgrid0 = self.model, self.μgrid S = len(model.π) # First get initial fit pp = SequentialAllocation(model) c, n, x, V = map(np.vstack, zip(*map(lambda μ: pp.time1_value(μ), μgrid0))) Vf, cf, nf, xprimef = {}, {}, {}, {} for s in range(2): ind = np.argsort(x[:, s]) # Sort x # Sort arrays according to x c, n, x, V = c[ind], n[ind], x[ind], V[ind] cf[s] = UnivariateSpline(x[:, s], c[:, s]) nf[s] = UnivariateSpline(x[:, s], n[:, s]) Vf[s] = UnivariateSpline(x[:, s], V[:, s]) for sprime in range(S): xprimef[s, sprime] = UnivariateSpline(x[:, s], x[:, s]) policies = [cf, nf, xprimef] # Create xgrid xbar = [x.min(0).max(), x.max(0).min()] xgrid = np.linspace(xbar[0], xbar[1], len(μgrid0)) self.xgrid = xgrid # Now iterate on bellman equation T = BellmanEquation(model, xgrid, policies) diff = 1 while diff > 1e-7: PF = T(Vf) Vfnew, policies = self.fit_policy_function(PF) diff = 0 for s in range(S): diff = max(diff, np.abs( (Vf[s](xgrid) - Vfnew[s](xgrid)) / Vf[s](xgrid)).max()) Vf = Vfnew # Store value function policies and Bellman Equations self.Vf = Vf self.policies = policies self.T = T def fit_policy_function(self, PF): ''' Fits the policy functions PF using the points xgrid using UnivariateSpline ''' xgrid, S = self.xgrid, self.S Vf, cf, nf, xprimef = {}, {}, {}, {} for s in range(S): PFvec = np.vstack(tuple(map(lambda x: PF(x, s), xgrid))) Vf[s] = UnivariateSpline(xgrid, PFvec[:, 0], s=0) cf[s] = UnivariateSpline(xgrid, PFvec[:, 1], s=0, k=1) nf[s] = UnivariateSpline(xgrid, PFvec[:, 2], s=0, k=1) for sprime in range(S): xprimef[s, sprime] = UnivariateSpline( xgrid, PFvec[:, 3 + sprime], s=0, k=1) return Vf, [cf, nf, xprimef] def Τ(self, c, n): ''' Computes Τ given c, n ''' model = self.model Uc, Un = model.Uc(c, n), model.Un(c, n) return 1 + Un / (self.Θ * Uc) def time0_allocation(self, B_, s0): ''' Finds the optimal allocation given initial government debt B_ and state s_0 ''' PF = self.T(self.Vf) z0 = PF(B_, s0) c0, n0, xprime0 = z0[1], z0[2], z0[3:] return c0, n0, xprime0 def simulate(self, B_, s_0, T, sHist=None): ''' Simulates Ramsey plan for T periods ''' model, π = self.model, self.π Uc = model.Uc cf, nf, xprimef = self.policies if sHist is None: sHist = self.mc.simulate(T, s_0) cHist, nHist, Bhist, ΤHist, μHist = np.zeros((5, T)) RHist = np.zeros(T - 1) # Time 0 cHist[0], nHist[0], xprime = self.time0_allocation(B_, s_0) ΤHist[0] = self.Τ(cHist[0], nHist[0])[s_0] Bhist[0] = B_ μHist[0] = 0 # Time 1 onward for t in range(1, T): s, x = sHist[t], xprime[sHist[t]] c, n, xprime = np.empty(self.S), nf[s](x), np.empty(self.S) for shat in range(self.S): c[shat] = cf[shat](x) for sprime in range(self.S): xprime[sprime] = xprimef[s, sprime](x) Τ = self.Τ(c, n)[s] u_c = Uc(c, n) Eu_c = π[sHist[t - 1]] @ u_c μHist[t] = self.Vf[s](x, 1) RHist[t - 1] = Uc(cHist[t - 1], nHist[t - 1]) / (self.β * Eu_c) cHist[t], nHist[t], Bhist[t], ΤHist[t] = c[s], n, x / u_c[s], Τ return np.array([cHist, nHist, Bhist, ΤHist, sHist, μHist, RHist]) class BellmanEquation: ''' Bellman equation for the continuation of the Lucas-Stokey Problem ''' def __init__(self, model, xgrid, policies0): self.β, self.π, self.G = model.β, model.π, model.G self.S = len(model.π) # Number of states self.Θ, self.model = model.Θ, model self.xbar = [min(xgrid), max(xgrid)] self.time_0 = False self.z0 = {} cf, nf, xprimef = policies0 for s in range(self.S): for x in xgrid: xprime0 = np.empty(self.S) for sprime in range(self.S): xprime0[sprime] = xprimef[s, sprime](x) self.z0[x, s] = np.hstack([cf[s](x), nf[s](x), xprime0]) self.find_first_best() def find_first_best(self): ''' Find the first best allocation ''' model = self.model S, Θ, Uc, Un, G = self.S, self.Θ, model.Uc, model.Un, self.G def res(z): c = z[:S] n = z[S:] return np.hstack([Θ * Uc(c, n) + Un(c, n), Θ * n - c - G]) res = root(res, 0.5 * np.ones(2 * S)) if not res.success: raise Exception('Could not find first best') self.cFB = res.x[:S] self.nFB = res.x[S:] IFB = Uc(self.cFB, self.nFB) * self.cFB + Un(self.cFB, self.nFB) * self.nFB self.xFB = np.linalg.solve(np.eye(S) - self.β * self.π, IFB) self.zFB = {} for s in range(S): self.zFB[s] = np.hstack([self.cFB[s], self.nFB[s], self.xFB]) def __call__(self, Vf): ''' Given continuation value function, next period return value function, this period return T(V) and optimal policies ''' if not self.time_0: def PF(x, s): return self.get_policies_time1(x, s, Vf) else: def PF(B_, s0): return self.get_policies_time0(B_, s0, Vf) return PF def get_policies_time1(self, x, s, Vf): ''' Finds the optimal policies ''' model, β, Θ, = self.model, self.β, self.Θ, G, S, π = self.G, self.S, self.π U, Uc, Un = model.U, model.Uc, model.Un def objf(z): c, n, xprime = z[0], z[1], z[2:] Vprime = np.empty(S) for sprime in range(S): Vprime[sprime] = Vf[sprime](xprime[sprime]) return -(U(c, n) + β * π[s] @ Vprime) def cons(z): c, n, xprime = z[0], z[1], z[2:] return np.hstack([x - Uc(c, n) * c - Un(c, n) * n - β * π[s] @ xprime, (Θ * n - c - G)[s]]) out, fx, _, imode, smode = fmin_slsqp(objf, self.z0[x, s], f_eqcons=cons, bounds=[(0, 100), (0, 100)] + [self.xbar] * S, full_output=True, iprint=0, acc=1e-10) if imode > 0: raise Exception(smode) self.z0[x, s] = out return np.hstack([-fx, out]) def get_policies_time0(self, B_, s0, Vf): ''' Finds the optimal policies ''' model, β, Θ, = self.model, self.β, self.Θ, G, S, π = self.G, self.S, self.π U, Uc, Un = model.U, model.Uc, model.Un def objf(z): c, n, xprime = z[0], z[1], z[2:] Vprime = np.empty(S) for sprime in range(S): Vprime[sprime] = Vf[sprime](xprime[sprime]) return -(U(c, n) + β * π[s0] @ Vprime) def cons(z): c, n, xprime = z[0], z[1], z[2:] return np.hstack([-Uc(c, n) * (c - B_) - Un(c, n) * n - β * π[s0] @ xprime, (Θ * n - c - G)[s0]]) out, fx, _, imode, smode = fmin_slsqp(objf, self.zFB[s0], f_eqcons=cons, bounds=[(0, 100), (0, 100)] + [self.xbar] * S, full_output=True, iprint=0, acc=1e-10) if imode > 0: raise Exception(smode) return np.hstack([-fx, out])
{"hexsha": "c02e16421c500e8eaa6892b02ccc4d94bab1d376", "size": 9244, "ext": "py", "lang": "Python", "max_stars_repo_path": "source/_static/lecture_specific/opt_tax_recur/recursive_allocation.py", "max_stars_repo_name": "gliptak/lecture-source-py", "max_stars_repo_head_hexsha": "6d8fc91acc6668f31e5c163991db7dedb133b8b7", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 194, "max_stars_repo_stars_event_min_datetime": "2018-09-04T21:47:47.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-18T18:10:42.000Z", "max_issues_repo_path": "source/_static/lecture_specific/opt_tax_recur/recursive_allocation.py", "max_issues_repo_name": "gliptak/lecture-source-py", "max_issues_repo_head_hexsha": "6d8fc91acc6668f31e5c163991db7dedb133b8b7", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 553, "max_issues_repo_issues_event_min_datetime": "2018-08-28T06:01:58.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-23T06:29:47.000Z", "max_forks_repo_path": "source/_static/lecture_specific/opt_tax_recur/recursive_allocation.py", "max_forks_repo_name": "gliptak/lecture-source-py", "max_forks_repo_head_hexsha": "6d8fc91acc6668f31e5c163991db7dedb133b8b7", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 88, "max_forks_repo_forks_event_min_datetime": "2018-08-22T21:47:35.000Z", "max_forks_repo_forks_event_max_datetime": "2021-12-30T09:05:12.000Z", "avg_line_length": 31.875862069, "max_line_length": 83, "alphanum_fraction": 0.4704673302, "include": true, "reason": "import numpy,from scipy", "num_tokens": 2717}
""" helper utility to work with global map / map layout""" import os import numpy import matplotlib.pyplot as plt import networkx as nx from scipy.misc import imread from utils import root def plot_map(): """ Older utility, new stuff should use GlobalMap.plot() """ filename = os.path.join(root, 'flash', 'fft2', 'processed', 'map.png') img = imread(filename) fig = plt.figure(1) ax = fig.gca() ax.set_xticks(numpy.arange(0,2800, 100)) ax.set_yticks(numpy.arange(0,2800, 100)) plt.grid() plt.imshow(img,zorder=0) return fig, ax DEFAULT_COLOR = (255, 255, 255, 0) GREEN_COLOR = (0, 128, 0, 255) RED_COLOR = (255, 0, 0, 255) BLUE_COLOR = (0, 0, 255, 255) MIN_UNCONTRAINED_PENALTY = 1 COLLISION_PENALTY = { DEFAULT_COLOR: MIN_UNCONTRAINED_PENALTY, GREEN_COLOR: 10, RED_COLOR: 100, BLUE_COLOR: 1000 } #TODO: figure out why we have other colors OTHER_PENALTY = 10 class GlobalMap(object): filename = os.path.join(root, 'flash', 'fft2', 'processed', 'map.png') data = imread(filename) def __init__(self): pass def plot(self): plt.close("all") fig = plt.figure() ax = fig.gca() ax.set_xticks(numpy.arange(0,2800, 100)) ax.set_yticks(numpy.arange(0,2800, 100)) plt.grid() plt.imshow(GlobalMap.data, zorder=0) def check_collision(self, pos): """ Helper utility to check for collisions. Returns penalty for several types of collision """ d = DEFAULT_COLOR try: #interesting, x,y seem to be swapped for image data d = GlobalMap.data[pos[1]][pos[0]] except IndexError: #out of bounds for bitmap pass return COLLISION_PENALTY.get(tuple(d), OTHER_PENALTY) if __name__ == '__main__': plot_map() plt.show()
{"hexsha": "45a22f488444d8fe422ea119d597e45b55700377", "size": 1899, "ext": "py", "lang": "Python", "max_stars_repo_path": "planning/astar/global_map.py", "max_stars_repo_name": "opikalo/pyfire", "max_stars_repo_head_hexsha": "1a56a39532e1a1d6ca938f46ca5f8eb09fb43957", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2015-06-03T18:05:54.000Z", "max_stars_repo_stars_event_max_datetime": "2015-06-03T18:05:54.000Z", "max_issues_repo_path": "planning/astar/global_map.py", "max_issues_repo_name": "opikalo/pyfire", "max_issues_repo_head_hexsha": "1a56a39532e1a1d6ca938f46ca5f8eb09fb43957", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "planning/astar/global_map.py", "max_forks_repo_name": "opikalo/pyfire", "max_forks_repo_head_hexsha": "1a56a39532e1a1d6ca938f46ca5f8eb09fb43957", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2017-03-30T13:17:27.000Z", "max_forks_repo_forks_event_max_datetime": "2019-02-19T12:21:04.000Z", "avg_line_length": 21.3370786517, "max_line_length": 74, "alphanum_fraction": 0.6140073723, "include": true, "reason": "import numpy,from scipy,import networkx", "num_tokens": 523}
# make sure the rest of the ABXpy package is accessible import os import sys package_path = os.path.dirname( os.path.dirname(os.path.dirname(os.path.realpath(__file__)))) if not(package_path in sys.path): sys.path.append(package_path) # remove this dependency to ABXpy and create separate repository for this ? import pandas import numpy import ABXpy.misc.tinytree as tinytree # FIXME use just one isolated | as a separator instead of two # # custom read_table that ignore empty entries at the end of a file (they # can result from trailing white spaces at the end for example) def read_table(filename): db = pandas.read_table(filename, sep='[ \t]+', engine='python') # removes row with all null values (None or NaN...) db = db.dropna(how='all') return db # function that loads a database def load(filename, features_info=False): # reading the main database using pandas (it is now a DataFrame) ext = '.item' if not(filename[len(filename) - len(ext):] == ext): filename = filename + ext db = read_table(filename) # finding '#' (to separate location info from attribute info) and fixing # names of columns columns = db.columns.tolist() l = [] for i, c in enumerate(columns): if c[0] == "#": l.append(i) columns[i] = c[1:] db.columns = pandas.Index(columns) assert len(l) > 0 and l[ 0] == 0, ('The first column name in the database main file must be ' 'prefixed with # (sharp)') assert len( l) == 2, ('Exactly two column names in the database main file must be' ' prefixed with a # (sharp)') feat_db = db[db.columns[:l[1]]] db = db[db.columns[l[1]:]] # verbose print(" Read input File '"+filename+"'. Defined conditions: # "+str(newcolumns[attrI:len(columns)])) # opening up existing auxiliary files, and merging with the main database # and creating a forest describing the hierarchy at the same time (useful # for optimizing regressor generation and filtering) (basename, _) = os.path.splitext(filename) db, db_hierarchy = load_aux_dbs(basename, db, db.columns, filename) # dealing with missing items: for now rows with missing items are dropped nanrows = numpy.any(pandas.isnull(db), 1) if any(nanrows): dropped = db[nanrows] dropped.to_csv(basename + '-removed' + ext) db = db[~ nanrows] feat_db = feat_db[~ nanrows] # not so verbose print('** Warning ** ' + len(nanrows) + ' items were # removed because of missing information. The removed items are listed in' # + basename + '-removed.item' if features_info: return db, db_hierarchy, feat_db else: return db, db_hierarchy # recursive auxiliary function for loading the auxiliary databases def load_aux_dbs(basename, db, cols, mainfile): forest = [tinytree.Tree() for col in cols] for i, col in enumerate(cols): forest[i].name = col try: auxfile = basename + '.' + col if not(auxfile == mainfile): auxdb = read_table(auxfile) assert col == auxdb.columns[0], ( 'First column name in file %s' ' is %s. It should be %s instead.' % ( auxfile, auxdb.columns[0], col)) # call get_aux_dbs on child columns auxdb, auxforest = load_aux_dbs( basename, auxdb, auxdb.columns[1:]) # add to forest forest[i].addChildrenFromList(auxforest) # merging the databases db = pandas.merge(db, auxdb, on=col, how='left') # verbose print(" Read auxiliary File '"+auxfile+"'. Defined # conditions: "+str(newcol[1:len(newcol)])+" on key '"+newcol[0]+"'") except IOError: pass return db, forest
{"hexsha": "142aa6cad0919db08b6a602125658adad8ccd5fd", "size": 3912, "ext": "py", "lang": "Python", "max_stars_repo_path": "ABXpy/database/database.py", "max_stars_repo_name": "elinlarsen/ABXpy", "max_stars_repo_head_hexsha": "7b254b99d6ce3f386f45d3da9c92cd45720dd9dd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "ABXpy/database/database.py", "max_issues_repo_name": "elinlarsen/ABXpy", "max_issues_repo_head_hexsha": "7b254b99d6ce3f386f45d3da9c92cd45720dd9dd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ABXpy/database/database.py", "max_forks_repo_name": "elinlarsen/ABXpy", "max_forks_repo_head_hexsha": "7b254b99d6ce3f386f45d3da9c92cd45720dd9dd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 37.9805825243, "max_line_length": 78, "alphanum_fraction": 0.6183537832, "include": true, "reason": "import numpy", "num_tokens": 938}
# Imports import numpy as np import sys sys.path.append('../stationsim/') from ensemble_kalman_filter import EnsembleKalmanFilter from ensemble_kalman_filter import EnsembleKalmanFilterType # from ensemble_kalman_filter import ActiveAgentNormaliser from stationsim_gcs_model import Model # Functions def make_observation_operator(population_size, mode): if mode == EnsembleKalmanFilterType.STATE: return np.identity(2 * population_size) elif mode == EnsembleKalmanFilterType.DUAL_EXIT: return make_exit_observation_operator(population_size) else: raise ValueError(f'Unexpected filter mode: {mode}') def make_exit_observation_operator(population_size): a = np.identity(2 * population_size) b = np.zeros(shape=(2 * population_size, population_size)) return np.hstack((a, b)) def make_state_vector_length(population_size, mode): if mode == EnsembleKalmanFilterType.STATE: return 2 * population_size elif mode == EnsembleKalmanFilterType.DUAL_EXIT: return 3 * population_size else: raise ValueError(f'Unexpected filter mode: {mode}') def set_up_enkf(ensemble_size=5, pop_size=5, error_normalisation=None, agent_inclusion=None): np.random.seed(666) pop_size = pop_size mode = EnsembleKalmanFilterType.STATE data_mode = EnsembleKalmanFilterType.STATE its = 10 assimilation_period = 5 ensemble_size = ensemble_size model_params = {'pop_total': pop_size, 'station': 'Grand_Central', 'do_print': False} OBS_NOISE_STD = 1 observation_operator = make_observation_operator(pop_size, mode) state_vec_length = make_state_vector_length(pop_size, mode) data_mode = EnsembleKalmanFilterType.STATE data_vec_length = make_state_vector_length(pop_size, data_mode) filter_params = {'max_iterations': its, 'assimilation_period': assimilation_period, 'ensemble_size': ensemble_size, 'population_size': pop_size, 'state_vector_length': state_vec_length, 'data_vector_length': data_vec_length, 'mode': mode, 'error_normalisation': error_normalisation, 'inclusion': agent_inclusion, 'H': observation_operator, 'R_vector': OBS_NOISE_STD * np.ones(data_vec_length), 'keep_results': True, 'run_vanilla': False, 'vis': False} enkf = EnsembleKalmanFilter(Model, filter_params, model_params) return enkf
{"hexsha": "21d7edcbdc438919d2906718e458c5c95423714b", "size": 2663, "ext": "py", "lang": "Python", "max_stars_repo_path": "Projects/ABM_DA/tests/utils.py", "max_stars_repo_name": "Urban-Analytics/dust", "max_stars_repo_head_hexsha": "952ca8991ac1f7ff65387a1b21a3fd36cf98314a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 15, "max_stars_repo_stars_event_min_datetime": "2018-11-21T14:57:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-04T15:42:09.000Z", "max_issues_repo_path": "Projects/ABM_DA/tests/utils.py", "max_issues_repo_name": "Urban-Analytics/dust", "max_issues_repo_head_hexsha": "952ca8991ac1f7ff65387a1b21a3fd36cf98314a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 125, "max_issues_repo_issues_event_min_datetime": "2019-11-06T13:03:35.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-07T13:38:33.000Z", "max_forks_repo_path": "Projects/ABM_DA/tests/utils.py", "max_forks_repo_name": "Urban-Analytics/dust", "max_forks_repo_head_hexsha": "952ca8991ac1f7ff65387a1b21a3fd36cf98314a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 6, "max_forks_repo_forks_event_min_datetime": "2018-11-20T15:56:49.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-08T10:21:06.000Z", "avg_line_length": 35.5066666667, "max_line_length": 74, "alphanum_fraction": 0.6710476906, "include": true, "reason": "import numpy", "num_tokens": 573}
include("functions/GenerateCareerPaths.jl") using Compose, GraphPlot FirstLevel = Vector{AbstractLevel}() g = DiGraph(4) # 1 => world add_edge!(g, 1, 2) #add_edge!(g, 1, 4) # 2 => 1B-BDL add_edge!(g, 2, 3) add_edge!(g, 2, 4) #add_edge!(g, 2, 5) #add_edge!(g, 2, 6) push!(FirstLevel, AcademicLevel("1B-BDL", next = ["SLT", "1LT", "CPN"], min = 6, max = 6)) # 3 => 1B-B add_edge!(g, 3, 4) #add_edge!(g, 3, 5) #add_edge!(g, 3, 6) push!(FirstLevel, AcademicLevel("1B-B", next = ["1LT", "CPN", "CDT"], max = 14)) # 4 => 1A-BDL #add_edge!(g, 4, 5) #add_edge!(g, 4, 6) #push!(FirstLevel, AcademicLevel("1A-BDL", next = ["SLT", "1LT"])) # 5 => 1A-B #add_edge!(g, 5, 6) #push!(FirstLevel, AcademicLevel("1A-B", next = ["CPN", "CDT"])) # 6 => Leaving org levelnames = [FirstLevel[i].Name for i in 1:length(FirstLevel)] draw(PNG("InitGraph.png", 25cm, 25cm), gplot(g, nodelabel=["In_world"; levelnames ;"Out_world"])) draw(SVG("InitGraph.svg", 25cm, 25cm), gplot(g, nodelabel=["In_world"; levelnames ;"Out_world"])) SecondLevel = Vector{AbstractLevel}() push!(SecondLevel, Rank("SLT", 13, min = 2, max = 2)) push!(SecondLevel, Rank("1LT", 14, min = 3, max = 3)) push!(SecondLevel, Rank("CPN", 15, min = 4, max = 6)) push!(SecondLevel, Rank("CDT", 16, min = 9)) Levels = Array{Vector{AbstractLevel}}(2) Levels[1] = FirstLevel Levels[2] = SecondLevel Paths = ConstructCareerPaths(g, Levels) nbVertices = 0 for i in 1:length(Paths) nbVertices += length(Paths[i].Path) end PlotG = DiGraph(length(Paths) + nbVertices + length(Paths)) NodeLabels = Array{String}(length(Paths) + nbVertices + length(Paths)) i = 1 for path in Paths NodeLabels[i] = "World" i += 1 for status in path.Path NodeLabels[i] = status.AcademicLevel.Name * " " * status.Rank.Name add_edge!(PlotG, i - 1, i) i += 1 end add_edge!(PlotG, i - 1, i) NodeLabels[i] = "World" i += 1 end draw(SVG("CareerPath.svg", 150cm, 150cm), gplot(PlotG, nodelabel=NodeLabels)) draw(PNG("CareerPath.png", 150cm, 150cm), gplot(PlotG, nodelabel=NodeLabels))
{"hexsha": "ebf53f3343815853a6214cffc0a4595a59cb572b", "size": 2062, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "src/TempTestsSmall.jl", "max_stars_repo_name": "Omazaria/CareerPathBeDef", "max_stars_repo_head_hexsha": "da5b1cc1a70382444a348da82725d4cfe670d3c9", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/TempTestsSmall.jl", "max_issues_repo_name": "Omazaria/CareerPathBeDef", "max_issues_repo_head_hexsha": "da5b1cc1a70382444a348da82725d4cfe670d3c9", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/TempTestsSmall.jl", "max_forks_repo_name": "Omazaria/CareerPathBeDef", "max_forks_repo_head_hexsha": "da5b1cc1a70382444a348da82725d4cfe670d3c9", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.4933333333, "max_line_length": 97, "alphanum_fraction": 0.639185257, "num_tokens": 789}
import numpy as np import matplotlib.pyplot as plt x = np.linspace(-1, 1, 50) y1 = 2*x + 1 y2 = x**2 # 生成窗口来显示图像 plt.figure() plt.plot(x, y1) # 生成新的窗口来显示图像 plt.figure(num=3, figsize=(4,4)) l1, = plt.plot(x, y2, label="y=2*x+1") l2, = plt.plot(x, y1, color='r', linewidth=1.0, linestyle='--', label='y=x**2') # 设置x轴显示(-1, 1), y轴显示(-1, 2) plt.xlim((-1, 1)) plt.ylim((-1, 2)) # 设置X轴标签, 设置Y轴标签 plt.xlabel('x') plt.ylabel('y') # 生成新的ticks new_ticks = np.linspace(-1, 2, 5) print(new_ticks) # 更改ticks plt.xticks(new_ticks) plt.yticks([-2, -1.8, -1, 1.22, 3], ['$really bad$', 'bad', 'normal', 'good', 'really good']) #gca ax = plt.gca() # 去除上、右的黑边 ax.spines['right'].set_color('none') ax.spines['top'].set_color('none') # 设置坐标轴上的数字显示的位置,bottom:显示在底部,默认是none ax.xaxis.set_ticks_position('bottom') ax.yaxis.set_ticks_position('left') # 修改坐标轴的位置 ax.spines['bottom'].set_position(('data', 0)) ax.spines['left'].set_position(('data', 0)) # 设置注解 x0 = 1 y0 = 2*x0 + 1 # s,size表示点的大小,默认20 plt.scatter(x0, y0, s=50, color='b') plt.plot([x0, x0], [y0, 0], 'k--', linewidth=2.5) # method 1: plt.annotate(r'$2x+1=%s$' % y0, xy=(x0, y0), xycoords='data', xytext=(+30, -30), textcoords="offset points", fontsize=16, arrowprops=dict(arrowstyle='->', connectionstyle='arc3, rad=.2')) # method 2: plt.text(-0, 1, r'$This\ is\ some\ text. \mu\ \sigma_i\ \alpha_t$', fontdict={'size':16, 'color':'r'}) # 设置ticks透明度 for label in ax.get_xticklabels() + ax.get_yticklabels(): label.set_fontsize(12) label.set_bbox(dict(facecolor='white', edgecolor='None', alpha=0.7)) plt.legend(handles=[l1, l2,],labels=['y=2*x+1', 'y=x**2'], loc='best') plt.show()
{"hexsha": "b1a6dbc33adf0e2236224ba393bba3d762d87e7f", "size": 1658, "ext": "py", "lang": "Python", "max_stars_repo_path": "matplotlib/sample_matplotlib.py", "max_stars_repo_name": "zjhdota/practice", "max_stars_repo_head_hexsha": "de28003e7adf6140dfc06a1ffa3a808e514dbbc0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2018-01-10T11:08:48.000Z", "max_stars_repo_stars_event_max_datetime": "2018-01-10T11:08:48.000Z", "max_issues_repo_path": "matplotlib/sample_matplotlib.py", "max_issues_repo_name": "zjhdota/practice", "max_issues_repo_head_hexsha": "de28003e7adf6140dfc06a1ffa3a808e514dbbc0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2021-01-31T04:21:48.000Z", "max_issues_repo_issues_event_max_datetime": "2021-01-31T04:21:48.000Z", "max_forks_repo_path": "matplotlib/sample_matplotlib.py", "max_forks_repo_name": "zjhdota/practice", "max_forks_repo_head_hexsha": "de28003e7adf6140dfc06a1ffa3a808e514dbbc0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 23.6857142857, "max_line_length": 187, "alphanum_fraction": 0.6344993969, "include": true, "reason": "import numpy", "num_tokens": 679}
import numpy import sklearn.ensemble try: from typing import OrderedDict except ImportError: from typing import MutableMapping as OrderedDict class RandomForestClassifier: def __init__(self, **kwargs): self.clf = sklearn.ensemble.RandomForestClassifier(**kwargs) def __call__(self, raw: numpy.ndarray): assert isinstance(raw, numpy.ndarray) assert len(raw.shape) == 2 assert raw.shape[1] == 1 return self.clf.predict(raw)[:, None] def fit(self, raw: numpy.ndarray, target: numpy.ndarray): assert isinstance(raw, numpy.ndarray) assert len(raw.shape) == 2, raw.shape assert isinstance(target, numpy.ndarray) assert len(target.shape) == 2, target.shape self.clf.fit(raw, target)
{"hexsha": "e45c6b38d8590a09398eef706a41bfb0a79d57a3", "size": 781, "ext": "py", "lang": "Python", "max_stars_repo_path": "bioimageio/sklearn/models.py", "max_stars_repo_name": "k-dominik/python-bioimage-io", "max_stars_repo_head_hexsha": "aecaa3412c31672ce159335db083ee9fb4fca519", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "bioimageio/sklearn/models.py", "max_issues_repo_name": "k-dominik/python-bioimage-io", "max_issues_repo_head_hexsha": "aecaa3412c31672ce159335db083ee9fb4fca519", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "bioimageio/sklearn/models.py", "max_forks_repo_name": "k-dominik/python-bioimage-io", "max_forks_repo_head_hexsha": "aecaa3412c31672ce159335db083ee9fb4fca519", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.0384615385, "max_line_length": 68, "alphanum_fraction": 0.6747759283, "include": true, "reason": "import numpy", "num_tokens": 171}
from numpy import arange from bokeh.plotting import figure, show x = arange(1, 4.5, 0.25) y = 1 / x plot = figure(height=200) plot.circle(x, y, fill_color="blue", size=5) plot.line(x, y, color="darkgrey") plot.xaxis.axis_label = "Resistance" plot.xaxis.ticker = [1, 2, 3, 4] plot.yaxis.axis_label = "Current at 1 V" plot.xaxis.major_label_overrides = { 1: r"$$1\Omega$$", 2: r"$$2\Omega$$", 3: r"$$3\Omega$$", 4: r"$$4\Omega$$", } show(plot)
{"hexsha": "4af6a64f61e29cb76d67da33772cf096304c831f", "size": 464, "ext": "py", "lang": "Python", "max_stars_repo_path": "sphinx/source/docs/user_guide/examples/styling_math_text_latex_tick_labels.py", "max_stars_repo_name": "Suicoleiro/bokeh", "max_stars_repo_head_hexsha": "a212acdf091a7a4df639fa9d443be6ade0018039", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 15193, "max_stars_repo_stars_event_min_datetime": "2015-01-01T05:11:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T19:30:20.000Z", "max_issues_repo_path": "sphinx/source/docs/user_guide/examples/styling_math_text_latex_tick_labels.py", "max_issues_repo_name": "Suicoleiro/bokeh", "max_issues_repo_head_hexsha": "a212acdf091a7a4df639fa9d443be6ade0018039", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 9554, "max_issues_repo_issues_event_min_datetime": "2015-01-01T03:16:54.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T22:59:39.000Z", "max_forks_repo_path": "sphinx/source/docs/user_guide/examples/styling_math_text_latex_tick_labels.py", "max_forks_repo_name": "Suicoleiro/bokeh", "max_forks_repo_head_hexsha": "a212acdf091a7a4df639fa9d443be6ade0018039", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": 4829, "max_forks_repo_forks_event_min_datetime": "2015-01-02T03:35:32.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-30T16:40:26.000Z", "avg_line_length": 19.3333333333, "max_line_length": 44, "alphanum_fraction": 0.6271551724, "include": true, "reason": "from numpy", "num_tokens": 171}
import argparse import numpy as np import pandas as pd from sklearn import preprocessing from sklearn.feature_extraction.text import CountVectorizer from sklearn.model_selection import train_test_split from nltk.tokenize import word_tokenize #this function uses the train data to create a dictionary, which contains words that are found in 100 or more news articles. def build_vocab_map(df): words = {} #this for loop iterates through every sample in the dataframe for x in range(len(df.index)): wordList = df.values[x, 0].split()#for every article, create a list containing every word wl_no_duplicates = [] for word in wordList: #This for loop deletes the duplicate words in a news article if word not in wl_no_duplicates: wl_no_duplicates.append(word) for item in wl_no_duplicates:#makes a dictionary with the number of news articles that contain that word if item not in words: words[item] =1 else: words[item]+=1 #This next part of the code deletes any words from the dictionary that are seen less in less than 100 news articles delete = [key for key, val in words.items() if val<100] for key in delete: del words[key] return words #splits the news data into train and test in order to be pushed into a training model def split_Data(x, y): new_x = x.to_numpy() new_y = y.to_numpy() xTrain, xTest, yTrain, yTest = train_test_split(new_x, new_y, test_size =.3) xTrain = pd.DataFrame(xTrain) xTest = pd.DataFrame(xTest) yTrain = pd.DataFrame(yTrain) yTest = pd.DataFrame(yTest) return xTrain, yTrain, xTest, yTest #transform Text attribute into binary counter attributes. Each word in the dictiony is transformed into an attribute def construct_binary(df, dictionary): vectorizer = CountVectorizer(vocabulary = dictionary.keys(), binary = True) x = vectorizer.fit_transform(df.values[:, 0]) df2 = pd.DataFrame(x.toarray()) return df2 #normalzed the data using min-max scaler def normalize_dataframe(df): x = df.to_numpy() min_max_scaler = preprocessing.MinMaxScaler() df_scaled = min_max_scaler.fit_transform(x) df = pd.DataFrame(df_scaled) return df def main(): parser = argparse.ArgumentParser() #adds parameters for input and output files. these have a "default' name so that no parameters have to be added at the command prompt parser.add_argument("--news", default="news_Stemmed.csv", help="filename of the input data") parser.add_argument("--BINARY_xTrain", default = 'BINARY_xTrain.csv') parser.add_argument("--BINARY_yTrain", default = 'BINARY_yTrain.csv') parser.add_argument("--BINARY_xTest", default = 'BINARY_xTest.csv') parser.add_argument("--BINARY_yTest", default = 'BINARY_yTest.csv') args = parser.parse_args() #converts the file into a pandas dataframe, and fills null values with an empty string news = pd.read_csv(args.news) news = news.fillna("") xTrain, yTrain, xTest, yTest = split_Data(news['text'], news['label']) dictionary = build_vocab_map(xTrain) #create the train and test data for binary counter, and normalize it binary_dataset_train = construct_binary(xTrain, dictionary) binary_dataset_test = construct_binary(xTest, dictionary) binary_dataset_train = normalize_dataframe(binary_dataset_train) binary_dataset_test = normalize_dataframe(binary_dataset_test) #export the train and test dataframes to csv files binary_dataset_train.to_csv(args.BINARY_xTrain, index = False) binary_dataset_test.to_csv(args.BINARY_xTest, index = False) yTrain.to_csv(args.BINARY_yTrain, index = False) yTest.to_csv(args.BINARY_yTest, index = False) if __name__ == '__main__': main()
{"hexsha": "2f65920b601e3fd84da6dd05687ed61affa3a498", "size": 3663, "ext": "py", "lang": "Python", "max_stars_repo_path": "binary_data_creation.py", "max_stars_repo_name": "simonmarty/data-mining-project", "max_stars_repo_head_hexsha": "4801be11c29bea7f05e7b499babf67cc37584098", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-12-03T09:10:52.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-03T09:10:52.000Z", "max_issues_repo_path": "binary_data_creation.py", "max_issues_repo_name": "simonmarty/data-mining-project", "max_issues_repo_head_hexsha": "4801be11c29bea7f05e7b499babf67cc37584098", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "binary_data_creation.py", "max_forks_repo_name": "simonmarty/data-mining-project", "max_forks_repo_head_hexsha": "4801be11c29bea7f05e7b499babf67cc37584098", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-05-24T18:14:01.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-24T18:14:01.000Z", "avg_line_length": 31.852173913, "max_line_length": 134, "alphanum_fraction": 0.754026754, "include": true, "reason": "import numpy", "num_tokens": 870}
#-*- coding:utf-8 -*- import torch from torchvision import transforms import cv2 from PIL import Image, ImageOps import numpy as np class MultiViewDataInjector(): def __init__(self, transform_list): self.transform_list = transform_list def __call__(self, sample): output = [transform(sample).unsqueeze(0) for transform in self.transform_list] output_cat = torch.cat(output, dim=0) return output_cat class GaussianBlur(): def __init__(self, kernel_size, sigma_min=0.1, sigma_max=2.0): self.sigma_min = sigma_min self.sigma_max = sigma_max self.kernel_size = kernel_size def __call__(self, img): sigma = np.random.uniform(self.sigma_min, self.sigma_max) img = cv2.GaussianBlur(np.array(img), (self.kernel_size, self.kernel_size), sigma) return Image.fromarray(img.astype(np.uint8)) class Solarize(): def __init__(self, threshold=128): self.threshold = threshold def __call__(self, sample): return ImageOps.solarize(sample, self.threshold) def get_transform(stage, gb_prob=1.0, solarize_prob=0.): t_list = [] color_jitter = transforms.ColorJitter(0.4, 0.4, 0.2, 0.1) normalize = transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]) if stage in ('train', 'val'): t_list = [ transforms.RandomResizedCrop(224), transforms.RandomHorizontalFlip(), transforms.RandomApply([color_jitter], p=0.8), transforms.RandomGrayscale(p=0.2), transforms.RandomApply([GaussianBlur(kernel_size=23)], p=gb_prob), transforms.RandomApply([Solarize()], p=solarize_prob), transforms.ToTensor(), normalize] elif stage == 'ft': t_list = [ transforms.RandomResizedCrop(224), transforms.RandomHorizontalFlip(), transforms.ToTensor(), normalize] elif stage == 'test': t_list = [ transforms.Resize(256), transforms.CenterCrop(224), transforms.ToTensor(), normalize] transform = transforms.Compose(t_list) return transform
{"hexsha": "7635389fc0335626aa9aec3710d32f29934c0fca", "size": 2222, "ext": "py", "lang": "Python", "max_stars_repo_path": "data/byol_transform.py", "max_stars_repo_name": "SuhongMoon/BYOL-PyTorch", "max_stars_repo_head_hexsha": "fa8eea6c4cc65436aa458a1a48c79fd0d9d46d51", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "data/byol_transform.py", "max_issues_repo_name": "SuhongMoon/BYOL-PyTorch", "max_issues_repo_head_hexsha": "fa8eea6c4cc65436aa458a1a48c79fd0d9d46d51", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "data/byol_transform.py", "max_forks_repo_name": "SuhongMoon/BYOL-PyTorch", "max_forks_repo_head_hexsha": "fa8eea6c4cc65436aa458a1a48c79fd0d9d46d51", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.2698412698, "max_line_length": 90, "alphanum_fraction": 0.6296129613, "include": true, "reason": "import numpy", "num_tokens": 518}
clc; close all %% which one to show? idx = 24; coordIndices = [1,2,3]; imgFig1 = figure(1); set(imgFig1, 'Position', [100 100 1400 900]) % [1 1 width height] subplot(2,2,1); imagesc(imgMat(:,:,:,idx)); axis off image; subplot(2,2,2); imagesc(instanceMaskMat(:,:,:,idx)); axis off image; subplot(2,2,3); A = (predInstanceMaskMat0(:,:,coordIndices,idx) + 1) / 2; imagesc(A); axis off image; %% 3D surface subplot(2,2,4); r = 1; [x,y,z] = sphere(50); x0 = 0; y0 = 0; z0 = 0; x = x*r + x0; y = y*r + y0; z = z*r + z0; % figure lightGrey = 0.7*[1 1 1]; % It looks better if the lines are lighter surface(x,y,z, 'FaceColor', 'none', 'EdgeColor',lightGrey) hold on %% points hold on; points = reshape(predInstanceMaskMat0(:,:,coordIndices,idx), [], 3); points = points'; pointsColor = points - (-1);%min(points(:)); % -1 pointsColor = pointsColor ./ 2;%max(pointsColor(:)); for i = 1:size(points,2) plot3( points(1,i), points(2,i), points(3,i), 's', 'MarkerSize',3, 'MarkerFaceColor', pointsColor(:,i)', 'MarkerEdgeColor', pointsColor(:,i)'); end hold off; axis off square view([1 1 0.75]) % adjust the viewing angle zoom(1.4) %% save result if flagSaveFig export_fig( sprintf('%s/%04d_visualization_single.jpg', saveFolder, i) ); end
{"author": "aimerykong", "repo": "Recurrent-Pixel-Embedding-for-Instance-Grouping", "sha": "748ade6b969c7861c2a9009cd0f0ffb27004677c", "save_path": "github-repos/MATLAB/aimerykong-Recurrent-Pixel-Embedding-for-Instance-Grouping", "path": "github-repos/MATLAB/aimerykong-Recurrent-Pixel-Embedding-for-Instance-Grouping/Recurrent-Pixel-Embedding-for-Instance-Grouping-748ade6b969c7861c2a9009cd0f0ffb27004677c/demo1_tutorial_instance_segmentation/fun4MeanShift/main001_instSeg_proj3Dsphere.m"}
#Hasan Avcı 170401035 from sympy import Symbol,pprint file = open("veriler.txt", "r") data = file.readlines() for i in range(len(data)): data[i] = int(data[i]) def detectPolynominal(m1, m2, m3, m4, m5, m6): if m1 > m6 and m1 > m5 and m1 > m4 and m1 > m3 and m1 > m2: print(str(m1) + " en uygun 1. polinom. \n") return 1 elif m2 > m6 and m2 > m5 and m2 > m4 and m2 > m3: print(str(m2) + " en uygun 2.polinom. \n") return 2 elif m3 > m6 and m3 > m5 and m3 > m4: print(str(m3) + " en uygun 3.polinom. \n") return 3 elif m4 > m6 and m4 > m5: print(str(m4) + " en uygun 4.polinom. \n") return 4 elif m5 > m6: print(str(m5) + " en uygun 5.polinom. \n") return 5 else: print(str(m6) + " en uygun 6.polinom. \n") return 6 def wrtieEquationAndIntegral(polynominal1, polynominal2, polynominal3, polynominal4, polynominal5, polynominal6,a): x = Symbol('x') if(a==1): denklem =polynominal1[1] * x + polynominal1[0] pprint(denklem) elif(a==2): denklem = polynominal2[2] * x ** 2 + polynominal2[1] * x + polynominal2[0] pprint(denklem) elif (a == 3): denklem = polynominal3[3] * x ** 3 + polynominal3[2] * x ** 2 + polynominal3[1] * x + polynominal3[0] pprint(denklem) elif(a==4): denklem = polynominal4[4] * x ** 4 + polynominal4[3] * x ** 3 + polynominal4[2] * x ** 2 \ + polynominal4[1] * x + polynominal4[0] pprint(denklem) elif(a==5): denklem = polynominal5[5] * x ** 5 + polynominal5[4] * x ** 4 + polynominal5[3] * x ** 3\ + polynominal5[2] * x ** 2 +polynominal5[1] * x + polynominal5[0] pprint(denklem) else: denklem = polynominal6[6] * x ** 6 + polynominal6[5] * x ** 5 + polynominal6[4] * x ** 4 \ + polynominal6[3] * x ** 3 +polynominal6[2] * x ** 2 + polynominal6[1] * x +polynominal6[0] pprint(denklem) a = 5 #170401035 b = len(data) deltax = 1 integral = 0 n = int((b - a) / deltax) for i in range(n): integral += deltax * ((denklem.subs({x: a})) + (denklem.subs({x: a + deltax})) )/ 2 a += deltax print("Polinom kullanılarak bulunan integral değeri : ",integral) def interpolation(factor, data): matrix = [] result = [] a = 0 for i in range(factor + 1): line = [] for j in range(factor + 1): total = 0 for k in range(1, len(data) + 1): total += k ** a line.append(total) a += 1 matrix.append(line) a -= factor for i in range(factor + 1): total = 0 for j in range(len(data)): total += data[j] * (j + 1) ** i result.append(total) for i in range(factor, -1, -1): simile = matrix[i][i] for j in range(i - 1, -1, -1): rate = simile / matrix[j][i] result[j] = result[j] * rate - result[i] for k in range(factor + 1): matrix[j][k] = matrix[j][k] * rate - matrix[i][k] for i in range(factor + 1): simile = matrix[i][i] for j in range(i + 1, factor + 1): rate = simile / matrix[j][i] result[j] = result[j] * rate - result[i] for k in range(factor + 1): matrix[j][k] = matrix[j][k] * rate - matrix[i][k] for i in range(factor + 1): result[i] = result[i] / matrix[i][i] y_r = 0 for i in range(len(data)): y_r += data[i] y_r = y_r / len(data) y_rp, y_rr = 0, 0 for i in range(len(data)): z = data[i] y_rp += (data[i] - y_r) ** 2 for j in range(len(result)): z -= result[j] * (i + 1) ** j z = z ** 2 y_rr += z m = ((y_rp - y_rr) / y_rp) ** (1 / 2) return result, m def polinomsuzIntegral(): a = 5 # 170401035 b = len(data) deltax = 1 integral = 0 n = int((b - a) / deltax) for i in range(n-1): integral += deltax * (data[a] + data[a+1]) / 2 a += deltax print("Polinom kullanmadan bulunan integral değeri : ", integral) polynominal1, m1 = interpolation(1, data) polynominal2, m2 = interpolation(2, data) polynominal3, m3 = interpolation(3, data) polynominal4, m4 = interpolation(4, data) polynominal5, m5 = interpolation(5, data) polynominal6, m6 = interpolation(6, data) z=detectPolynominal(m1, m2, m3, m4, m5, m6 ) wrtieEquationAndIntegral(polynominal1, polynominal2, polynominal3, polynominal4, polynominal5, polynominal6,z) polinomsuzIntegral() dosya = open('170401035_yorum.txt', 'w') dosya.write("""Sonuçların farklı çıkmasının sebebi deltax'e verilen değerlerden kaynaklanıyor.Çünkü deltax'e ne kadar küçük değer verirsek grafiğin altındaki alanı daha fazla parçaya böleriz ve bu parçaların grafikten taşan ya da grafik ile arasında kalan boş alanlar daha az olur.Böylece gerçeğe daha yakın bir değer elde ederiz. Polinom kullanmadan ,sadece verileri kullanırken deltax 1 oluyor ama polinomu kullanırken deltax'e 1'den daha küçük bir değer atayabiliriz.Bu yüzdende polinom ile çözülen integral polinomsuza göre gerçeğe daha yakındır. """)
{"hexsha": "ad60904106c4e2de6211f8ed6a7e5e05bc8113f0", "size": 5286, "ext": "py", "lang": "Python", "max_stars_repo_path": "final/170401035.py", "max_stars_repo_name": "yigitcanustek/blm2010", "max_stars_repo_head_hexsha": "2e86dab3fc225a7679b6c660fb01902423476a94", "max_stars_repo_licenses": ["Unlicense"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2020-05-20T19:25:37.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-01T21:26:54.000Z", "max_issues_repo_path": "final/170401035.py", "max_issues_repo_name": "yigitcanustek/blm2010", "max_issues_repo_head_hexsha": "2e86dab3fc225a7679b6c660fb01902423476a94", "max_issues_repo_licenses": ["Unlicense"], "max_issues_count": 15, "max_issues_repo_issues_event_min_datetime": "2020-05-18T14:53:18.000Z", "max_issues_repo_issues_event_max_datetime": "2020-06-26T09:20:50.000Z", "max_forks_repo_path": "final/170401035.py", "max_forks_repo_name": "yigitcanustek/blm2010", "max_forks_repo_head_hexsha": "2e86dab3fc225a7679b6c660fb01902423476a94", "max_forks_repo_licenses": ["Unlicense"], "max_forks_count": 155, "max_forks_repo_forks_event_min_datetime": "2020-04-28T16:14:38.000Z", "max_forks_repo_forks_event_max_datetime": "2020-06-26T09:46:59.000Z", "avg_line_length": 27.53125, "max_line_length": 116, "alphanum_fraction": 0.5603480893, "include": true, "reason": "from sympy", "num_tokens": 1852}
from sklearn.datasets import load_boston from tqdm import tqdm from sklearn.utils import shuffle, resample import numpy as np from xhp_flow.nn.node import Placeholder,Linear,Sigmoid,ReLu,Leakrelu,Elu,Tanh,LSTM from xhp_flow.optimize.optimize import toplogical_sort,run_steps,forward,save_model,load_model,Auto_update_lr,Visual_gradient,Grad_Clipping_Disappearance,SUW,\ SGD,\ Momentum,\ Adagrad,\ RMSProp,\ AdaDelta,\ Adam,\ AdaMax,\ Nadam,\ NadaMax from xhp_flow.loss.loss import MSE,EntropyCrossLossWithSoftmax import matplotlib.pyplot as plt import torch from glob import glob from data_prepare_for_many import * torch.manual_seed(1) MAX_LENGTH = 100 torch.cuda.set_device(0) device = torch.device("cuda" if torch.cuda.is_available() else "cpu") if torch.cuda.is_available(): print('ok') length = 10 predict_length = 1 batch_size = 512 file_path_train = np.array(glob('data/train/*')) # file_path_test = np.array(glob('data/test/*')) # file_path_valid = np.array(glob('data/valid/*')) # Training_generator1, Test, Valid, WholeSet= get_dataloader(batch_size,length,predict_length) Training_generator, WholeSet_train = get_dataloader(batch_size, length, predict_length, file_path_train, 'train') x1, y = next(iter(Training_generator)) input_x, y = x1.numpy(), y.numpy() class LSTMtest(): def __init__(self, input_size=8, hidden_size=256, output_size=1): self.x, self.y = Placeholder(name='x', is_trainable=False), Placeholder(name='y', is_trainable=False) self.wf, self.bf = Placeholder(name='wf'), Placeholder(name='bf') self.wi, self.bi = Placeholder(name='wi'), Placeholder(name='bi') self.wc, self.bc = Placeholder(name='wc'), Placeholder(name='bc') self.wo, self.bo = Placeholder(name='wo'), Placeholder(name='bo') self.w0, self.b0 = Placeholder(name='w0'), Placeholder(name='b0') self.w1, self.b1 = Placeholder(name='w1'), Placeholder(name='b1') self.w2, self.b2 = Placeholder(name='w2'), Placeholder(name='b2') self.linear0 = Linear(self.x, self.w0, self.b0, name='linear0') self.lstm = LSTM(self.linear0, self.wf, self.wi, self.wc, self.wo, self.bf, self.bi, self.bc, self.bo, input_size, hidden_size, name='LSTM') self.linear1 = Linear(self.lstm, self.w1, self.b1, name='linear1') self.output = ReLu(self.linear1, name='Elu') self.y_pre = Linear(self.output, self.w2, self.b2, name='output_pre') self.MSE_loss = MSE(self.y_pre, self.y, name='MSE') # 初始化数据结构 self.feed_dict = { self.x: input_x, self.y: y, self.w0: np.random.rand(input_x.shape[2], input_size), self.b0: np.zeros(input_size), self.wf: np.random.rand(input_size + hidden_size, hidden_size), self.bf: np.zeros(hidden_size), self.wi: np.random.rand(input_size + hidden_size, hidden_size), self.bi: np.zeros(hidden_size), self.wc: np.random.rand(input_size + hidden_size, hidden_size), self.bc: np.zeros(hidden_size), self.wo: np.random.rand(input_size + hidden_size, hidden_size), self.bo: np.zeros(hidden_size), self.w1: np.random.rand(hidden_size, hidden_size), self.b1: np.zeros(hidden_size), self.w2: np.random.rand(hidden_size, output_size), self.b2: np.zeros(output_size), } # In[ ]: lstm = LSTMtest(16, 16, 1) def train(model, train_data, epoch=6, learning_rate=1e-3): # 开始训练 losses = [] loss_min = np.inf graph_sort_lstm = toplogical_sort(model.feed_dict) # 拓扑排序 optim = Adam(graph_sort_lstm) update_lr = Auto_update_lr(lr=learning_rate, alpha=0.1, patiences=20, print_=True) for e in range(epoch): for X, Y in train_data: X, Y = X.numpy(), Y.numpy() model.x.value = X model.y.value = Y run_steps(graph_sort_lstm) # if model.y_pre.value is not None: # print(model.y_pre.value.shape,Y.shape) learning_rate = update_lr.lr optim.update(learning_rate=learning_rate) Visual_gradient(model) Grad_Clipping_Disappearance(model, 5) loss = model.MSE_loss.value losses.append(loss) update_lr.updata(np.mean(np.mean(losses))) print("epoch:{}/{},loss:{:.6f}".format(e,epoch,np.mean(losses))) if np.mean(losses) < loss_min: print('loss is {:.6f}, is decreasing!! save moddel'.format(np.mean(losses))) save_model("model/lstm.xhp", model) loss_min = np.mean(losses) print('min loss:',loss_min) plt.plot(losses) plt.savefig("image/lstm_loss.png") plt.show() train(lstm, Training_generator, 1000,0.01)
{"hexsha": "fe98652eabeaf0e0efb57589c4365ddd56e2dfda", "size": 4791, "ext": "py", "lang": "Python", "max_stars_repo_path": "examples/LSTM.py", "max_stars_repo_name": "xhpxiaohaipeng/xhp_flow_frame", "max_stars_repo_head_hexsha": "903b67bee0fa56373ce8751ca604b601ab8be8fd", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2021-02-05T12:59:48.000Z", "max_stars_repo_stars_event_max_datetime": "2021-05-13T06:37:33.000Z", "max_issues_repo_path": "examples/LSTM.py", "max_issues_repo_name": "xhpxiaohaipeng/xhp_flow_frame", "max_issues_repo_head_hexsha": "903b67bee0fa56373ce8751ca604b601ab8be8fd", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/LSTM.py", "max_forks_repo_name": "xhpxiaohaipeng/xhp_flow_frame", "max_forks_repo_head_hexsha": "903b67bee0fa56373ce8751ca604b601ab8be8fd", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.3017241379, "max_line_length": 159, "alphanum_fraction": 0.655604258, "include": true, "reason": "import numpy", "num_tokens": 1247}
""" NE method: naively combine AttrPure and DeepWalk (AttrComb) by Chengbin Hou 2018 """ import numpy as np from . import node2vec from .utils import dim_reduction class ATTRCOMB(object): def __init__(self, graph, dim, comb_method='concat', comb_with='deepWalk', number_walks=10, walk_length=80, window=10, workers=8): self.g = graph self.dim = dim self.number_walks = number_walks self.walk_length = walk_length self.window = window self.workers = workers print("Learning representation...") self.vectors = {} print('attr naively combined method ', comb_method, '=====================') if comb_method == 'concat': print('comb_method == concat by default; dim/2 from attr and dim/2 from nrl.............') attr_embeddings = self.train_attr(dim=int(self.dim/2)) nrl_embeddings = self.train_nrl(dim=int(self.dim/2), comb_with='deepWalk') embeddings = np.concatenate((attr_embeddings, nrl_embeddings), axis=1) print('shape of embeddings', embeddings.shape) elif comb_method == 'elementwise-mean': print('comb_method == elementwise-mean.............') attr_embeddings = self.train_attr(dim=self.dim) nrl_embeddings = self.train_nrl(dim=self.dim, comb_with='deepWalk') # we may try deepWalk, node2vec, line and etc... embeddings = np.add(attr_embeddings, nrl_embeddings)/2.0 print('shape of embeddings', embeddings.shape) elif comb_method == 'elementwise-max': print('comb_method == elementwise-max.............') attr_embeddings = self.train_attr(dim=self.dim) nrl_embeddings = self.train_nrl(dim=self.dim, comb_with='deepWalk') # we may try deepWalk, node2vec, line and etc... embeddings = np.zeros(shape=(attr_embeddings.shape[0], attr_embeddings.shape[1])) for i in range(attr_embeddings.shape[0]): # size(attr_embeddings) = size(nrl_embeddings) for j in range(attr_embeddings.shape[1]): if attr_embeddings[i][j] > nrl_embeddings[i][j]: embeddings[i][j] = attr_embeddings[i][j] else: embeddings[i][j] = nrl_embeddings[i][j] print('shape of embeddings', embeddings.shape) else: print('error, no comb_method was found....') exit(0) for key, ind in self.g.look_up_dict.items(): self.vectors[key] = embeddings[ind] def train_attr(self, dim): X = self.g.get_attr_mat() X_compressed = dim_reduction(X, dim=dim, method='svd') # svd or pca for dim reduction print('X_compressed shape: ', X_compressed.shape) return np.array(X_compressed) # n*dim matrix, each row corresponding to node ID stored in graph.look_back_list def train_nrl(self, dim, comb_with): print('attr naively combined with ', comb_with, '=====================') if comb_with == 'deepWalk': model = node2vec.Node2vec(graph=self.g, dim=dim, path_length=self.walk_length, # do not use self.dim here num_paths=self.number_walks, workers=self.workers, window=self.window, dw=True) nrl_embeddings = [] for key in self.g.look_back_list: nrl_embeddings.append(model.vectors[key]) return np.array(nrl_embeddings) elif comb_with == 'node2vec': model = node2vec.Node2vec(graph=self.g, path_length=80, num_paths=self.number_walks, dim=dim, workers=4, p=0.8, q=0.8, window=10) nrl_embeddings = [] for key in self.g.look_back_list: nrl_embeddings.append(model.vectors[key]) return np.array(nrl_embeddings) else: print('error, no comb_with was found....') print('to do.... line, grarep, and etc...') exit(0) def save_embeddings(self, filename): fout = open(filename, 'w') node_num = len(self.vectors.keys()) fout.write("{} {}\n".format(node_num, self.dim)) for node, vec in self.vectors.items(): fout.write("{} {}\n".format(node, ' '.join([str(x) for x in vec]))) fout.close()
{"hexsha": "954306fac28279f0a092e57cf7e28328af9758e0", "size": 4399, "ext": "py", "lang": "Python", "max_stars_repo_path": "src/libnrl/attrcomb.py", "max_stars_repo_name": "houchengbin/OpenANE", "max_stars_repo_head_hexsha": "d608cb3ece77f45f417d85aad257767ac209f206", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 36, "max_stars_repo_stars_event_min_datetime": "2018-12-06T17:25:28.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-16T11:22:50.000Z", "max_issues_repo_path": "src/libnrl/attrcomb.py", "max_issues_repo_name": "houchengbin/OpenANE", "max_issues_repo_head_hexsha": "d608cb3ece77f45f417d85aad257767ac209f206", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 4, "max_issues_repo_issues_event_min_datetime": "2020-08-31T01:41:56.000Z", "max_issues_repo_issues_event_max_datetime": "2021-01-29T06:34:26.000Z", "max_forks_repo_path": "src/libnrl/attrcomb.py", "max_forks_repo_name": "houchengbin/OpenANE", "max_forks_repo_head_hexsha": "d608cb3ece77f45f417d85aad257767ac209f206", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 7, "max_forks_repo_forks_event_min_datetime": "2019-02-24T18:26:00.000Z", "max_forks_repo_forks_event_max_datetime": "2021-05-30T05:44:22.000Z", "avg_line_length": 45.3505154639, "max_line_length": 134, "alphanum_fraction": 0.5878608775, "include": true, "reason": "import numpy", "num_tokens": 992}
import rospy import ros_numpy import numpy as np import copy import json import os import sys import torch import time from std_msgs.msg import Header import sensor_msgs.point_cloud2 as pc2 from sensor_msgs.msg import PointCloud2, PointField from jsk_recognition_msgs.msg import BoundingBox, BoundingBoxArray from pyquaternion import Quaternion from det3d import __version__, torchie from det3d.models import build_detector from det3d.torchie import Config from det3d.core.input.voxel_generator import VoxelGenerator def yaw2quaternion(yaw: float) -> Quaternion: return Quaternion(axis=[0,0,1], radians=yaw) def get_annotations_indices(types, thresh, label_preds, scores): indexs = [] annotation_indices = [] for i in range(label_preds.shape[0]): if label_preds[i] == types: indexs.append(i) for index in indexs: if scores[index] >= thresh: annotation_indices.append(index) return annotation_indices def remove_low_score_nu(image_anno, thresh): img_filtered_annotations = {} label_preds_ = image_anno["label_preds"].detach().cpu().numpy() scores_ = image_anno["scores"].detach().cpu().numpy() car_indices = get_annotations_indices(0, 0.4, label_preds_, scores_) truck_indices = get_annotations_indices(1, 0.4, label_preds_, scores_) construction_vehicle_indices = get_annotations_indices(2, 0.4, label_preds_, scores_) bus_indices = get_annotations_indices(3, 0.3, label_preds_, scores_) trailer_indices = get_annotations_indices(4, 0.4, label_preds_, scores_) barrier_indices = get_annotations_indices(5, 0.4, label_preds_, scores_) motorcycle_indices = get_annotations_indices(6, 0.15, label_preds_, scores_) bicycle_indices = get_annotations_indices(7, 0.15, label_preds_, scores_) pedestrain_indices = get_annotations_indices(8, 0.1, label_preds_, scores_) traffic_cone_indices = get_annotations_indices(9, 0.1, label_preds_, scores_) for key in image_anno.keys(): if key == 'metadata': continue img_filtered_annotations[key] = ( image_anno[key][car_indices + pedestrain_indices + bicycle_indices + bus_indices + construction_vehicle_indices + traffic_cone_indices + trailer_indices + barrier_indices + truck_indices ]) return img_filtered_annotations class Processor_ROS: def __init__(self, config_path, model_path): self.points = None self.config_path = config_path self.model_path = model_path self.device = None self.net = None self.voxel_generator = None self.inputs = None def initialize(self): self.read_config() def read_config(self): config_path = self.config_path cfg = Config.fromfile(self.config_path) self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu") self.net = build_detector(cfg.model, train_cfg=None, test_cfg=cfg.test_cfg) self.net.load_state_dict(torch.load(self.model_path)["state_dict"]) self.net = self.net.to(self.device).eval() self.range = cfg.voxel_generator.range self.voxel_size = cfg.voxel_generator.voxel_size self.max_points_in_voxel = cfg.voxel_generator.max_points_in_voxel self.max_voxel_num = cfg.voxel_generator.max_voxel_num self.voxel_generator = VoxelGenerator( voxel_size=self.voxel_size, point_cloud_range=self.range, max_num_points=self.max_points_in_voxel, max_voxels=self.max_voxel_num, ) def run(self, points): t_t = time.time() print(f"input points shape: {points.shape}") num_features = 5 self.points = points.reshape([-1, num_features]) self.points[:, 4] = 0 # timestamp value voxels, coords, num_points = self.voxel_generator.generate(self.points) num_voxels = np.array([voxels.shape[0]], dtype=np.int64) grid_size = self.voxel_generator.grid_size coords = np.pad(coords, ((0, 0), (1, 0)), mode='constant', constant_values = 0) voxels = torch.tensor(voxels, dtype=torch.float32, device=self.device) coords = torch.tensor(coords, dtype=torch.int32, device=self.device) num_points = torch.tensor(num_points, dtype=torch.int32, device=self.device) num_voxels = torch.tensor(num_voxels, dtype=torch.int32, device=self.device) self.inputs = dict( voxels = voxels, num_points = num_points, num_voxels = num_voxels, coordinates = coords, shape = [grid_size] ) torch.cuda.synchronize() t = time.time() with torch.no_grad(): outputs = self.net(self.inputs, return_loss=False)[0] # print(f"output: {outputs}") torch.cuda.synchronize() print(" network predict time cost:", time.time() - t) outputs = remove_low_score_nu(outputs, 0.45) boxes_lidar = outputs["box3d_lidar"].detach().cpu().numpy() print(" predict boxes:", boxes_lidar.shape) scores = outputs["scores"].detach().cpu().numpy() types = outputs["label_preds"].detach().cpu().numpy() boxes_lidar[:, -1] = -boxes_lidar[:, -1] - np.pi / 2 print(f" total cost time: {time.time() - t_t}") return scores, boxes_lidar, types def get_xyz_points(cloud_array, remove_nans=True, dtype=np.float): ''' ''' if remove_nans: mask = np.isfinite(cloud_array['x']) & np.isfinite(cloud_array['y']) & np.isfinite(cloud_array['z']) cloud_array = cloud_array[mask] points = np.zeros(cloud_array.shape + (5,), dtype=dtype) points[...,0] = cloud_array['x'] points[...,1] = cloud_array['y'] points[...,2] = cloud_array['z'] return points def xyz_array_to_pointcloud2(points_sum, stamp=None, frame_id=None): ''' Create a sensor_msgs.PointCloud2 from an array of points. ''' msg = PointCloud2() if stamp: msg.header.stamp = stamp if frame_id: msg.header.frame_id = frame_id msg.height = 1 msg.width = points_sum.shape[0] msg.fields = [ PointField('x', 0, PointField.FLOAT32, 1), PointField('y', 4, PointField.FLOAT32, 1), PointField('z', 8, PointField.FLOAT32, 1) # PointField('i', 12, PointField.FLOAT32, 1) ] msg.is_bigendian = False msg.point_step = 12 msg.row_step = points_sum.shape[0] msg.is_dense = int(np.isfinite(points_sum).all()) msg.data = np.asarray(points_sum, np.float32).tostring() return msg def rslidar_callback(msg): t_t = time.time() arr_bbox = BoundingBoxArray() msg_cloud = ros_numpy.point_cloud2.pointcloud2_to_array(msg) np_p = get_xyz_points(msg_cloud, True) print(" ") scores, dt_box_lidar, types = proc_1.run(np_p) if scores.size != 0: for i in range(scores.size): bbox = BoundingBox() bbox.header.frame_id = msg.header.frame_id bbox.header.stamp = rospy.Time.now() q = yaw2quaternion(float(dt_box_lidar[i][8])) bbox.pose.orientation.x = q[1] bbox.pose.orientation.y = q[2] bbox.pose.orientation.z = q[3] bbox.pose.orientation.w = q[0] bbox.pose.position.x = float(dt_box_lidar[i][0]) bbox.pose.position.y = float(dt_box_lidar[i][1]) bbox.pose.position.z = float(dt_box_lidar[i][2]) bbox.dimensions.x = float(dt_box_lidar[i][4]) bbox.dimensions.y = float(dt_box_lidar[i][3]) bbox.dimensions.z = float(dt_box_lidar[i][5]) bbox.value = scores[i] bbox.label = int(types[i]) arr_bbox.boxes.append(bbox) print("total callback time: ", time.time() - t_t) arr_bbox.header.frame_id = msg.header.frame_id arr_bbox.header.stamp = msg.header.stamp if len(arr_bbox.boxes) is not 0: pub_arr_bbox.publish(arr_bbox) arr_bbox.boxes = [] else: arr_bbox.boxes = [] pub_arr_bbox.publish(arr_bbox) if __name__ == "__main__": global proc ## CenterPoint config_path = 'configs/centerpoint/nusc_centerpoint_pp_02voxel_circle_nms_demo.py' model_path = 'models/last.pth' proc_1 = Processor_ROS(config_path, model_path) proc_1.initialize() rospy.init_node('centerpoint_ros_node') sub_lidar_topic = [ "/velodyne_points", "/top/rslidar_points", "/points_raw", "/lidar_protector/merged_cloud", "/merged_cloud", "/lidar_top", "/roi_pclouds"] sub_ = rospy.Subscriber(sub_lidar_topic[5], PointCloud2, rslidar_callback, queue_size=1, buff_size=2**24) pub_arr_bbox = rospy.Publisher("pp_boxes", BoundingBoxArray, queue_size=1) print("[+] CenterPoint ros_node has started!") rospy.spin()
{"hexsha": "b514bf323bb801b9fdd15d38ea3182afcb24dee4", "size": 9443, "ext": "py", "lang": "Python", "max_stars_repo_path": "tools/single_infernece_ros.py", "max_stars_repo_name": "xyupeng/CenterPoint", "max_stars_repo_head_hexsha": "091f4245da1c1b6b9b2f057b4256e415d983ed1b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1124, "max_stars_repo_stars_event_min_datetime": "2020-06-22T00:48:18.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T22:03:35.000Z", "max_issues_repo_path": "tools/single_infernece_ros.py", "max_issues_repo_name": "xyupeng/CenterPoint", "max_issues_repo_head_hexsha": "091f4245da1c1b6b9b2f057b4256e415d983ed1b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 290, "max_issues_repo_issues_event_min_datetime": "2020-06-23T01:29:04.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-29T16:27:32.000Z", "max_forks_repo_path": "tools/single_infernece_ros.py", "max_forks_repo_name": "xyupeng/CenterPoint", "max_forks_repo_head_hexsha": "091f4245da1c1b6b9b2f057b4256e415d983ed1b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 326, "max_forks_repo_forks_event_min_datetime": "2020-06-22T01:48:10.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T08:15:08.000Z", "avg_line_length": 37.1771653543, "max_line_length": 109, "alphanum_fraction": 0.6201419041, "include": true, "reason": "import numpy", "num_tokens": 2224}
#!/usr/bin/python # -*- coding utf-8 -*- # # Hyperbel - Klasse von agla # # # This file is part of agla # # # Copyright (c) 2019 Holger Böttcher [email protected] # # # Licensed under the Apache License, Version 2.0 (the "License") # you may not use this file except in compliance with the License # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import importlib import numpy as np import matplotlib.pyplot as plt from IPython.display import display, Math from sympy.core.sympify import sympify from sympy.core.containers import Tuple from sympy.simplify.simplify import nsimplify, simplify from sympy.core.symbol import Symbol from sympy import sqrt, sin, cos, tan, sinh, cosh from sympy.core.evalf import N from sympy.printing import latex from agla.lib.objekte.basis import AglaObjekt from agla.lib.objekte.vektor import Vektor, v, X from agla.lib.objekte.abbildung import Abbildung from agla.lib.objekte.k2o import K2O from agla.lib.objekte.ausnahmen import * from agla.lib.funktionen.funktionen import (acosg, is_zahl, mit_param, ja, Ja, nein, Nein, mit, ohne, sing, cosg, tang, Gleichung) from agla.lib.funktionen.graf_funktionen import rgb2hex from agla.lib.objekte.umgebung import UMG import agla # Hyperbel - Klasse # -------------- class Hyperbel(AglaObjekt): """ Hyperbel in der Ebene **Erzeugung** Hyperbel ( */[ mitte, ] a, b )* ) **Parameter** *mitte* : Mittelpunkt; Ursprung, wenn weggelassen *a, b* : Halbachsen """ def __new__(cls, *args, **kwargs): if kwargs.get("h") in (1, 2, 3): hyperbel_hilfe(kwargs["h"]) return try: if len(args) == 2: a, b = args mitte = Vektor(0, 0) elif len(args) == 3: mitte, a, b = args else: txt = "2 Halbachsen oder Mittelpunkt und 2 Halbachsen angeben" raise AglaError(txt) if not isinstance(mitte, Vektor): raise AglaError("für Mittelpunkt Punkt der Ebene angeben") if mitte.dim != 2: raise AglaError("für Mittelpunkt Punkt der Ebene angeben") if not is_zahl(a) or not is_zahl(b): raise AglaError("für die Halbachsen Zahlen angeben") if not mit_param(a) and not mit_param(b): if a < 0 or b < 0: raise AglaError("2 positive Zahlen angeben") try: a, b = nsimplify(a), nsimplify(b) except RecursionError: pass return AglaObjekt.__new__(cls, mitte, a, b) except AglaError as e: print('agla:', str(e)) return def __str__(self): par = self.sch_par if len(par) > 0: ss = str([el for el in par]).replace('[', '') ss = ss.replace(']', '') return "Hyperbelnschar(" + ss + ")" return "Hyperbel" # Eigenschaften + Methoden # ------------------------ @property def dim(self): """Dimension""" return self.args[0].dim @property def mitte(self): """Mittelpunkt""" return self.args[0] @property def a(self): """Erste Halbachse""" return self.args[1] @property def b(self): """Zweite Halbachse""" return self.args[2] @property def asympt(self): """Asymptoten""" m, a, b = self.args Gerade = importlib.import_module('agla.lib.objekte.gerade').Gerade return Gerade(b/a, -1, -b/a*m.x + m.y), Gerade(-b/a, -1, b/a*m.x + m.y) @property def sch_par(self): """Scharparameter""" args = self.args ret = args[0].free_symbols if mit_param(args[1]): ret = ret.union(args[1].free_symbols) if mit_param(args[2]): ret = ret.union(args[2].free_symbols) return ret schPar = sch_par @property def lin_exz(self): """Lineare Exzentrizität""" return sqrt(self.a**2 + self.b**2) e = lin_exz linExz = lin_exz @property def brenn_ger(self): """Leit- / Brenngeraden""" Gerade = importlib.import_module('agla.lib.objekte.gerade').Gerade g1 = Gerade(1, 0, -self.mitte.x - self.a**2 / self.e) g2 = Gerade(1, 0, -self.mitte.x + self.a**2 / self.e) return g1, g2 brennGer = brenn_ger leit_ger = brenn_ger leitGer = brenn_ger @property def f1(self): """Erster Brennpunkt""" return Vektor(self.mitte.x + self.e, self.mitte.y) F1 = f1 @property def f2(self): """Zweiter Brennpunkt""" return Vektor(self.mitte.x - self.e, self.mitte.y) F2 = f2 @property def brenn_punkt(self): """Brennpunkte""" return self.f1, self.f2 brennPunkt = brenn_punkt @property def num_exz(self): """Nummerische Exzentrizität""" return simplify(self.e / self.a) eps = num_exz numExz = num_exz @property def mitte(self): """Mittelpunkt""" return self.args[0] @property def gleich(self): """Gleichung; nur zur Ausgabe""" m, a, b = self.args x, y = Symbol('x'), Symbol('y') x, y = latex((x - m.x)**2), latex((y - m.y)**2) a, b = latex(a**2), latex(b**2) lat = '\\frac{' + x + '}{' + a + '}' + '-' + '\\frac{' + y + \ '}{' + b + '}' + '=1' return display(Math(lat)) def gleich_(self, *punkt, **kwargs): """Gleichung; zugehörige Methode""" if kwargs.get('h'): print("\nBei Einsetzen eines Punktes Auswertung der Gleichung in diesem\n") print("Zusatz g=ja Bereitstellung der Gleichung als Gleichung-Objekt\n") return x, y = Symbol('x'), Symbol('y') m, a, b = self.args gl = Gleichung((x - m.x)**2 / a**2 - (y - m.y)**2 / b**2, 1) if kwargs.get('g'): return gl if not punkt: self.gleich return if len(punkt) != 1: print("agla: einen Punkt der Ebene angeben") return punkt = punkt[0] if not (isinstance(punkt, Vektor) and punkt.dim == 2): print("agla: einen Punkt der Ebene angeben") return gl = gl.lhs if bool(simplify(gl.subs({x:punkt.x, y:punkt.y})) == 1): lat = latex('\\text{die Gleichung ist erfüllt}') else: lat = latex('\\text{die Gleichung ist nicht erfüllt}') return display(Math(lat)) Gleich = gleich_ @property def in_kurve(self): """Konvertierung in Kurve""" m, a, b = self.args t = Symbol("t") p1 = Vektor(a*cosh(t), b*sinh(t)) + m p2 = Vektor(-a*cosh(t), b*sinh(t)) + m Kurve = importlib.import_module('agla.lib.objekte.kurve').Kurve return Kurve(p1, (t, -100, 100)), Kurve(p2, (t, -100, 100)) # (getrennte Zweige rechts und links) inKurve = in_kurve @property def is_schar(self): """Test auf Schar""" return len(self.sch_par) == 1 isSchar = is_schar @property def prg(self): """Parametergleichung; nur zur Ausgabe""" t, x, y = Symbol('t'), Symbol('x'), Symbol('y') X = Vektor(x, y) m, a, b = self.args vv = Vektor(a/cos(t), b*tan(t)) if m == Vektor(0, 0): lat = latex(X) + '=' + latex(vv) else: lat = latex(X) + '=' + latex(vv) + '+' + latex(m) return display(Math(lat)) @property def prg_hf(self): """Parametergleichung anhand von Hyperbelfunktionen; nur zur Ausgabe""" t, x, y = Symbol('t'), Symbol('x'), Symbol('y') X = Vektor(x, y) m, a, b = self.args p1 = Vektor(a*cosh(t), b*sinh(t)) p2 = Vektor(-a*cosh(t), b*sinh(t)) if m == Vektor(0, 0): lat1, lat2 = latex(X) + '=' + latex(p1), latex(X) + '=' + latex(p2) else: lat1 = latex(X) + '=' + latex(p1) + '+' + latex(m) lat2 = latex(X) + '=' + latex(p2) + '+' + latex(m) display(Math(lat1)), display(Math(lat2)) # 2 Zweige prgHf = prg_hf @property def prg_rf(self): """Parametergleichung anhand von rationalen Funktionen; nur zur Ausgabe""" t, x, y = Symbol('t'), Symbol('x'), Symbol('y') X = Vektor(x, y) m, a, b = self.args p1 = Vektor(a*(t**2+1)/(2*t), b*(t**2-1)/(2*t)) p2 = Vektor((-1)*p1.x, p1.y) if m == Vektor(0, 0): lat1, lat2 = latex(X) + '=' + latex(p1), latex(X) + '=' + latex(p2) else: lat1 = latex(X) + '=' + latex(p1) + '+' + latex(m) lat2 = latex(X) + '=' + latex(p2) + '+' + latex(m) display(Math(lat1)), display(Math(lat2)) # 2 Zweige prgRf = prg_rf def pkt(self, *par_wert, **kwargs): """Hyperbelpunkt""" if kwargs.get('h'): print("\nPunkt der Hyperbel (anhand der Parametergleichung prg)\n") print("Aufruf hyperbel . pkt( /[ wert ] )\n") print(" hyperbel Hyperbel") print(" wert Wert des Hyperbelparameters (in Radian)\n") print("Rückgabe bei Angabe eines Parameterwertes:") print(" Hyperbelpunkt, der zu diesem Wert gehört") print(" bei leerer Argumentliste oder freiem Bezeichner:") print(" allgemeiner Punkt der Hyperbel\n") return t = Symbol("t") m, a, b = self.args if not par_wert: p = self.mitte + Vektor(a/cos(t), b*tan(t)) return p if len(par_wert) == 1: pw = sympify(par_wert[0]) if is_zahl(pw): p = self.mitte + Vektor(a/cos(pw), b*tan(pw)).einfach return p print("agla: Zahl angeben") return print("agla: einen Parameterwert angeben") return def sch_el(self, *wert, **kwargs): """Element einer Schar von Hyperbeln; für einen Parameter""" if not self.is_schar or len(self.sch_par) > 1: print("agla: keine Schar mit einem Parameter") return if kwargs.get('h'): print("\nElement einer Hyperbelschar\n") print("Aufruf hyperbel . sch_el( wert )\n") print(" hyperbel Hyperbel") print(" wert Wert des Scharparameters") print("\nEs ist nur ein Scharparameter zugelassen\n") return if len(wert) != 1: print("agla: einen Wert für den Scharparameter angeben") return p = Tuple(*self.sch_par)[0] wert = sympify(*wert) if not is_zahl(wert): print('agla: für den Scharparameter Zahl oder freien Parameter angeben') return try: wert = nsimplify(wert) except RecursionError: pass m, a, b = self.args if p in m.sch_par: m = m.sch_el(wert) a = self.a.subs(p, wert) b = self.b.subs(p, wert) if not mit_param(a) and not mit_param(b) and (a < 0 or b < 0): print('agla: für die Halbachsen 2 positive Zahlen angeben') return return Hyperbel(m, a, b) schEl = sch_el def tangente(self, *args, **kwargs): """Tangente""" if kwargs.get('h'): print("\nTangente in einem Hyperbelpunkt\n") print("Aufruf hyperbel . tangente( punkt )\n") print(" hyperbel Hyperbel") print(" punkt Punkt der Hyperbel\n") return if len(args) != 1: print("agla: einen Punkt angeben") return p = args[0] if not isinstance(p, Vektor): print("agla: einen Punkt der Ebene angeben") return if p.dim != 2: print("agla: einen Punkt der Ebene angeben") return x, y = Symbol('x'), Symbol('y') m, a, b = self.args gl = Gleichung((x - m.x)**2 / a**2 - (y - m.y)**2 / b**2, 1) if simplify(gl.lhs.subs({x:p.x, y:p.y})) != 1: print("agla: Punkt der Hyperbel angeben") return Gerade = importlib.import_module('agla.lib.objekte.gerade').Gerade ta = Gerade((p.x-m.x) / a**2, -(p.y-m.y) / b**2, \ -1 -m.x*(p.x-m.x)/a**2 +m.y*(p.y-m.y)/b**2) return ta def bild(self, *abb, **kwargs): """Bild bei einer Abbildung""" if kwargs.get('h'): print("\nBild der Hyperbel bei einer Abbildung\n") print("Aufruf hyperbel . bild( abb )\n") print(" hyperbel Hyperbel") print(" abb Abbildung der Ebene R^2\n") print("Es wird ein Kurve2terOrdnung-Objekt erzeugt\n") return if len(abb) != 1: print("agla: eine Abbildung angeben") return abb = abb[0] if not (isinstance(abb, Abbildung) and abb.dim == 2): print("agla: eine Abbildung der Ebene angeben") return a, b, m = self.a, self.b, self.mitte x, y, U, V = Symbol('x'), Symbol('y'), Symbol('U'), Symbol('V') gl = (x - m.x)**2/a**2 - (y - m.y)**2/b**2 - 1 uv = abb.matrix.inverse * (Vektor(U, V) - abb.versch) gl = gl.subs({x:uv.x, y:uv.y}) gl = gl.subs({U:x, V:y}) gls = str(gl) return K2O(gls) def graf(self, spez, **kwargs): """Grafikelement für Hyperbel""" from numpy import (pi, sqrt, sin, cos, tan, exp, log, sinh, cosh, tanh, arcsin, arccos, arctan, arcsinh, arccosh, arctanh) ln = log lin_farbe = UMG._default_lin_farbe2 if spez[1] == 'default' else spez[1] lin_staerke = UMG._default_lin_staerke2 if spez[2] == 'default' else spez[2][3] lin_farbe = rgb2hex(lin_farbe) anim = False if spez[3]: anim = True aber = spez[3] if not anim: m, a, b = self.args x, y = Symbol('x'), Symbol('y') gl = N((x - m.x)**2/a**2 - (y - m.y)**2/b**2 - 1) xl, xr, yl, yr = UMG._sicht_box[:4] xl, xr, yl, yr = float(xl), float(xr), float(yl), float(yr) y, x = np.ogrid[xl:xr:100j, yl:yr:100j] # Reihenfolge !!! egl = eval(str(gl)) plt.gca().contour(x.ravel(), y.ravel(), egl, [0], linewidths= \ lin_staerke, colors=lin_farbe) return plt.plot([0], [0], 'w', markersize=0.0001) # dummy plot else: xl, xr, yl, yr = UMG._sicht_box[:4] xl, xr, yl, yr = float(xl), float(xr), float(yl), float(yr) y, x = np.ogrid[xl:xr:100j, yl:yr:100j] # Reihenfolge !!! gl = str(self.imp.lhs) gl = eval(gl) if isinstance(lin_farbe, (tuple, Tuple)): lin_farbe = rgb2hex(lin_farbe) plt.gca().contour(x.ravel(), y.ravel(), gl, [0], \ linewidths=lin_staerke, colors=lin_farbe) return plt.plot([0], [0], 'w', markersize=0.0001) # dummy plot @property def hilfe(self): """Bezeichner der Eigenschaften und Methoden""" hyperbel_hilfe(3) h = hilfe # Benutzerhilfe für Hyperbel # ----------------------- def hyperbel_hilfe(h): if h == 1: print("h=2 - Erzeugung") print("h=3 - Eigenschaften und Methoden") return if h == 2: print("\nHyperbel - Objekt\n") print("Erzeugung in der Ebene R^2:\n") print(" Hyperbel( /[ mitte, ] a, b )\n") print(" mitte Mittelpunkt; Ursprung, wenn weggelassen") print(" a, b Halbachsen\n") print("Zuweisung h = Hyperbel(...) (h - freier Bezeichner)\n") print("Beispiele") print("Hyperbel(5, 3)") print("Hyperbel(v(2, 3), a, 2)\n") return if h == 3: print("\nEigenschaften und Methoden (M) für Hyperbel\n") print("h.hilfe Bezeichner der Eigenschaften und Methoden") print("h.a Länge der 1. Halbachse") print("h.b Länge der 2. Halbachse") print("h.asympt Asymptoten") print("h.bild(...) M Bild bei einer Abbildung") print("h.brenn_ger = h.leit_ger (Brenngeraden)") print("h.brenn_punkt Brennpunkte") print("h.dim Dimension") print("h.e = h.lin_exz") print("h.eps = h.num_exz") print("h.F1 1. Brennpunkt") print("h.f1 = h.F1") print("h.F2 2. Brennpunkt") print("h.f2 = h.F2") print("h.gleich Gleichung") print("h.gleich_(...) M ebenso, zugehörige Methode") print("h.in_kurve Konvertierung in Kurve (2 Zweige)") print("h.is_schar Test auf Schar") print("h.leit_ger Leitgeraden") print("h.lin_exz Lineare Exzentrizität") print("h.mitte Mittelpunkt") print("h.num_exz Nummerische Exzentrizität") print("h.pkt(...) M Hyperbelpunkt (anhand von h.prg)") print("h.prg Parametergleichung") print("h.prg_hf ebenso, mit Hyperbel-F. (2 Zweige)") print("h.prg_rf ebenso, mit rationalen F. (2 Zweige)") print("h.sch_par Parameter einer Schar") print("h.sch_el(...) M Element einer Schar") print("h.tangente(...) M Tangente\n") print("Synonyme Bezeichner\n") print("hilfe : h") print("brenn_ger : brennGer") print("brenn_punkt : brennPunkt") print("F1 : f1") print("F2 : f2") print("gleich_ : Gleich") print("in_kurve : inKurve") print("is_schar : isSchar") print("leit_ger : leitGer") print("lin_exz : linExz") print("num_exz : numExz") print("prg_hf : prgHf") print("prg_rf : prgRf") print("sch_el : schEl") print("sch_par : schPar\n") return
{"hexsha": "2081d19f6317ce815665e436e2b633c2af554383", "size": 20113, "ext": "py", "lang": "Python", "max_stars_repo_path": "agla/lib/objekte/hyperbel.py", "max_stars_repo_name": "HBOMAT/AglaUndZufall", "max_stars_repo_head_hexsha": "3976fecf024a5e4e771d37a6b8056ca4f7eb0da1", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "agla/lib/objekte/hyperbel.py", "max_issues_repo_name": "HBOMAT/AglaUndZufall", "max_issues_repo_head_hexsha": "3976fecf024a5e4e771d37a6b8056ca4f7eb0da1", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "agla/lib/objekte/hyperbel.py", "max_forks_repo_name": "HBOMAT/AglaUndZufall", "max_forks_repo_head_hexsha": "3976fecf024a5e4e771d37a6b8056ca4f7eb0da1", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 34.6775862069, "max_line_length": 91, "alphanum_fraction": 0.4862526724, "include": true, "reason": "import numpy,from numpy,from sympy", "num_tokens": 5791}
module EdgeTest using Test using ForneyLab: Interface, Edge, Variable, Interface, FactorNode, FactorGraph, currentGraph, addNode!, disconnect!, generateId # Integration helper mutable struct MockNode <: FactorNode id::Symbol interfaces::Vector{Interface} i::Dict{Symbol,Interface} function MockNode(; id=generateId(MockNode)) self = new(id, Interface[], Dict{Symbol,Interface}()) addNode!(currentGraph(), self) return self end end @testset "Edge" begin # Edge should couple interfaces FactorGraph() a = Interface(MockNode()) b = Interface(MockNode()) edge = Edge(Variable(), a, b) @test ===(edge.a, a) @test ===(edge.b, b) @test ===(a.edge, edge) @test ===(b.edge, edge) @test ===(a.partner, b) @test ===(b.partner, a) end @testset "disconnect!" begin FactorGraph() a = Interface(MockNode()) b = Interface(MockNode()) edge = Edge(Variable(), a, b) # disconnect! from 'a' side should decouple interfaces disconnect!(edge, a) @test ===(edge.a, b) @test edge.b == nothing @test a.edge == nothing @test ===(b.edge, edge) @test a.partner == nothing @test b.partner == nothing FactorGraph() a = Interface(MockNode()) b = Interface(MockNode()) edge = Edge(Variable(), a, b) # disconnect! from 'b' side should decouple interfaces disconnect!(edge, b) @test ===(edge.a, a) @test edge.b == nothing @test ===(a.edge, edge) @test b.edge == nothing @test a.partner == nothing @test b.partner == nothing end end # module
{"hexsha": "9fd5f3a9d505132990a83bdd9ddb59057aaf429f", "size": 1602, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "test/test_edge.jl", "max_stars_repo_name": "chmathys/ForneyLab.jl", "max_stars_repo_head_hexsha": "30933f28f9fe3aaaf343547a76a309314ea982cc", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 124, "max_stars_repo_stars_event_min_datetime": "2018-06-28T13:30:29.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-23T05:33:24.000Z", "max_issues_repo_path": "test/test_edge.jl", "max_issues_repo_name": "chmathys/ForneyLab.jl", "max_issues_repo_head_hexsha": "30933f28f9fe3aaaf343547a76a309314ea982cc", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 120, "max_issues_repo_issues_event_min_datetime": "2018-08-29T14:29:04.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-28T13:48:44.000Z", "max_forks_repo_path": "test/test_edge.jl", "max_forks_repo_name": "chmathys/ForneyLab.jl", "max_forks_repo_head_hexsha": "30933f28f9fe3aaaf343547a76a309314ea982cc", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 35, "max_forks_repo_forks_event_min_datetime": "2018-07-12T08:19:32.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-14T02:49:44.000Z", "avg_line_length": 24.2727272727, "max_line_length": 127, "alphanum_fraction": 0.6167290886, "num_tokens": 436}
import sys import colorsys import os import numpy as np import matplotlib.patches as mpatches import matplotlib.pyplot as plt from scipy import stats from itertools import combinations from scipy.stats import ks_2samp from matplotlib.lines import Line2D from lokki.lib import PipelineComponents # Description: Returns orthogonal colors def get_colors(number_of_colors): result=[] for i in np.arange(0., 360., 360. / number_of_colors): hue = i/360. lightness = (50 + np.random.rand() * 10)/100. saturation = (90 + np.random.rand() * 10)/100. result.append( colorsys.hls_to_rgb(hue, lightness, saturation) ) return result # Description: Adds a colored dot as a ylabel def plot_ylabel(ax, list_of_strings, list_of_colors, **kw): from matplotlib.offsetbox import AnchoredOffsetbox, TextArea, HPacker, VPacker bbox_anchor = (-0.07, 0.05) if len(list_of_strings) == 2 else (-0.07, 0.25) boxes = [TextArea(text, textprops=dict(color=color, ha='left', va='bottom',rotation=90,**kw)) for text,color in zip(list_of_strings, list_of_colors)] ybox = VPacker(children=boxes,align="center", pad=0, sep=5) anchored_ybox = AnchoredOffsetbox(loc=3, child=ybox, pad=0, frameon=False, bbox_to_anchor=bbox_anchor, bbox_transform=ax.transAxes, borderpad=0) ax.add_artist(anchored_ybox) class Enrichment: def __init__(self, analysis_object, kwargs): self.analysis_object = analysis_object # Set arguments using kwargs if found else set using default self.min_hits = kwargs['min_hits'] if 'min_hits' in kwargs else 1 self.filters = kwargs['filters'] if 'filters' in kwargs else None self.mode = kwargs['mode'] if 'mode' in kwargs else 'single' self.order = kwargs['order'] if 'order' in kwargs else 'asc' self.num = kwargs['num'] if 'num' in kwargs else 'all' # Creates output directory to store enrichment plots (note: I create separate run folders so the user wont overwrite existing figures) count = 0 while True: if not os.path.exists('./enrichment_figs/run_' + str(count) + '/'): os.makedirs('./enrichment_figs/run_' + str(count)) self.output_directory = './enrichment_figs/run_' + str(count) + '/' break else: count += 1 # Get mapping between component name and component type self.component_name_to_type = PipelineComponents.get_name_to_component_map('') def run(self): results = dict() ranked_data = self.get_ranked_list() custom_data_flag = 'grid' in ranked_data[0] # Custom datasets will not have a grid parameter ranked_values = [x['value'] for x in ranked_data] dimensions = sorted(list(set([x for y in ranked_data for x in y['key']]))) # For each dimension string (e.g. "pca") for dimension in dimensions: # Create a list of 0's and 1's indicating the presence or absence of the dimension (eg if pca appeared in the 1st and 3rd positions -> [1 0 1 0 0 0]) enrichment_bars = [] for data in ranked_data: if dimension in data['key']: enrichment_bars.append(1) else: enrichment_bars.append(0) # Create a list of the ranks (ie 1 -> 1st best, 4 -> 4th best, etc) for the ranks of the current dimension and then every other dimension enrichment_ranks = [i for i, x in enumerate(ranked_data) if enrichment_bars[i] == 1] other_ranks = [j for j, x in enumerate(ranked_data) if not j in enrichment_ranks] enrichment_scores = [x['value'] for i, x in enumerate(ranked_data) if enrichment_bars[i] == 1] other_scores = [x['value'] for j, x in enumerate(ranked_data) if j in other_ranks] # If the ranks are in general less thna the other ranks then they cluster to the left and the sign of ks should be positive ks_sign = np.nan if len(enrichment_scores) != 0: ks_sign = 1 if np.mean(enrichment_scores) > np.mean(other_scores) else -1 # If enrichment_ranks and other_ranks are both not empty use the scipy method else return (0, 1) which is the worst ks stat a pvalue possible ks_stat, p_value = ks_2samp(enrichment_scores, other_scores) if enrichment_ranks and other_ranks else (0, 1) results[dimension] = {'name' : dimension, 'bars' : enrichment_bars.copy(), 'ks_stat' : ks_stat * ks_sign, 'p_value' : p_value} # If you are analyzing more than a single factor if self.mode.lower() == 'dual': # For each combination (ie n choose k) for combination in combinations(dimensions, 2): # Assign enrichment bars from the first dimension enrichment_bars = results[combination[0]]['bars'] for j in range(len(combination)): # Update the enrichment bars by performing an & operation with every other dimension (ie the final result will be 1's when every dimension is present) enrichment_bars = list(np.array(enrichment_bars) & np.array(results[combination[j]]['bars'])) # See above (ie same procedure for single dimension used below) enrichment_ranks = [i for i, x in enumerate(ranked_data) if enrichment_bars[i] == 1] other_ranks = [j for j, x in enumerate(ranked_data) if not j in enrichment_ranks] enrichment_scores = [x['value'] for i, x in enumerate(ranked_data) if enrichment_bars[i] == 1] other_scores = [x['value'] for j, x in enumerate(ranked_data) if j in other_ranks] ks_sign = np.nan if len(enrichment_scores) != 0: ks_sign = 1 if np.mean(enrichment_scores) > np.mean(other_scores) else -1 ks_stat, p_value = ks_2samp(enrichment_scores, other_scores) if enrichment_ranks and other_ranks else (0, 1) results[combination] = {'name' : combination, 'bars' : enrichment_bars.copy(), 'ks_stat' : ks_stat * ks_sign, 'p_value' : p_value} highest_scores = sorted(results.items(), key = lambda x : x[1]['ks_stat'], reverse = True) lowest_scores = sorted(results.items(), key = lambda x : x[1]['ks_stat']) # If user provides filters, only include those results that include filter elements (eg filters = ['pca'] will only include results with 'pca') if self.filters: highest_scores = [x for x in highest_scores if np.any([y in self.filters for y in x[0]]) or self.filters[0] == x[0]] lowest_scores = [x for x in lowest_scores if np.any([y in self.filters for y in x[0]]) or self.filters[0] == x[0]] # Only include results that have x number of hits highest_scores = [x for x in highest_scores if sum(x[1]['bars']) >= self.min_hits] lowest_scores = [x for x in lowest_scores if sum(x[1]['bars']) >= self.min_hits] scores = lowest_scores if self.order.lower() == 'asc' else highest_scores if custom_data_flag: self.draw_de_novo_analysis_enrichment_plots(scores) else: self.draw_precomputed_analysis_enrichment_plots(scores) def draw_precomputed_analysis_enrichment_plots(self, scores): # Create enrichment plot for i, plot_data in enumerate(scores): if isinstance(self.num, int) and i >= self.num: break key = plot_data[1]['name'] values = plot_data[1] pvalue = round(values['p_value'], 4) name = '_'.join(key) if isinstance(key, tuple) else key ylabel = '\n'.join(key) if isinstance(key, tuple) else key fig, ax = plt.subplots(1, figsize=(15, 2)) ax.bar(range(0, len(values['bars'])), values['bars'], width = 1, color = 'k') ax.set_xlim(0, len(values['bars'])) ax.set_ylim(0, 1) ax.set_xticks([]) ax.set_yticks([]) ax.set_ylabel(ylabel) ax.set_title('p-value: ' + str(pvalue if pvalue > 0.01 else '< 0.01') + ' stat: ' + str(round(values['ks_stat'], 4)), loc = 'left', fontsize = 12, fontweight='bold') plt.savefig(self.output_directory + '/' + name.lower() + '.png') plt.close() def draw_de_novo_analysis_enrichment_plots(self, scores): # Loop through the plots to determine how many of each component exists. This is necessary to create a dynamic color mapping based on components component_sets = {'data_transform' : set(), 'feature_transform' : set(), 'model' : set()} for i, plot_data in enumerate(scores): if isinstance(self.num, int) and i >= self.num: break key = plot_data[1]['name'] if isinstance(key, tuple): component_types = {x : self.component_name_to_type[x] for x in key} for x, y in component_types.items(): component_sets[y].add(x) else: component_type = self.component_name_to_type[key] component_sets[component_type].add(key) # Generate the color map between the component type options and a set of orthogonal colors color_map = self.get_loaded_color_map(component_sets) # Create enrichment plot for i, plot_data in enumerate(scores): if isinstance(self.num, int) and i >= self.num: break key = plot_data[1]['name'] values = plot_data[1] pvalue = round(values['p_value'], 4) name = '_'.join(key) if isinstance(key, tuple) else key factor_labels, factor_colors = self.get_label(key, color_map) fig, ax = plt.subplots(1, figsize=(15, 2)) ax.bar(range(0, len(values['bars'])), values['bars'], width = 1, color = 'k') ax.set_xlim(0, len(values['bars'])) ax.set_ylim(0, 1) ax.set_xticks([]) ax.set_yticks([]) ax.set_title('p-value: ' + str(pvalue if pvalue > 0.01 else '< 0.01') + ' stat: ' + str(round(values['ks_stat'], 4)), loc = 'left', fontsize = 12, fontweight='bold') plot_ylabel(ax, factor_labels, factor_colors, size=50, weight='bold') plt.savefig(self.output_directory + '/' + name.lower() + '.png') plt.close() # Output legend fig, ax = plt.subplots(nrows = len(color_map), ncols = 1, figsize = (4, 12)) for i, (component_type, component_name_color_map) in enumerate(color_map.items()): patches = [] if component_type == 'data_transform': legend_shape = 'o' elif component_type == 'feature_transform': legend_shape = 's' elif component_type == 'model': legend_shape = '^' else: sys.exit("ERROR: Couldn't find component type check enrichment.py") for color_name, color_values in component_name_color_map.items(): patches.append(Line2D([0], [0], marker = legend_shape, color = 'w', label = color_name, markerfacecolor = color_values, markersize = 15)) if len(color_map) > 1: ax[i].legend(handles = patches, loc='center') ax[i].set_xticks([]) ax[i].set_yticks([]) else: ax.legend(handles = patches, loc='center') ax.set_xticks([]) ax.set_yticks([]) plt.savefig(self.output_directory + '/legend.png') plt.close() # Description: Returns shape and color for y label def get_label(self, key, color_map): factor_labels, factor_colors = [], [] if isinstance(key, tuple): for x in key: component_type = self.component_name_to_type[x] if component_type == 'data_transform': factor_labels.append('●') elif component_type == 'feature_transform': factor_labels.append('■') elif component_type == 'model': factor_labels.append('▲') else: sys.exit("ERROR: Couldn't find label shape check enrichment.py (tuple)") factor_colors.append(color_map[component_type][x]) else: component_type = self.component_name_to_type[key] if component_type == 'data_transform': factor_labels.append('●') elif component_type == 'feature_transform': factor_labels.append('■') elif component_type == 'model': factor_labels.append('▲') else: sys.exit("ERROR: Couldn't find label shape check enrichment.py (string)") factor_colors.append(color_map[component_type][key]) return tuple(factor_labels), tuple(factor_colors) # Description: Return the following mapping: {eg data_transform : { zscore : color, log : color, ...}, ...} def get_loaded_color_map(self, component_sets): color_map = dict() for component_type, component_set in component_sets.items(): if len(component_set) == 0: continue if not component_type in color_map: color_map[component_type] = dict() color_options = get_colors(len(component_set)) for i, x in enumerate(component_set): color_map[component_type][x] = color_options[i] return color_map # Description: Returns ranked list by key def get_ranked_list(self): return sorted(self.analysis_object.results, key = lambda x : x['value'], reverse = True)
{"hexsha": "9921659ddb4ea529c9b9916e68c370462a4b6446", "size": 14081, "ext": "py", "lang": "Python", "max_stars_repo_path": "lokki/visualize/enrichment.py", "max_stars_repo_name": "bzhanglab/Lokki", "max_stars_repo_head_hexsha": "035087d58f2b194b3a1644b932683ded0fb71af4", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lokki/visualize/enrichment.py", "max_issues_repo_name": "bzhanglab/Lokki", "max_issues_repo_head_hexsha": "035087d58f2b194b3a1644b932683ded0fb71af4", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lokki/visualize/enrichment.py", "max_forks_repo_name": "bzhanglab/Lokki", "max_forks_repo_head_hexsha": "035087d58f2b194b3a1644b932683ded0fb71af4", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 46.780730897, "max_line_length": 181, "alphanum_fraction": 0.5991761949, "include": true, "reason": "import numpy,from scipy", "num_tokens": 3239}
#!/usr/bin/env python """ find minimum and maximum, stats in an HDF5 variable """ from pathlib import Path import h5py import numpy as np import warnings from argparse import ArgumentParser def main(): p = ArgumentParser() p.add_argument('fn', help='HDF5 filename') p.add_argument('var', help='HDF5 variable to analyze') p = p.parse_args() fn = Path(p.fn).expanduser() key = p.var with h5py.File(fn, 'r') as f: if f[key].size > 10e9: warnings.warn(f'this might take a long time: large variable size {f[key].size} elements') dat = f[key][:] # %% fmin = dat.min() fmax = dat.max() print('min, max: ', fmin, fmax) prc = np.array([0.01, 0.05, 0.5, 0.95, 0.99]) ptile = np.percentile(dat, prc) print(f'for the {prc*100} percentiles') print(ptile) if ptile[-1] - ptile[0] < 20: print(f'if {fn} is a video file, it might have poor contrast or not have many changes') if __name__ == '__main__': main()
{"hexsha": "9b095dac5d5472a2704f78e6dde5ff2ea84bc7ca", "size": 1010, "ext": "py", "lang": "Python", "max_stars_repo_path": "hdf5stats.py", "max_stars_repo_name": "scienceopen/cvhst", "max_stars_repo_head_hexsha": "0613fdcc11cd086cdd375aae05677b33bfbbcfd0", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2019-07-01T19:58:46.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-12T02:39:59.000Z", "max_issues_repo_path": "hdf5stats.py", "max_issues_repo_name": "scienceopen/cvhst", "max_issues_repo_head_hexsha": "0613fdcc11cd086cdd375aae05677b33bfbbcfd0", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "hdf5stats.py", "max_forks_repo_name": "scienceopen/cvhst", "max_forks_repo_head_hexsha": "0613fdcc11cd086cdd375aae05677b33bfbbcfd0", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-05-06T16:45:09.000Z", "max_forks_repo_forks_event_max_datetime": "2018-05-06T16:45:09.000Z", "avg_line_length": 22.4444444444, "max_line_length": 101, "alphanum_fraction": 0.6099009901, "include": true, "reason": "import numpy", "num_tokens": 308}
# Copyright 2019 Xanadu Quantum Technologies Inc. # 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. r""" Unit tests for strawberryfields.gbs.sample """ # pylint: disable=no-self-use,unused-argument,protected-access from unittest import mock import networkx as nx import numpy as np import pytest import strawberryfields as sf from strawberryfields.gbs import sample pytestmark = pytest.mark.gbs adj_dim_range = range(2, 6) U1 = np.array( [ [-0.07985219, 0.66041032, -0.19389188, 0.01340832, 0.70312675, -0.1208423, -0.10352726], [0.19216669, -0.12470466, -0.81320519, 0.52045174, -0.1066017, -0.06300751, -0.00376173], [0.60838109, 0.0835063, -0.14958816, -0.34291399, 0.06239828, 0.68753918, -0.07955415], [0.63690134, -0.03047939, 0.46585565, 0.50545897, 0.21194805, -0.20422433, 0.18516987], [0.34556293, 0.22562207, -0.1999159, -0.50280235, -0.25510781, -0.55793978, 0.40065893], [-0.03377431, -0.66280536, -0.14740447, -0.25725325, 0.6145946, -0.07128058, 0.29804963], [-0.24570365, 0.22402764, 0.003273, 0.19204683, -0.05125235, 0.3881131, 0.83623564], ] ) r = np.array([0.09721339, 0.07017918, 0.02083469, -0.05974357, -0.07487845, -0.1119975, -0.1866708]) U2 = np.array( [ [-0.07012006, 0.14489772, 0.17593463, 0.02431155, -0.63151781, 0.61230046, 0.41087368], [0.5618538, -0.09931968, 0.04562272, 0.02158822, 0.35700706, 0.6614837, -0.326946], [-0.16560687, -0.7608465, -0.25644606, -0.54317241, -0.12822903, 0.12809274, -0.00597384], [0.01788782, 0.60430409, -0.19831443, -0.73270964, -0.06393682, 0.03376894, -0.23038293], [0.78640978, -0.11133936, 0.03160537, -0.09188782, -0.43483738, -0.4018141, 0.09582698], [-0.13664887, -0.11196486, 0.86353995, -0.19608061, -0.12313513, -0.08639263, -0.40251231], [-0.12060103, -0.01169781, -0.33937036, 0.34662981, -0.49895371, 0.03257453, -0.70709135], ] ) alpha = np.array( [0.15938187, 0.10387399, 1.10301587, -0.26756921, 0.32194572, -0.24317402, 0.0436992] ) p = [U1, r, U2, alpha] @pytest.mark.parametrize("dim", [4]) class TestSample: """Tests for the function ``strawberryfields.gbs.sample.sample``""" def test_invalid_adjacency(self, dim): """Test if function raises a ``ValueError`` for a matrix that is not symmetric""" with pytest.raises(ValueError, match="Input must be a NumPy array"): adj_asym = np.triu(np.ones((dim, dim))) sample.sample(A=adj_asym, n_mean=1.0) def test_invalid_n_samples(self, adj): """Test if function raises a ``ValueError`` when a number of samples less than one is requested """ with pytest.raises(ValueError, match="Number of samples must be at least one"): sample.sample(A=adj, n_mean=1.0, n_samples=0) def test_invalid_n_mean(self, adj): """Test if function raises a ``ValueError`` when the mean photon number is specified to be negative.""" with pytest.raises(ValueError, match="Mean photon number must be non-negative"): sample.sample(A=adj, n_mean=-1.0, n_samples=1) def test_invalid_loss(self, adj): """Test if function raises a ``ValueError`` when the loss parameter is specified outside of range""" with pytest.raises(ValueError, match="Loss parameter must take a value between zero and"): sample.sample(A=adj, n_mean=1.0, n_samples=1, loss=2) def test_threshold(self, monkeypatch, adj): """Test if function correctly creates the SF program for threshold GBS.""" mock_eng_run = mock.MagicMock() with monkeypatch.context() as m: m.setattr(sf.Engine, "run", mock_eng_run) sample.sample(A=adj, n_mean=1, threshold=True) p_func = mock_eng_run.call_args[0][0] assert isinstance(p_func.circuit[-1].op, sf.ops.MeasureThreshold) def test_pnr(self, monkeypatch, adj): """Test if function correctly creates the SF program for photon-number resolving GBS.""" mock_eng_run = mock.MagicMock() with monkeypatch.context() as m: m.setattr(sf.Engine, "run", mock_eng_run) sample.sample(A=adj, n_mean=1, threshold=False) p_func = mock_eng_run.call_args[0][0] assert isinstance(p_func.circuit[-1].op, sf.ops.MeasureFock) def test_loss(self, monkeypatch, adj): """Test if function correctly creates the SF program for lossy GBS.""" mock_eng_run = mock.MagicMock() with monkeypatch.context() as m: m.setattr(sf.Engine, "run", mock_eng_run) sample.sample(A=adj, n_mean=1, threshold=False, loss=0.5) p_func = mock_eng_run.call_args[0][0] assert isinstance(p_func.circuit[-2].op, sf.ops.LossChannel) def test_no_loss(self, monkeypatch, adj): """Test if function correctly creates the SF program for GBS without loss.""" mock_eng_run = mock.MagicMock() with monkeypatch.context() as m: m.setattr(sf.Engine, "run", mock_eng_run) sample.sample(A=adj, n_mean=1, threshold=False) p_func = mock_eng_run.call_args[0][0] assert not all([isinstance(op, sf.ops.LossChannel) for op in p_func.circuit]) def test_all_loss(self, monkeypatch, adj, dim): """Test if function samples from the vacuum when maximum loss is applied.""" mock_eng_run = mock.MagicMock() with monkeypatch.context() as m: m.setattr(sf.Engine, "run", mock_eng_run) sample.sample(A=adj, n_mean=1, threshold=False, loss=1) p_func = mock_eng_run.call_args[0][0] eng = sf.LocalEngine(backend="gaussian") state = eng.run(p_func).state cov = state.cov() disp = state.displacement() assert np.allclose(cov, 0.5 * state.hbar * np.eye(2 * dim)) assert np.allclose(disp, np.zeros(dim)) @pytest.mark.parametrize("dim", adj_dim_range) @pytest.mark.parametrize("integration_sample_number", [1, 2]) class TestSampleIntegration: """Integration tests for the function ``strawberryfields.gbs.sample.sample``""" def test_pnr_integration(self, adj, integration_sample_number): """Integration test to check if function returns samples of correct form, i.e., correct number of samples, correct number of modes, all non-negative integers """ samples = np.array( sample.sample(A=adj, n_mean=1.0, n_samples=integration_sample_number, threshold=False) ) dims = samples.shape assert len(dims) == 2 assert dims == (integration_sample_number, len(adj)) assert samples.dtype == "int" assert (samples >= 0).all() def test_threshold_integration(self, adj, integration_sample_number): """Integration test to check if function returns samples of correct form, i.e., correct number of samples, correct number of modes, all integers of zeros and ones """ samples = np.array( sample.sample(A=adj, n_mean=1.0, n_samples=integration_sample_number, threshold=True) ) dims = samples.shape assert len(dims) == 2 assert dims == (integration_sample_number, len(adj)) assert samples.dtype == "int" assert (samples >= 0).all() assert (samples <= 1).all() @pytest.mark.parametrize("dim", [4]) def test_seed(dim, adj): """Test for the function ``strawberryfields.gbs.sample.seed``. Checks that samples are identical after repeated initialization of ``seed``.""" sample.seed(1968) q_s_1 = sample.sample(A=adj, n_mean=2, n_samples=10, threshold=False) sample.seed(1968) q_s_2 = sample.sample(A=adj, n_mean=2, n_samples=10, threshold=False) assert np.array_equal(q_s_1, q_s_2) @pytest.mark.parametrize("dim", [6]) class TestToSubgraphs: """Tests for the function ``sample.to_subgraphs``""" quantum_samples = [ [0, 1, 1, 1, 1, 1], [1, 0, 0, 1, 0, 0], [1, 1, 1, 1, 1, 1], [0, 0, 1, 0, 0, 1], [0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 1, 1], [0, 0, 0, 0, 1, 1], [1, 1, 0, 1, 1, 1], [1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 1], ] subgraphs = [ [1, 2, 3, 4, 5], [0, 3], [0, 1, 2, 3, 4, 5], [2, 5], [1, 2, 3], [4, 5], [4, 5], [0, 1, 3, 4, 5], [0, 3], [4, 5], ] def test_graph(self, graph): """Test if function returns correctly processed subgraphs given input samples of the list ``quantum_samples``.""" assert sample.to_subgraphs(self.quantum_samples, graph) == self.subgraphs def test_graph_mapped(self, graph): """Test if function returns correctly processed subgraphs given input samples of the list ``quantum_samples``. Note that graph nodes are numbered in this test as [0, 1, 4, 9, ...] (i.e., squares of the usual list) as a simple mapping to explore that the optimised subgraph returned is still a valid subgraph.""" graph = nx.relabel_nodes(graph, lambda x: x ** 2) graph_nodes = list(graph.nodes) subgraphs_mapped = [ sorted([graph_nodes[i] for i in subgraph]) for subgraph in self.subgraphs ] assert sample.to_subgraphs(self.quantum_samples, graph) == subgraphs_mapped def test_modes_from_counts(): """Test if the function ``strawberryfields.gbs.sample.modes_from_counts`` returns the correct mode samples when input a set of photon count samples.""" counts = [[0, 0, 0, 0], [1.0, 0.0, 0.0, 2.0], [1, 1, 1, 0], [1, 2, 1, 0], [0, 1, 0, 2, 4]] modes = [[], [0, 3, 3], [0, 1, 2], [0, 1, 1, 2], [1, 3, 3, 4, 4, 4, 4]] assert [sample.modes_from_counts(s) for s in counts] == modes def test_postselect(): """Test if the function ``strawberryfields.gbs.sample.postselect`` correctly postselects on minimum number of photons or clicks.""" counts_pnr = [ [0, 0, 0, 0], [1, 1, 0, 2], [1, 1, 1, 0], [1, 2, 1, 0], [1, 0, 0, 1], [5, 0, 0, 0], [1, 2, 1, 2], ] counts_pnr_ps_4_5 = [[1, 1, 0, 2], [1, 2, 1, 0], [5, 0, 0, 0]] counts_threshold = [ [0, 0, 0, 0], [1, 1, 0, 1], [1, 1, 1, 0], [1, 1, 1, 0], [1, 0, 0, 1], [1, 1, 1, 1], ] counts_threshold_ps_3_3 = [[1, 1, 0, 1], [1, 1, 1, 0], [1, 1, 1, 0]] assert sample.postselect(counts_pnr, 4, 5) == counts_pnr_ps_4_5 assert sample.postselect(counts_threshold, 3, 3) == counts_threshold_ps_3_3 class TestGaussian: """Tests for the function ``strawberryfields.gbs.sample.gaussian``""" def test_invalid_n_samples(self): """Test if function raises a ``ValueError`` when a number of samples less than one is requested.""" with pytest.raises(ValueError, match="Number of samples must be at least one"): sample.gaussian(*p, -1) def test_invalid_loss(self): """Test if function raises a ``ValueError`` when the loss parameter is specified outside of range.""" with pytest.raises(ValueError, match="Loss parameter must take a value between zero and"): sample.gaussian(*p, 1, loss=2) def test_loss(self, monkeypatch): """Test if function correctly creates the SF program for lossy GBS.""" mock_eng_run = mock.MagicMock() with monkeypatch.context() as m: m.setattr(sf.Engine, "run", mock_eng_run) sample.gaussian(*p, 1, loss=0.5) p_func = mock_eng_run.call_args[0][0] assert isinstance(p_func.circuit[-2].op, sf.ops.LossChannel) def test_no_loss(self, monkeypatch): """Test if function correctly creates the SF program for GBS without loss.""" mock_eng_run = mock.MagicMock() with monkeypatch.context() as m: m.setattr(sf.Engine, "run", mock_eng_run) sample.gaussian(*p, 1) p_func = mock_eng_run.call_args[0][0] assert not all([isinstance(op, sf.ops.LossChannel) for op in p_func.circuit]) def test_all_loss(self, monkeypatch): """Test if function samples from the vacuum when maximum loss is applied.""" dim = len(alpha) mock_eng_run = mock.MagicMock() with monkeypatch.context() as m: m.setattr(sf.Engine, "run", mock_eng_run) sample.gaussian(*p, 1, loss=1) p_func = mock_eng_run.call_args[0][0] eng = sf.LocalEngine(backend="gaussian") state = eng.run(p_func).state cov = state.cov() disp = state.displacement() assert np.allclose(cov, 0.5 * state.hbar * np.eye(2 * dim)) assert np.allclose(disp, np.zeros(dim)) @pytest.mark.parametrize("integration_sample_number", [1, 2]) def test_gaussian_integration(integration_sample_number): """Integration test for the function ``strawberryfields.gbs.sample.gaussian`` to check if it returns samples of correct form, i.e., correct number of samples, correct number of modes, all non-negative integers.""" samples = np.array(sample.gaussian(*p, n_samples=integration_sample_number)) dims = samples.shape assert len(dims) == 2 assert dims == (integration_sample_number, len(alpha)) assert samples.dtype == "int" assert (samples >= 0).all()
{"hexsha": "58de699eb6c0bd1e8132577ccd69364c14fc42a6", "size": 13911, "ext": "py", "lang": "Python", "max_stars_repo_path": "tests/gbs/test_sample.py", "max_stars_repo_name": "rajeshkumarkarra/strawberryfields", "max_stars_repo_head_hexsha": "138d8459fe773a9d645569d7af3ecd1f86e65f5a", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tests/gbs/test_sample.py", "max_issues_repo_name": "rajeshkumarkarra/strawberryfields", "max_issues_repo_head_hexsha": "138d8459fe773a9d645569d7af3ecd1f86e65f5a", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 5, "max_issues_repo_issues_event_min_datetime": "2020-09-26T01:27:24.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-10T02:13:49.000Z", "max_forks_repo_path": "tests/gbs/test_sample.py", "max_forks_repo_name": "rajeshkumarkarra/strawberryfields", "max_forks_repo_head_hexsha": "138d8459fe773a9d645569d7af3ecd1f86e65f5a", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 38.4281767956, "max_line_length": 100, "alphanum_fraction": 0.6290705197, "include": true, "reason": "import numpy,import networkx", "num_tokens": 4160}
""" Example configurations for the models that worked well """ import enum from typing import Dict import numpy as np from reconstruction.model.bunny import FixedBunny from reconstruction.model.dragon import Dragon from reconstruction.model.model_mesh import MeshModelLoader from reconstruction.model.model_pts import PtsModelLoader class Example(enum.Enum): BunnyFixed = 0 Bunny = 1 Dragon = 2 Cat = 3 Dog = 4 Camel = 5 example_config: Dict[Example, Dict] = { Example.BunnyFixed: dict( dilations_max=5, dilations_reverse=1 ), Example.Bunny: dict( dilations_max=30, dilations_reverse=3 ), Example.Dragon: dict( dilations_max=20, dilations_reverse=3 ), Example.Cat: dict( dilations_max=20, dilations_reverse=4 ), Example.Dog: dict( dilations_max=20, dilations_reverse=4 ), Example.Camel: dict( dilations_max=20, dilations_reverse=3 ) } def example_load(example: Example) -> np.ndarray: if example == Example.BunnyFixed: return FixedBunny.bunny() if example == Example.Bunny: return PtsModelLoader().load("models/bunny/bunnyData.pts") if example == Example.Dragon: return Dragon().load() if example == Example.Cat: return MeshModelLoader(samples=30000, noise=0.01).load("models/cat/cat_reference.obj") if example == Example.Dog: return MeshModelLoader(samples=30000, noise=0.01).load("models/dog/dog_reference.obj") if example == Example.Camel: return MeshModelLoader(samples=60000, noise=0.01).load("models/camel-poses/camel-reference.obj")
{"hexsha": "2225f3eaf9ecba08c4f1ebffb438975afcae45f1", "size": 1688, "ext": "py", "lang": "Python", "max_stars_repo_path": "example.py", "max_stars_repo_name": "mickare/Robust-Reconstruction-of-Watertight-3D-Models", "max_stars_repo_head_hexsha": "c3afd98a8732c0447c153d38bfcefb5c4441bc7b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 6, "max_stars_repo_stars_event_min_datetime": "2021-04-01T20:37:29.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-24T18:27:52.000Z", "max_issues_repo_path": "example.py", "max_issues_repo_name": "mickare/Robust-Reconstruction-of-Watertight-3D-Models", "max_issues_repo_head_hexsha": "c3afd98a8732c0447c153d38bfcefb5c4441bc7b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "example.py", "max_forks_repo_name": "mickare/Robust-Reconstruction-of-Watertight-3D-Models", "max_forks_repo_head_hexsha": "c3afd98a8732c0447c153d38bfcefb5c4441bc7b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 25.9692307692, "max_line_length": 104, "alphanum_fraction": 0.6712085308, "include": true, "reason": "import numpy", "num_tokens": 426}
import time import numpy as np from sklearn.metrics import (accuracy_score, confusion_matrix, f1_score, precision_score, recall_score) def classify_folds(clf, X, Y, folds): """Performs the full-learning procedure (training, testing and metrics). Args: clf (Classifier): A Classifier instance. X (np.array): Array of samples. Y (np.array): Array of labels. folds (list): A list of k-folds indexes. Returns: A dictionary holding the classification metrics. """ # Defining lists for further appending c_matrix, accuracy, precision, recall, f1, _time = [], [], [], [], [], [] # Iterating through every fold for j, (train_idx, test_idx) in enumerate(folds): print(f'Running fold {j+1} ...') # Applying fold's indexes to training and testing sets X_train, X_test = X[train_idx], X[test_idx] Y_train, Y_test = Y[train_idx], Y[test_idx] # Starting timer start = time.time() # Fitting classifier with training data clf.fit(X_train, Y_train) # Ending timer end = time.time() # Predicting test data preds = clf.predict(X_test) # Calculating the desired metrics c_matrix.append(confusion_matrix(Y_test, preds)) accuracy.append(accuracy_score(Y_test, preds)) precision.append(precision_score(Y_test, preds)) recall.append(recall_score(Y_test, preds)) f1.append(f1_score(Y_test, preds)) _time.append((end - start)) return { 'c_matrix': c_matrix, 'accuracy': accuracy, 'precision': precision, 'recall': recall, 'f1': f1, 'time': _time } def classify_split(clf, X_train, Y_train, X_test, Y_test): """Performs the full-learning procedure (training, testing and metrics). Args: clf (Classifier): A Classifier instance. X_train (np.array): Array of training samples. Y_train (np.array): Array of training labels. X_test (np.array): Array of testing samples. Y_test (np.array): Array of testing labels. Returns: A dictionary holding the classification metrics. """ # Starting timer start = time.time() # Fitting classifier with training data clf.fit(X_train, Y_train) # Ending timer end = time.time() # Predicting test data preds = clf.predict(X_test) # Calculating the desired metrics c_matrix = confusion_matrix(Y_test, preds) accuracy = accuracy_score(Y_test, preds) precision = precision_score(Y_test, preds) recall = recall_score(Y_test, preds) f1 = f1_score(Y_test, preds) _time = end - start return { 'c_matrix': c_matrix, 'accuracy': accuracy, 'precision': precision, 'recall': recall, 'f1': f1, 'time': _time } def stacking_folds(stack, X_train, Y_train, folds, X_test, Y_test): """Performs the full-learning procedure over a stacking-based ensemble. Args: stack (Stacking): A Stacking instance. X_train (np.array): Array of training samples. Y_train (np.array): Array of training labels. folds (list): A list of k-folds indexes. Y_train (np.array): Array of training labels. Y_test (np.array): Array of testing labels. Returns: A dictionary holding the classification metrics. """ # Starting timer start = time.time() # Iterating through every fold for j, (train_idx, val_idx) in enumerate(folds): print(f'Running fold {j+1} ...') # Applying fold's indexes to training and validation sets X_tr, X_val = X_train[train_idx], X_train[val_idx] Y_tr, Y_val = Y_train[train_idx], Y_train[val_idx] # Fit the base classifiers X_folds, Y_folds = stack.fit_clfs(X_tr, Y_tr, X_val, Y_val) # If it is the first fold if j == 0: # Gathers the prediction out of the fitted classifiers X_train_stacked = X_folds # Gathers the labels out of the fitted classifiers Y_train_stacked = Y_folds # If it is not the first fold else: # Stacks the array to compose the meta-learner training set samples X_train_stacked = np.vstack((X_train_stacked, X_folds)) # Stacks the array to compose the meta-learner training set labels Y_train_stacked = np.hstack((Y_train_stacked, Y_folds)) # Predicts with the base classifiers the meta-learner testing set samples X_test_stacked = stack.predict_clfs(X_test) # Gathers the meta-learner testing set samples Y_test_stacked = Y_test # Little trick to satisfy OPF `canberra` distance function # Note that it will not affect other classifiers X_train_stacked -= 1 X_test_stacked -= 1 # Fits the meta-learner stack.fit_meta(X_train_stacked, Y_train_stacked) # Ending timer end = time.time() # Predicts with the meta-learner preds = stack.predict_meta(X_test_stacked) # Calculating the desired metrics c_matrix = confusion_matrix(Y_test_stacked, preds) accuracy = accuracy_score(Y_test_stacked, preds) precision = precision_score(Y_test_stacked, preds) recall = recall_score(Y_test_stacked, preds) f1 = f1_score(Y_test_stacked, preds) _time = end - start return { 'c_matrix': c_matrix, 'accuracy': accuracy, 'precision': precision, 'recall': recall, 'f1': f1, 'time': _time }
{"hexsha": "2d1ea5ae99e537b774b3c7e98a3abd77c2dee476", "size": 5618, "ext": "py", "lang": "Python", "max_stars_repo_path": "utils/wrapper.py", "max_stars_repo_name": "malvesbertoni/ensemble_opf", "max_stars_repo_head_hexsha": "d36289e19db1ac9c55f3b404f90ba1894fc0e62a", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "utils/wrapper.py", "max_issues_repo_name": "malvesbertoni/ensemble_opf", "max_issues_repo_head_hexsha": "d36289e19db1ac9c55f3b404f90ba1894fc0e62a", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "utils/wrapper.py", "max_forks_repo_name": "malvesbertoni/ensemble_opf", "max_forks_repo_head_hexsha": "d36289e19db1ac9c55f3b404f90ba1894fc0e62a", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 29.5684210526, "max_line_length": 79, "alphanum_fraction": 0.6361694553, "include": true, "reason": "import numpy", "num_tokens": 1339}
import numpy as np class ActionFreeReplayBuffer(): def __init__(self, observation, observation_img, observation_img_raw, done): self.n = len(observation) - 1 self.observation = observation self.observation_img = observation_img self.observation_img_raw = observation_img_raw self.done = done[:-1] self.next_observation = self.observation[1:] self.observation = self.observation[:-1] self.next_observation_img = self.observation_img[1:] self.observation_img = self.observation_img[:-1] self.next_observation_img_raw = self.observation_img_raw[1:] self.observation_img_raw = self.observation_img_raw[:-1] def sample(self, batch_size=256): batch = np.random.choice(self.n, batch_size) obs = self.observation[batch] obs_img = self.observation_img[batch] obs_img_raw = self.observation_img_raw[batch] next_obs = self.next_observation[batch] next_obs_img = self.next_observation_img[batch] next_obs_img_raw = self.next_observation_img_raw[batch] done = self.done[batch] return obs, obs_img, obs_img_raw, next_obs, next_obs_img, next_obs_img_raw, done class SmallReplayBuffer(): def __init__(self, observation, action, next_observation): self.n = len(observation) - 1 self.observation = observation self.action = action self.next_observation = next_observation def sample(self, batch_size=256): batch = np.random.choice(self.n, batch_size) obs = self.observation[batch] action = self.action[batch] next_obs = self.next_observation[batch] return obs, action, next_obs
{"hexsha": "f407ebb101f5156929de766ead4064941838af88", "size": 1720, "ext": "py", "lang": "Python", "max_stars_repo_path": "RLV/torch_rlv/utils/action_free_buffer.py", "max_stars_repo_name": "simonr98/Reinforcement-Learning-with-Videos", "max_stars_repo_head_hexsha": "e40cec6b8d817276375e940696b290fc4e1e8bc7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "RLV/torch_rlv/utils/action_free_buffer.py", "max_issues_repo_name": "simonr98/Reinforcement-Learning-with-Videos", "max_issues_repo_head_hexsha": "e40cec6b8d817276375e940696b290fc4e1e8bc7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "RLV/torch_rlv/utils/action_free_buffer.py", "max_forks_repo_name": "simonr98/Reinforcement-Learning-with-Videos", "max_forks_repo_head_hexsha": "e40cec6b8d817276375e940696b290fc4e1e8bc7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.1020408163, "max_line_length": 88, "alphanum_fraction": 0.6848837209, "include": true, "reason": "import numpy", "num_tokens": 400}
# This is a Python port of Joy's affinity maturation flexibility code # available at: https://github.com/jlouveau/Toy_Model_for_John import csv import sys import os import importlib import numpy as np # numerical tools from copy import deepcopy # deepcopy copies a data structure without any implicit references #from scipy.stats import genextreme # generalized extreme value distribution from timeit import default_timer as timer # timer for performance import importlib ###### Global parameters ###### p_mut = 0.14 # probability of mutation per division round p_CDR = 1.00 # probability of mutation in the CDR region p_CDR_lethal = 0.30 # probability that a CDR mutation is lethal p_CDR_silent = 0.50 # probability that a CDR mutation is silent p_CDR_affect = 1. - p_CDR_lethal - p_CDR_silent # probability that a CDR mutation affects affinity p_var = 0.10 # probability that a CDR mutation affects the variable region in the antigens used in the vaccine p_cons = 1.0 - p_var # probability that a CDR mutation affects the conserved (constant) region p_FR_lethal = 0.80 # probability that a framework (FR) mutation is lethal p_FR_silent = 0. # probability that a FR mutation is silent p_FR_affect = 1. - p_FR_lethal - p_FR_silent # probability that a FR mutation affects affinity length = 46 consLength = 18 epsilon = 1e-16 testpanelSize = 100 breadth_threshold = 20 alpha = 0.25 nb_GC_founders = 10 activation_energy = 9 delta_energy = 0.50 nb_seeding_cells = 15 dx_mutation = 1.0 dx_penalty = 1.0 h_high = 1.5 h_low = -1 nb_trial = 1000 energy_scale = 0.08 # inverse temperature E0 = 3.00 # mean binding energy for mixing with flexibility maxQ = 1 # max value for Q minQ = 1 # min value for Q sigmaQ = 0.00 # standard deviation for changes in flexibility with FR mutation help_cutoff = 0.70 # only B cells in the top (help_cutoff) fraction of binders receive T cell help p_recycle = 0.70 # probability that a B cell is recycled p_exit = 1. - p_recycle # probability that a B cell exits the GC mu = 1.9 # lognormal mean sigma = 0.5 # lognormal standard deviation corr = 0.0 # correlation between antigen variable regions o = 3.0 # lognormal offset mumat = mu * np.ones(length) sigmat = sigma * np.diag(np.ones(length)) # Upload dictionary of antigens import dictionary_little_code reload(dictionary_little_code) from dictionary_little_code import dicAgs from dictionary_little_code import dicconc from dictionary_little_code import dicGCDur from dictionary_little_code import flag #Upload seeding cells import seedingBcell reload(seedingBcell) from seedingBcell import seedingCells def create_test_panel(panelSize): varLength=length-consLength testPanel = {} for i in range(panelSize): #testAg = [] #for k in range(length-consLength): testAg=np.append(testAg,-1).tolist() testAg = (np.random.choice([-1, 1], varLength, p=[0.5, 0.5])).tolist() for j in range(consLength): testAg=np.append(testAg,1).tolist() testPanel.update({i: testAg}) #print(testPanel) return testPanel #Create test panel testpanel = create_test_panel(testpanelSize) ###### B cell clone class ###### class BCell: def __init__(self, nb = 512, **kwargs): """ Initialize clone-specific variables. nb - population size res - array of the values for each residue of the B cell E - total binding energy Ec - binding energy to the conserved residues Q - overlap parameter, proxy for rigidity (most 0 ---> 1 least flexible) nb_FR_mut - number of accumulated FR mutations nb_CDR_mut - number of accumulated CDR mutations antigens - list of antigens breadth - breadth against test panel nb_Ag - number of antigens available last_bound - number of individuals that last bound each Ag mut_res_id - index of mutated residue delta_res - incremental change at residue generation - generation in the GC reaction cycle_number - cycle number history - history of mutations, generation occurred, and effect on Q/Ec and breadth against test panel """ self.nb = nb # default starting population size = 512 (9 rounds of division) if 'res' in kwargs: self.res = np.array(kwargs['res']) else: print('res not recognized as an input argument') self.res = np.zeros(length) if 'E' in kwargs: self.E = kwargs['E'] else: self.E = sum(self.res) #assuming that the initializing Ag equals ones(length) if 'Ec' in kwargs: self.Ec = kwargs['Ec'] else: self.Ec = sum(self.res[i] for i in range(length-consLength, length)) if 'antigens' in kwargs: self.antigens = np.array(kwargs['antigens']) else: self.antigens = np.array([np.ones(length)]) if 'breadth' in kwargs: self.breadth = np.array(kwargs['breadth']) else: self.breadth = 0 if 'nb_Ag' in kwargs: self.nb_Ag = kwargs['nb_Ag'] elif np.shape(self.antigens)[0] == length: self.nb_Ag = 1 # assuming that the number of antigens in a cocktail is always smaller than the number of residues else: self.nb_Ag = np.shape(self.antigens)[0] if 'Q' in kwargs: self.Q = kwargs['Q'] else: self.Q = maxQ if 'nb_FR_mut' in kwargs: self.nb_FR_mut = kwargs['nb_FR_mut'] else: self.nb_FR_mut = 0 if 'nb_CDR_mut' in kwargs: self.nb_CDR_mut = kwargs['nb_CDR_mut'] else: self.nb_CDR_mut = 0 if 'last_bound' in kwargs: self.last_bound = kwargs['last_bound'] else: self.last_bound = np.random.multinomial(self.nb, pvals = [1/float(self.nb_Ag)] * self.nb_Ag) if 'mut_res_id' in kwargs: self.mut_res_id = kwargs['mut_res_id'] else: self.mut_res_id = length if 'mut_res_id_his' in kwargs: self.mut_res_id_his = kwargs['mut_res_id_his'] else: self.mut_res_id_his = [] if 'delta_e' in kwargs: self.delta_e = kwargs['delta_e'] else: self.delta_e = 0 if 'delta_res' in kwargs: self.delta_res = kwargs['delta_res'] else: self.delta_res = 0 if 'generation' in kwargs: self.generation = kwargs['generation'] else: self.generation = 0 if 'cycle_number' in kwargs: self.cycle_number = kwargs['cycle_number'] else: self.cycle_number = 2 if 'history' in kwargs: self.history = kwargs['history'] else: self.history = {'generation' : [self.generation], 'cycle_number' : [self.cycle_number], 'res' : [self.res], 'nb_CDR_mut' : [self.nb_CDR_mut], 'mut_res_id' : [self.mut_res_id], 'E' : [self.E], 'delta_res' : [self.delta_res], 'delta_e': [self.delta_e]} """ Return a new copy of the input BCell""" @classmethod def clone(cls, b): return cls(1, res = deepcopy(b.res), antigens = deepcopy(b.antigens), cycle_number = b.cycle_number, nb_Ag = b.nb_Ag, E = b.E, Ec = b.Ec, breadth = b.breadth, Q = b.Q, generation = b.generation, mut_res_id = b.mut_res_id, nb_FR_mut = b.nb_FR_mut, nb_CDR_mut = b.nb_CDR_mut, delta_res = b.delta_res, last_bound = deepcopy(b.last_bound), history = deepcopy(b.history), mut_res_id_his = b.mut_res_id_his, delta_e = b.delta_e) def update_history(self): """ Add current parameters to the history list. """ self.history['generation'].append(self.generation) self.history['res'].append(self.res) self.history['nb_CDR_mut'].append(self.nb_CDR_mut) self.history['mut_res_id'] = self.history['mut_res_id'] + [self.mut_res_id] #self.history['mut_res_id'].append(self.mut_res_id) self.history['E'].append(self.E) self.history['delta_res'].append(self.delta_res) self.history['cycle_number'].append(self.cycle_number) self.history['delta_e'].append(self.delta_e) def energy(self, Ag): """ Return binding energy with input antigen. """ return np.sum(np.multiply(self.res, Ag)) def conserved_energy(self): """ Return binding energy for conserved residues. """ return sum(self.res[i] for i in range(length-consLength, length)) def divide(self, cycle_number): """ Run one round of division. """ self.nb *= 2 self.generation += 1 self.cycle_number = cycle_number def pick_Antigen(self): """ Assuming nb_Ag > 1, return one antigen randomly chosen. """ return self.antigens[np.random.randint(self.nb_Ag)] def calculate_breadth(self, testpanel, threshold, panelSize): test_energies = [self.energy(testpanel[j]) for j in range(testpanelSize)] return float(sum(x > threshold for x in test_energies))/panelSize def update_antigens(self, newAntigens): self.antigens = deepcopy(newAntigens) if np.shape(newAntigens)[0] == length: self.nb_Ag = 1 else: self.nb_Ag = np.shape(newAntigens)[0] def mutate_CDR(self, Ag): ### change parameter of log normal for variable and conserved residues """ Change in energy due to affinity-affecting CDR mutation. Only one residue mutates.""" temp_res1 = deepcopy(self.res) temp_cp = deepcopy(self.res) index = np.random.randint(0, length) #randomly chosen residue to be mutated self.mut_res_id = index self.mut_res_id_his.extend([index]) delta = (o - np.exp(np.random.normal(mu, sigma))) self.delta_e = delta if delta > dx_mutation: delta = dx_mutation elif delta < -dx_mutation: delta = -dx_mutation self.delta_res = delta * Ag[index] temp_res1[index] += delta * Ag[index] if temp_res1[index] > h_high: temp_res1[index] = h_high elif temp_res1[index] < h_low: temp_res1[index] = h_low self.nb_CDR_mut += 1 self.Ec = self.conserved_energy() self.breadth = self.calculate_breadth(testpanel, breadth_threshold,testpanelSize) self.E = self.energy(Ag) self.res = deepcopy(temp_res1) self.update_history() if (index < length-consLength) and temp_cp[index] != h_high and temp_cp[index] != h_low: temp_res2 = deepcopy(self.res) indexPenalty = np.random.randint(0, consLength) + (length - consLength) self.mut_res_id = indexPenalty deltaPenalty = - alpha * delta self.delta_e = deltaPenalty if deltaPenalty > dx_penalty: deltaPenalty = dx_penalty elif deltaPenalty < -dx_penalty: deltaPenalty = -dx_penalty temp_res2[indexPenalty] += deltaPenalty if temp_res2[indexPenalty] > h_high: temp_res2[indexPenalty] = h_high elif temp_res2[indexPenalty] < h_low: temp_res2[indexPenalty] = h_low self.delta_res = deltaPenalty self.breadth = self.calculate_breadth(testpanel, breadth_threshold,testpanelSize) self.Ec = self.conserved_energy() self.E = self.energy(Ag) self.res = deepcopy(temp_res2) self.mut_res_id_his.extend([indexPenalty]) self.update_history() def mutate_FR(self): """ Change in flexibility due to affinity-affecting framework (FR) mutation. """ dQ = np.random.normal(0, sigmaQ) if self.Q + dQ > maxQ: self.Q = maxQ elif self.Q + dQ < minQ: self.Q = minQ #self.nb -= 1 else: self.Q = self.Q + dQ self.nb_FR_mut += 1 self.calculate_breadth(testpanel, breadth_threshold,testpanelSize) self.update_history() def shm(self,cycle_number): """ Run somatic hypermutation and return self + new B cell clones. """ # get number of cells that mutate, remove from the clone new_clones = [] n_mut = np.random.binomial(self.nb, p_mut) self.nb -= n_mut # get number of CDR vs framework (FR) mutations n_CDR = np.random.binomial(n_mut, p_CDR) n_FR = n_mut - n_CDR # process CDR mutations n_die, n_silent, n_affect = np.random.multinomial(n_CDR, pvals = [p_CDR_lethal, p_CDR_silent, p_CDR_affect]) self.nb += n_silent #add silent mutations to the parent clone for i in range(n_affect): b = BCell.clone(self) if b.nb_Ag > 1: Ag = b.pick_Antigen() else: Ag = b.antigens[0] b.mutate_CDR(Ag) new_clones.append(b) # process FR mutations n_die, n_silent, n_affect = np.random.multinomial(n_FR, pvals = [p_FR_lethal, p_FR_silent, p_FR_affect]) self.nb += n_silent for i in range(n_affect): b = BCell.clone(self) b.mutate_FR() new_clones.append(b) # return the result if (self.nb>0): new_clones.append(self) return new_clones ###### Main functions ###### def usage(): print("") def main(verbose=False): """ Simulate the affinity maturation process in a single germinal center (GC) and save the results to a CSV file. """ # Run multiple trials and save all data to file start = timer() fseed = open('seed.csv','w') fendmut = open('output-endmut.csv', 'w') fend = open('output-end.csv', 'w') ftot = open('output-total.csv', 'w') fbig = open('output-largest-clone.csv', 'w') fsurv = open('output-surv.csv','w') fend.write('trial,exit_cycle,number,generation,CDR_mutations,E,Ec,breadth,res0,res1,res2,res3,res4,res5,res6,res7,res8,res9,res10,res11,res12,res13,res14,res15,res16,res17,res18,res19,res20,res21,res22,res23,res24,res25,res26,res27,res28,res29,res30,res31,res32,res33,res34,res35,res36,res37,res38,res39,res40,res41,res42,res43,res44,res45\n') fendmut.write('trial,exit_cycle,number,generation,CDR_mutations,E,Ec,breadth,mut,res0,res1,res2,res3,res4,res5,res6,res7,res8,res9,res10,res11,res12,res13,res14,res15,res16,res17,res18,res19,res20,res21,res22,res23,res24,res25,res26,res27,res28,res29,res30,res31,res32,res33,res34,res35,res36,res37,res38,res39,res40,res41,res42,res43,res44,res45\n') ftot.write('trial,cycle,number recycled,number exit,mean E,mean Ec,mean breadth,mean nb CDR mut\n') fbig.write('trial,cycle,update,generation,CDR_mutations,E,delta_res,mut_res_index,res0,res1,res2,res3,res4,res5,res6,res7,res8,res9,res10,res11,res12,res13,res14,res15,res16,res17,res18,res19,res20,res21,res22,res23,res24,res25,res26,res27,res28,res29,res30,res31,res32,res33,res34,res35,res36,res37,res38,res39,res40,res41,res42,res43,res44,res45\n') fsurv.write('trial,cycle,survival rate\n') fseed.write('trial,exit_cycle,number,generation,CDR_mutations,E,Ec,breadth,mut,res0,res1,res2,res3,res4,res5,res6,res7,res8,res9,res10,res11,res12,res13,res14,res15,res16,res17,res18,res19,res20,res21,res22,res23,res24,res25,res26,res27,res28,res29,res30,res31,res32,res33,res34,res35,res36,res37,res38,res39,res40,res41,res42,res43,res44,res45\n') # Events of a trial for t in range(nb_trial): print_update(t, nb_trial) # status check # INITIALIZATION - DEFINE DATA STRUCTURES recycled_cells = [] exit_cells = [] # cells at the end of the simulation memory_cells = [] # exit cells from previous cycles nb_recycled = [] nb_exit = [] memory_founders = [] GC_survival_rate = [] # nb of B cells after selection / nb of B cells after dark zone # CYCLES 1 + 2 - CREATE FOUNDERS AND REPLICATE WITHOUT MUTATION nb_founders = nb_GC_founders #3 # number of founder B cells for a GC id_seeding_cells = np.random.choice(len(seedingCells), nb_founders, replace = False) print(id_seeding_cells) B_cells = [BCell(res = seedingCells[id_seeding_cells[i]]) for i in range(nb_founders)] # Update data #cycle 0 nb_recycled.append(nb_founders) # all founders are recycled nb_exit.append(0) # no founders exit the GC recycled_cells.append([deepcopy(b) for b in B_cells]) # add all cells of all 3 clones #cycle 1 nb_recycled.append(np.sum([b.nb for b in B_cells])) # all founders replicate and are recycled recycled_cells.append([deepcopy(b) for b in B_cells]) # add all cells of all 3 clones nb_exit.append(0) # no founders exit # AFFINITY MATURATION GC_size_max = nb_recycled[-1] # maximum number of cells in the GC (= initial population size) cycle_number = 2 if flag == 1: nb_cycle_max = 199 else: nb_cycle_max = len(dicAgs)+ cycle_number -1 # maximum number of GC cycles print(nb_cycle_max) while (cycle_number < nb_cycle_max): #for cycle_number in range(2, nb_cycle_max): cycleAntigens = np.array(dicAgs[cycle_number]) nb_Ag = find_nb_Ag(cycleAntigens) cycleconc = dicconc[cycle_number] cycledur = dicGCDur[cycle_number] if cycle_number < cycledur: # keep same GC B_cells, out_cells, GC_surv_fraction = run_GC_cycle(B_cells, cycleAntigens, cycleconc, nb_Ag, cycle_number) GC_survival_rate.append(GC_surv_fraction) elif cycle_number == cycledur: # start new GC print('starting new GC at cycle number %d' % (cycle_number)) memory_founders = pick_memCells_for_new_GC(memory_cells, nb_GC_founders) for b in memory_founders: fseed.write('%d,%d,%d,%d,%d,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf' % (t, b.cycle_number, b.nb, b.generation, b.nb_CDR_mut, b.E, b.Ec, b.breadth,b.res[0], b.res[1], b.res[2], b.res[3], b.res[4], b.res[5], b.res[6], b.res[7], b.res[8], b.res[9], b.res[10], b.res[11], b.res[12], b.res[13], b.res[14], b.res[15], b.res[16], b.res[17], b.res[18], b.res[19],b.res[20], b.res[21], b.res[22], b.res[23], b.res[24], b.res[25], b.res[26], b.res[27], b.res[28], b.res[29],b.res[30], b.res[31], b.res[32], b.res[33], b.res[34], b.res[35], b.res[36], b.res[37], b.res[38], b.res[39],b.res[40], b.res[41], b.res[42], b.res[43], b.res[44], b.res[45])) fseed.write('\n') B_cells, out_cells, GC_surv_fraction = run_GC_cycle(memory_founders, cycleAntigens, cycleconc, nb_Ag, cycle_number) GC_survival_rate.append(GC_surv_fraction) else: print('error in starting a GC') print(cycle_number) GC_size = np.sum([b.nb for b in B_cells]) # total number of cells in the GC if (cycle_number == nb_cycle_max-1) or (GC_size>GC_size_max): # at the end, all B cells exit the GC out_cells += B_cells nb_exit.append(np.sum([b.nb for b in out_cells])) else: memory_cells += out_cells nb_exit.append(np.sum([b.nb for b in out_cells])) out_cells = [] recycled_cells.append([deepcopy(b) for b in B_cells]) exit_cells.append(out_cells) nb_recycled.append(GC_size) if (nb_recycled[-1] == 0):break elif (GC_size>GC_size_max): cycle_number = cycledur else: cycle_number += 1 fseed.flush() for i in range(len(exit_cells)): for b in exit_cells[i]: if b.nb>50: fend.write('%d,%d,%d,%d,%d,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf' % (t, b.cycle_number, b.nb, b.generation, b.nb_CDR_mut, b.E, b.Ec, b.breadth,b.res[0], b.res[1], b.res[2], b.res[3], b.res[4], b.res[5], b.res[6], b.res[7], b.res[8], b.res[9], b.res[10], b.res[11], b.res[12], b.res[13], b.res[14], b.res[15], b.res[16], b.res[17], b.res[18], b.res[19],b.res[20], b.res[21], b.res[22], b.res[23], b.res[24], b.res[25], b.res[26], b.res[27], b.res[28], b.res[29],b.res[30], b.res[31], b.res[32], b.res[33], b.res[34], b.res[35], b.res[36], b.res[37], b.res[38], b.res[39],b.res[40], b.res[41], b.res[42], b.res[43], b.res[44], b.res[45])) fend.write('\n') fendmut.write('%d,%d,%d,%d,%d,%lf,%lf,%lf,%s,%s,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf' % (t, b.cycle_number, b.nb, b.generation, b.nb_CDR_mut, b.E, b.Ec, b.breadth,b.history['mut_res_id'],b.history['delta_e'],b.res[0], b.res[1], b.res[2], b.res[3], b.res[4], b.res[5], b.res[6], b.res[7], b.res[8], b.res[9], b.res[10], b.res[11], b.res[12], b.res[13], b.res[14], b.res[15], b.res[16], b.res[17], b.res[18], b.res[19],b.res[20], b.res[21], b.res[22], b.res[23], b.res[24], b.res[25], b.res[26], b.res[27], b.res[28], b.res[29],b.res[30], b.res[31], b.res[32], b.res[33], b.res[34], b.res[35], b.res[36], b.res[37], b.res[38], b.res[39],b.res[40], b.res[41], b.res[42], b.res[43], b.res[44], b.res[45])) fendmut.write('\n') fend.flush() fendmut.flush() for i in range(len(GC_survival_rate)): fsurv.write('%d,%d,%lf' % (t, i+2,GC_survival_rate[i])) fsurv.write('\n') fsurv.flush() for i in range(len(recycled_cells)): meanE = 0 meanEc = 0 meanBreadth = 0 meanCDRMutations = 0 count_clones = 0 if nb_recycled[i] > 0: for b in recycled_cells[i]: count_clones += 1 meanE += b.E meanEc += b.Ec meanBreadth += b.breadth meanCDRMutations += b.nb_CDR_mut meanE /= count_clones meanEc /= count_clones meanBreadth /= count_clones meanCDRMutations /= count_clones cycle = recycled_cells[i][0].cycle_number ftot.write('%d,%d,%d,%d,%lf,%lf,%lf,%lf\n' % (t, cycle, nb_recycled[i],nb_exit[i], meanE, meanEc, meanBreadth, meanCDRMutations)) ftot.flush() # End and output total time if len(exit_cells[-1])>0: for j in range(len(exit_cells[-1])): b = exit_cells[-1][j] if b.nb>50: with open('history_largest_clone.csv', 'w') as h: w = csv.writer(h) w.writerows(b.history.items()) for i in range(len(b.history['E'])): fbig.write('%d,%d,%d,%d,%d,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\n' % (t, b.history['cycle_number'][i], i, b.history['generation'][i], b.history['nb_CDR_mut'][i], b.history['E'][i], b.history['delta_res'][i], b.history['mut_res_id'][i], b.history['res'][i][0], b.history['res'][i][1], b.history['res'][i][2], b.history['res'][i][3], b.history['res'][i][4], b.history['res'][i][5], b.history['res'][i][6], b.history['res'][i][7], b.history['res'][i][8], b.history['res'][i][9], b.history['res'][i][10], b.history['res'][i][11], b.history['res'][i][12], b.history['res'][i][13], b.history['res'][i][14], b.history['res'][i][15], b.history['res'][i][16], b.history['res'][i][17], b.history['res'][i][18], b.history['res'][i][19],b.history['res'][i][20], b.history['res'][i][21], b.history['res'][i][22], b.history['res'][i][23], b.history['res'][i][24], b.history['res'][i][25], b.history['res'][i][26], b.history['res'][i][27], b.history['res'][i][28], b.history['res'][i][29],b.history['res'][i][30], b.history['res'][i][31], b.history['res'][i][32], b.history['res'][i][33], b.history['res'][i][34], b.history['res'][i][35], b.history['res'][i][36], b.history['res'][i][37], b.history['res'][i][38], b.history['res'][i][39],b.history['res'][i][40], b.history['res'][i][41], b.history['res'][i][42], b.history['res'][i][43], b.history['res'][i][44], b.history['res'][i][45])) fbig.write('%d,%d,%d,%d,%d,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf\n' % (t, b.cycle_number, len(b.history['E']), b.generation, b.nb_CDR_mut, b.E, b.delta_res, b.mut_res_id, b.res[0], b.res[1], b.res[2], b.res[3], b.res[4], b.res[5], b.res[6], b.res[7], b.res[8], b.res[9], b.res[10], b.res[11], b.res[12], b.res[13], b.res[14], b.res[15], b.res[16], b.res[17], b.res[18], b.res[19],b.res[20], b.res[21], b.res[22], b.res[23], b.res[24], b.res[25], b.res[26], b.res[27], b.res[28], b.res[29],b.res[30], b.res[31], b.res[32], b.res[33], b.res[34], b.res[35], b.res[36], b.res[37], b.res[38], b.res[39],b.res[40], b.res[41], b.res[42], b.res[43], b.res[44], b.res[45])) fbig.flush() fend.close() fendmut.close() ftot.close() fbig.close() fsurv.close() fseed.close() end = timer() print('\nTotal time: %lfs, average per cycle %lfs' % ((end - start),(end - start)/float(nb_trial))) def find_nb_Ag(antigens): if np.shape(antigens)[0]==length: nb_Ag=1 else: nb_Ag=np.shape(antigens)[0] return nb_Ag def print_update(current, end, bar_length=20): """ Print an update of the simulation status. h/t Aravind Voggu on StackOverflow. """ percent = float(current) / end dash = ''.join(['-' for k in range(int(round(percent * bar_length)-1))]) + '>' space = ''.join([' ' for k in range(bar_length - len(dash))]) sys.stdout.write("\rSimulating: [{0}] {1}%".format(dash + space, int(round(percent * 100)))) sys.stdout.flush() def updating_antigens(B_cells, cycleAntigens): """ The antigens for all B cells are updated with the beginning of a new cycle. """ for b in B_cells: b.update_antigens(cycleAntigens) return B_cells def run_dark_zone(B_cells, cycle_number, nb_rounds = 2): """ B cells proliferate and undergo SHM in the dark zone. """ for i in range(nb_rounds): new_cells = [] for b in B_cells: b.divide(cycle_number) new_cells += b.shm(cycle_number) B_cells = new_cells return B_cells def run_binding_selection(B_cells, cycleconc, nb_Ag): """ Select B cells for binding to antigen. """ new_cells=[] for b in B_cells: b.last_bound = np.random.multinomial(b.nb, pvals = [1./float(nb_Ag)] * nb_Ag) for i in range(nb_Ag): # compute binding energy and chance of death ( = 1 - chance of survival ) Ag_bound = np.exp(energy_scale * (b.energy(b.antigens[i])-activation_energy)) factor = cycleconc * Ag_bound langmuir_conj = 1. / (1. + factor) # remove dead cells and update binding details n_die = np.random.binomial(b.last_bound[i], langmuir_conj) b.nb -= n_die b.last_bound[i] -= n_die if b.nb>0:new_cells.append(b) return new_cells def run_help_selection(B_cells, nb_Ag): """ Select B cells to receive T cell help. """ #nb_Ag = B_cells[0].nb_Ag # get binding energies binding_energy = [[b.energy(b.antigens[i]) for i in range(nb_Ag)] for b in B_cells] binding_energy_tot = [] for i in range(len(B_cells)): for j in range(nb_Ag): binding_energy_tot += [binding_energy[i][j]] * B_cells[i].last_bound[j] # cells in the top (help_cutoff) fraction of binders survive if len(binding_energy_tot)>0: cut_idx = np.max([0, int(np.floor(help_cutoff * len(binding_energy_tot)))-1]) energy_cutoff = np.array(binding_energy_tot)[np.argsort(binding_energy_tot)][::-1][cut_idx] n_die_tie = len(binding_energy_tot) - cut_idx - np.sum(binding_energy_tot < energy_cutoff) # kill all B cells below threshold for i in np.random.permutation(len(B_cells)): for j in np.random.permutation(nb_Ag): energy = binding_energy[i][j] if energy < energy_cutoff: B_cells[i].nb -= B_cells[i].last_bound[j] B_cells[i].last_bound[j] = 0 elif (energy == energy_cutoff) and (n_die_tie > 0): if B_cells[i].last_bound[j] < n_die_tie: B_cells[i].nb -= B_cells[i].last_bound[j] n_die_tie -= B_cells[i].last_bound[j] B_cells[i].last_bound[j] = 0 else: B_cells[i].nb -= n_die_tie B_cells[i].last_bound[j] -= n_die_tie n_die_tie = 0 cells_surv = np.sum([b.nb for b in B_cells]) return B_cells, cells_surv def run_recycle(B_cells): """ Randomly select B cells to be recycled back into the GC or to exit. """ new_cells = [] # cells that will remain in the GC exit_cells = [] # cells that will exit the GC n_tot = np.sum([b.nb for b in B_cells]) # total number of cells currently in the GC n_exit = int(np.floor(p_exit * n_tot)) # number of cells that will exit the GC b_exit = np.array([]) # index of cells that will exit the GC if (n_tot > 0) and (n_exit > 0): b_exit = np.random.choice(n_tot, n_exit, replace=False) idx = 0 for b in B_cells: # find which cells exit the GC n_exit = np.sum((idx <= b_exit) * (b_exit < idx + b.nb)) idx += b.nb b.nb -= n_exit # add remainder to recycled cells if (b.nb > 0): new_cells.append(b) # record exit cells if (n_exit > 0): exit_cells.append(deepcopy(b)) exit_cells[-1].nb = n_exit return new_cells, exit_cells def pick_memCells_for_new_GC(memory_cells, nb_GC_founders): n_mem_cells = len(memory_cells) id_new_founders = np.random.choice(n_mem_cells, nb_GC_founders, replace=False) new_founders = [memory_cells[id_new_founders[i]] for i in range(nb_GC_founders)] return new_founders def run_breadth_calculation(panel_energies, threshold, panelSize): average = np.mean(panel_energies) variance = np.var(panel_energies) breadth = float(sum(x > threshold for x in panel_energies))/panelSize return average, variance, breadth def run_GC_cycle(B_cells, cycleAntigens, cycleconc, nb_Ag, cycle_number): """ Run one cycle of the GC reaction. """ B_cells = updating_antigens(B_cells, cycleAntigens) # UPDATE antigens B_cells = run_dark_zone(B_cells, cycle_number) # DARK ZONE - two rounds of division + SHM + updates cycle_number total_cells = np.sum([b.nb for b in B_cells]) if total_cells == 0: print('GC extinct at cycle ', cycle_number) exit_cells = [] GC_surv_fraction = 0 else: B_cells = run_binding_selection(B_cells, cycleconc, nb_Ag) # LIGHT ZONE - selection for binding to Ag B_cells, cells_surv = run_help_selection(B_cells, nb_Ag) # LIGHT ZONE - selection to receive T cell help GC_surv_fraction = float(float(cells_surv)/float(total_cells)) B_cells, exit_cells = run_recycle(B_cells) return B_cells, exit_cells, GC_surv_fraction # RECYCLE - randomly pick exiting cells from the surviving B cells if __name__ == '__main__': main()
{"hexsha": "4fbc7977bcaba625bd6283115eab6f2e5cb1fb23", "size": 34329, "ext": "py", "lang": "Python", "max_stars_repo_path": "Mixture.py", "max_stars_repo_name": "vanouk/Affinity-Maturation-PNAS", "max_stars_repo_head_hexsha": "43839ef01c7164914eb8ef7b338d2a7b1ba769d2", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Mixture.py", "max_issues_repo_name": "vanouk/Affinity-Maturation-PNAS", "max_issues_repo_head_hexsha": "43839ef01c7164914eb8ef7b338d2a7b1ba769d2", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Mixture.py", "max_forks_repo_name": "vanouk/Affinity-Maturation-PNAS", "max_forks_repo_head_hexsha": "43839ef01c7164914eb8ef7b338d2a7b1ba769d2", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 53.8072100313, "max_line_length": 1557, "alphanum_fraction": 0.5737714469, "include": true, "reason": "import numpy,from scipy", "num_tokens": 9334}
from __future__ import print_function from __future__ import division import click import os import json import numpy as np import matplotlib.pyplot as plt def visualize_test_evaluation(input_file, output_folder, experiment_title = ''): assert os.path.isfile(input_file) with open(input_file) as infile: eval_dict = json.load(infile) dsc_list = eval_dict['dsc'] h95_list = eval_dict['h95'] vs_list = eval_dict['vs'] dsc_avg_list = [np.nanmean(np.array(item.values(), dtype='float32')) for item in dsc_list] h95_avg_list = [np.nanmean(np.array(item.values(), dtype='float32')) for item in h95_list] vs_avg_list = [np.nanmean(np.array(item.values(), dtype='float32')) for item in vs_list] x_axis = list(range(0, len(dsc_avg_list)*10, 10)) plt.plot(x_axis, dsc_avg_list, 'r', x_axis, vs_avg_list, 'g') plt.title('Average Dice Coefficient and Volume similarity \n' + experiment_title) plt.legend(['Avg. Dice Coefficient', 'Avg. Volume Similarity']) plt.text(0.4 * len(dsc_avg_list) * 10, 0.80, 'max. dice coefficient: ' + str(np.max(dsc_avg_list))) plt.text(0.4 * len(dsc_avg_list) * 10, 0.75, 'max. volume similarity: ' + str(np.max(vs_avg_list))) plt.savefig(os.path.join(output_folder, 'dice_vs_graph.png')) plt.close() plt.plot(x_axis, h95_avg_list, 'b') plt.title('Average Hausdorff distance \n' + experiment_title) plt.legend(['Avg. Housdorff distance']) plt.savefig(os.path.join(output_folder, 'h95.png')) plt.close() return 0 @click.command() @click.argument('input_file', type=click.STRING) @click.argument('output_folder', type=click.STRING) @click.option('--experiment_title', type=click.STRING, default='') def main(input_file, output_folder, experiment_title=''): visualize_test_evaluation(input_file, output_folder, experiment_title=experiment_title) return 0 if __name__ == '__main__': main()
{"hexsha": "2568acffc8448e974a76a6cfbfb678510a94b1da", "size": 1924, "ext": "py", "lang": "Python", "max_stars_repo_path": "model/tools/visulization.py", "max_stars_repo_name": "jingkunchen/MS-CMR_miccai_2019", "max_stars_repo_head_hexsha": "ce4b67e017c0891533efadbdce4947b1c4821d6c", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 14, "max_stars_repo_stars_event_min_datetime": "2019-08-29T07:34:29.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-07T13:16:39.000Z", "max_issues_repo_path": "model/tools/visulization.py", "max_issues_repo_name": "jingkunchen/MS-CMR_miccai_2019", "max_issues_repo_head_hexsha": "ce4b67e017c0891533efadbdce4947b1c4821d6c", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2020-11-03T05:07:43.000Z", "max_issues_repo_issues_event_max_datetime": "2021-05-07T12:03:24.000Z", "max_forks_repo_path": "model/tools/visulization.py", "max_forks_repo_name": "jingkunchen/MS-CMR_miccai_2019", "max_forks_repo_head_hexsha": "ce4b67e017c0891533efadbdce4947b1c4821d6c", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2019-09-12T07:04:08.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-29T18:50:42.000Z", "avg_line_length": 36.3018867925, "max_line_length": 103, "alphanum_fraction": 0.7115384615, "include": true, "reason": "import numpy", "num_tokens": 508}
import os from flask import Flask, request, render_template from numpy.lib.polynomial import poly from werkzeug.utils import secure_filename import base64 import cv2 import numpy as np from model import Model import glob import argparse import tifffile as tiff app = Flask(__name__) app.config['UPLOAD_IMAGES'] = 'upload_images' app.config['INFERENCE_RESULT'] = 'inference_output' os.makedirs(app.config['UPLOAD_IMAGES'], exist_ok=True) os.makedirs(app.config['INFERENCE_RESULT'], exist_ok=True) ALLOW_IMAGE_EXT = ['.png', '.jpg', '.jpeg', '.tif'] MODEL_MAPPING = dict( poly=('./checkpoints/yunnan', './checkpoints/mask'), tf_poly=('./checkpoints/jinan', './checkpoints/tf_mask'), det=('./checkpoints/tf_net', ) ) CUR_MODEL_NAME = None def parse_args(): parser = argparse.ArgumentParser(description='inference demo') parser.add_argument('--model_name', help='model name', default='poly') parser.add_argument( '--score-thr', type=float, default=0.5, help='score threshold (default: 0.3)') parser.add_argument( '--gpu_id', type=int, default=5, help='number of gpu to use') parser.add_argument( '--port', type=int, default=36644, help='mapping port') args = parser.parse_args() return args def allow_file(file): return os.path.splitext(file)[1].lower() in ALLOW_IMAGE_EXT def img2stream(img_path): img_stream = '' with open(img_path, mode='rb') as img_f: img_stream = img_f.read() img_stream = base64.b64encode(img_stream) img_stream = img_stream.decode('utf-8') return img_stream @app.route('/') def index(): return render_template('main.html') def dispatch_files(files): pan_file, ms_file, fusion_file = None, None, None for f in files: if 'pan' in f: pan_file = f elif 'ms' in f: ms_file = f elif 'fusion' in f: fusion_file = f else: raise ValueError('don\'t support') assert pan_file is not None and ms_file is not None and fusion_file is not None print(pan_file, ms_file, fusion_file) return pan_file, ms_file, fusion_file def read_tif(tif_file): img = tiff.imread(tif_file) img = img[:, :, :3][:, :, ::-1] img = img.copy() return img @app.route('/predict_box_tf', methods=['GET', 'POST']) def predict_box_tf(): if request.method == 'POST': if CUR_MODEL_NAME != 'det': init_model('det') files = request.files.getlist('file') if len(files) <= 0: return render_template('tf_det_base.html') input_paths = [] for file in files: # secure_filename好像不能读取中文名 filename = secure_filename(file.filename) print(f'读取文件:{filename}') if not allow_file(filename): print('格式不支持') continue file_path = os.path.join(app.config['UPLOAD_IMAGES'], filename) file.save(file_path) input_paths.append(file_path) pan_file, ms_file, fusion_file = dispatch_files(input_paths) bn = os.path.basename(fusion_file) src_img = read_tif(fusion_file) out_src_path = os.path.join(app.config['INFERENCE_RESULT'], os.path.splitext(bn)[0] + '_src.png') cv2.imwrite(out_src_path, src_img) result = model(pan_file) img = model.show_result(fusion_file, result, ret_det=True) out_det_path = os.path.join(app.config['INFERENCE_RESULT'], os.path.splitext(bn)[0] + '.png') cv2.imwrite(out_det_path, img) det_img_stream = img2stream(out_det_path) src_img_stream = img2stream(out_src_path) ret = dict( src_img_stream=src_img_stream, det_img_stream=det_img_stream ) return render_template('tf_det.html', **ret) return render_template('tf_det_base.html') @app.route('/predict_polygon_tf', methods=['GET', 'POST']) def predict_polygon_tf(): if request.method == 'POST': if CUR_MODEL_NAME != 'tf_poly': init_model('tf_poly') files = request.files.getlist('file') if len(files) <= 0: return render_template('tf_poly_base.html') input_paths = [] for file in files: # secure_filename好像不能读取中文名 filename = secure_filename(file.filename) print(f'读取文件:{filename}') if not allow_file(filename): print('格式不支持') continue file_path = os.path.join(app.config['UPLOAD_IMAGES'], filename) file.save(file_path) input_paths.append(file_path) pan_file, ms_file, fusion_file = dispatch_files(input_paths) bn = os.path.basename(fusion_file) src_img = read_tif(fusion_file) out_src_path = os.path.join(app.config['INFERENCE_RESULT'], os.path.splitext(bn)[0] + '_src.png') cv2.imwrite(out_src_path, src_img) result = model(pan_file) img, poly_point_num = model.show_result(fusion_file, result) out_poly_path = os.path.join(app.config['INFERENCE_RESULT'], 'poly_' + os.path.splitext(bn)[0] + '.png') cv2.imwrite(out_poly_path, img) result = mask_model(pan_file) img, mask_point_num = mask_model.show_result(fusion_file, result) out_mask_path = os.path.join(app.config['INFERENCE_RESULT'], 'mask_' + os.path.splitext(bn)[0] + '.png') cv2.imwrite(out_mask_path, img) src_img_stream = img2stream(out_src_path) poly_img_stream = img2stream(out_poly_path) mask_img_stream = img2stream(out_mask_path) mask_point_num = round(mask_point_num, 2) poly_point_num = round(poly_point_num, 2) ret = dict( src_img_stream=src_img_stream, mask_img_stream=mask_img_stream, poly_img_stream=poly_img_stream, mask_point_num=mask_point_num, poly_point_num=poly_point_num ) return render_template('tf_ret.html', **ret) # output_paths.append(out_img_path) return render_template('tf_poly_base.html') @app.route('/predict_polygon_rgb', methods=['GET', 'POST']) def predict_polygon_rgb(): if request.method == 'POST': if CUR_MODEL_NAME != 'poly': init_model('poly') files = request.files.getlist('file') if len(files) <= 0: return render_template('rgb_base.html') file = files[0] # secure_filename好像不能读取中文名 filename = secure_filename(file.filename) print(f'读取文件:{filename}') if not allow_file(filename): print('格式不支持') return render_template('rgb_base.html') file_path = os.path.join(app.config['UPLOAD_IMAGES'], filename) bn = os.path.basename(file_path) file.save(file_path) result = model(file_path) img, poly_point_num = model.show_result(file_path, result) out_poly_path = os.path.join(app.config['INFERENCE_RESULT'], f'poly_{bn}') cv2.imwrite(out_poly_path, img) result = mask_model(file_path) img, mask_point_num = mask_model.show_result(file_path, result) out_mask_path = os.path.join(app.config['INFERENCE_RESULT'], f'mask_{bn}') cv2.imwrite(out_mask_path, img) poly_img_stream = img2stream(out_poly_path) mask_img_stream = img2stream(out_mask_path) src_img_stream = img2stream(file_path) mask_point_num = round(mask_point_num, 2) poly_point_num = round(poly_point_num, 2) ret = dict( src_img_stream=src_img_stream, mask_img_stream=mask_img_stream, poly_img_stream=poly_img_stream, mask_point_num=mask_point_num, poly_point_num=poly_point_num ) return render_template('rgb_ret.html', **ret) return render_template('rgb_base.html') def get_model_info(model_dir): config_file = glob.glob(os.path.join(model_dir, '*.py'))[0] checkpoint_file = glob.glob(os.path.join(model_dir, '*.pth'))[0] return config_file, checkpoint_file def init_model(model_name): global model, mask_model model, mask_model = None, None CUR_MODEL_NAME = model_name model_dirs = MODEL_MAPPING[model_name] assert len(model_dirs) <= 2 config_file, checkpoint_file = get_model_info(model_dirs[0]) print('模型初始化', config_file, checkpoint_file) model = Model(config_file, checkpoint_file, args.score_thr, args.gpu_id) if len(model_dirs) > 1: config_file, checkpoint_file = get_model_info(model_dirs[1]) print('模型初始化', config_file, checkpoint_file) mask_model = Model(config_file, checkpoint_file, args.score_thr, args.gpu_id) if __name__ == '__main__': global args args = parse_args() print(args) init_model(args.model_name) app.run(host='0.0.0.0', port=args.port , debug=True)
{"hexsha": "50d4a2eed79040643823b1bdb578c9cc858d4bae", "size": 8988, "ext": "py", "lang": "Python", "max_stars_repo_path": "demo_server/app.py", "max_stars_repo_name": "abcxs/polyrnn", "max_stars_repo_head_hexsha": "92eee689fe62585529deb1c44fbf1c889f414fa2", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2021-06-01T08:33:56.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-12T14:54:09.000Z", "max_issues_repo_path": "demo_server/app.py", "max_issues_repo_name": "abcxs/polyrnn", "max_issues_repo_head_hexsha": "92eee689fe62585529deb1c44fbf1c889f414fa2", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "demo_server/app.py", "max_forks_repo_name": "abcxs/polyrnn", "max_forks_repo_head_hexsha": "92eee689fe62585529deb1c44fbf1c889f414fa2", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-06-01T08:34:00.000Z", "max_forks_repo_forks_event_max_datetime": "2021-06-01T08:34:00.000Z", "avg_line_length": 34.3053435115, "max_line_length": 112, "alphanum_fraction": 0.6412995105, "include": true, "reason": "import numpy,from numpy", "num_tokens": 2134}
# TODO add ToroidalGeometry, LinearGeometry and other structs that let you pick parameters (like Toroidal parameters to define a plasma)
{"hexsha": "1267474fe0097736fb0adc2675c8779f4873a3f0", "size": 136, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "src/geometry.jl", "max_stars_repo_name": "SebastianM-C/Plasma.jl", "max_stars_repo_head_hexsha": "e01f53c4ffa08f81971db9a04ee43f5f6d4abdf0", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 21, "max_stars_repo_stars_event_min_datetime": "2021-11-25T09:24:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-24T00:59:47.000Z", "max_issues_repo_path": "src/geometry.jl", "max_issues_repo_name": "SebastianM-C/Plasma.jl", "max_issues_repo_head_hexsha": "e01f53c4ffa08f81971db9a04ee43f5f6d4abdf0", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 12, "max_issues_repo_issues_event_min_datetime": "2021-11-25T09:49:50.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-21T13:51:40.000Z", "max_forks_repo_path": "src/geometry.jl", "max_forks_repo_name": "SebastianM-C/Plasma.jl", "max_forks_repo_head_hexsha": "e01f53c4ffa08f81971db9a04ee43f5f6d4abdf0", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2021-11-26T16:00:49.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-26T16:00:49.000Z", "avg_line_length": 136.0, "max_line_length": 136, "alphanum_fraction": 0.8308823529, "num_tokens": 27}
# This is an approximate model of an acceleration controlled differential drive. # The angular velocities and the orientation are updated using their closed form # expression, the position along x and y axes are updated with the midway constant # angular velocities. The error in this heuristic increases with time and # with higher curvature. L = 0.13 # m : distance between the wheels r = 0.033 # m : wheel radius # Creates a new state based upon the previous one assuming that the # specified control that was executed continuously from the beginning # of the time slot for the specified time. # Units: x : m; y : m; θ : rad; ω : rad/s; α : rad/s²; t : s function new_state(state, control, elapsed_time) x, y, θ, ω_left, ω_right = state α_left, α_right = control ω_left⁺ = ω_left + Δω(α_left, elapsed_time) ω_right⁺ = ω_right + Δω(α_right, elapsed_time) θ⁺ = θ + Δθ(ω_left, α_left, ω_right, α_right, elapsed_time) x⁺ = x + approximateΔx(θ, (ω_left + ω_left⁺)/2, (ω_right + ω_right⁺)/2, elapsed_time) y⁺ = y + approximateΔy(θ, (ω_left + ω_left⁺)/2, (ω_right + ω_right⁺)/2, elapsed_time) return [x⁺ y⁺ θ⁺ ω_left⁺ ω_right⁺] end # Change in the x position assuming constant angular velocities. # Units: θ : rad; ω : rad/s; t : s function approximateΔx(θ_init, ω_left, ω_right, elapsed_time) if ω_left != ω_right L/2.0 * (ω_left + ω_right)/(ω_right - ω_left) * (sin(θ_init + r/L * (ω_right - ω_left) * elapsed_time) - sin(θ_init)) else r/2.0 * (ω_left + ω_right) * cos(θ_init) * elapsed_time end end # Change in the y position assuming constant angular velocities. # Units: θ : rad; ω : rad/s; t : s function approximateΔy(θ_init, ω_left, ω_right, elapsed_time) if ω_left != ω_right L/2.0 * (ω_left + ω_right)/(ω_right - ω_left) * (cos(θ_init) - cos(θ_init + r/L * (ω_right - ω_left) * elapsed_time)) else r/2.0 * (ω_left + ω_right) * sin(θ_init) * elapsed_time end end # Change in the orientation after the specified time. # Units: ω : rad/s; α : rad/s²; t : s Δθ(ω_left_init, α_left, ω_right_init, α_right, elapsed_time) = r/L * (ω_right_init - ω_left_init) * elapsed_time + r/L * (α_right - α_left) * elapsed_time^2 / 2.0 # Change in the angular velocity over time. # Units: α : rad/s²; t : s Δω(α, elapsed_time) = α * elapsed_time # Creates a new state given with the specified x, y and orientation # components and the left and right wheel angular velocities. # The position components should be in identical coordinate systems, # e.g. world. # Units: x : m; y : m; θ : rad; ω : rad/s initial_state(x_world, y_world, θ_world, ω_left, ω_right) = [x_world y_world θ_world ω_left ω_right]
{"hexsha": "d017d4ed0f5be083549f5f5f9c3ca863416ac353", "size": 2691, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "model/AccelerationControlledDifferentialDrive.jl", "max_stars_repo_name": "grgomrton/robot-model", "max_stars_repo_head_hexsha": "e3c4fb37919a6cadc091a434d692e8f77bd809c6", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "model/AccelerationControlledDifferentialDrive.jl", "max_issues_repo_name": "grgomrton/robot-model", "max_issues_repo_head_hexsha": "e3c4fb37919a6cadc091a434d692e8f77bd809c6", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "model/AccelerationControlledDifferentialDrive.jl", "max_forks_repo_name": "grgomrton/robot-model", "max_forks_repo_head_hexsha": "e3c4fb37919a6cadc091a434d692e8f77bd809c6", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 44.1147540984, "max_line_length": 162, "alphanum_fraction": 0.6900780379, "num_tokens": 883}
# -*- mode: python; coding: utf-8 -* # Copyright (c) 2022 Radio Astronomy Software Group # Licensed under the 3-clause BSD License """ Estimate scalings on different axes from profiling data. NB: This script cannot tell the difference between lines that are hit once and axes with length 1. It is only useful for jobs where the number of MPI processes is smaller than each simulation axis. """ import numpy as np import line_profiler as lp import sys import os def _func_times(timings, Nlist, dt=1e-6): outarr = np.zeros(len(Nlist)) for key, values in timings.items(): if key[2] not in funcs_to_check: continue for lnum, nhits, time in values: if nhits in Nlist: ind = Nlist.index(nhits) outarr[ind] += dt * time / nhits # Time per hit. return outarr # Only include functions that are called in loops. funcs_to_check = ['interp', 'get_beam_jones', 'apply_beam', 'make_visibility', 'uvdata_to_task_iter', 'update_positions', 'coherency_calc'] profname = 'profdata/time_profile.lprof' axesname = 'profdata/time_profile_axes.npz' # Prepend path basepath = sys.argv[1] profname = os.path.join(basepath, profname) axesname = os.path.join(basepath, axesname) lstat = lp.load_stats(profname) axes_npz = np.load(axesname) axes = {k: axes_npz[k][0] for k in axes_npz.keys()} # Set up combinations of axes. Naxes = len(axes) combos = [ ('Ntimes',), ('Ntimes', 'Nfreqs'), ('Ntimes', 'Nfreqs', 'Nbls') ] if not axes['Nsrcs_loc'] == 1: combos.append(('Ntimes', 'Nfreqs', 'Nbls', 'Nsrcs_loc')) Nlist = [] for comb in combos: length = 1 for key in comb: length *= axes[key] Nlist.append(length) results = _func_times(lstat.timings, Nlist, dt=lstat.unit) print(Nlist) print(dict(zip(combos, results))) print(np.sum(np.array(Nlist) * np.array(results)))
{"hexsha": "e0f93fda7f2eff9a526e6b2a49475b5cbc36535b", "size": 1907, "ext": "py", "lang": "Python", "max_stars_repo_path": "benchmarking/analyze_runtimes.py", "max_stars_repo_name": "HERA-Team/pyuvsim", "max_stars_repo_head_hexsha": "d5ae72b06e4bad07433c3fc8073bebb43a3be399", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2018-01-28T07:00:00.000Z", "max_stars_repo_stars_event_max_datetime": "2018-03-05T15:55:51.000Z", "max_issues_repo_path": "benchmarking/analyze_runtimes.py", "max_issues_repo_name": "HERA-Team/pyuvsim", "max_issues_repo_head_hexsha": "d5ae72b06e4bad07433c3fc8073bebb43a3be399", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": 56, "max_issues_repo_issues_event_min_datetime": "2018-02-15T18:05:44.000Z", "max_issues_repo_issues_event_max_datetime": "2018-07-20T18:09:35.000Z", "max_forks_repo_path": "benchmarking/analyze_runtimes.py", "max_forks_repo_name": "HERA-Team/pyuvsim", "max_forks_repo_head_hexsha": "d5ae72b06e4bad07433c3fc8073bebb43a3be399", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.2428571429, "max_line_length": 78, "alphanum_fraction": 0.6680650236, "include": true, "reason": "import numpy", "num_tokens": 529}
C**************************************************************** C C File: out_cmde.f C Purpose: Routine to solve COMMON-MODE-OUTAGE C C Author: Walt Powell Date: 7 Mar 1995 C Modified: C Called by: apsoln C C**************************************************************** subroutine out_cmde (error) integer error include 'ipfinc/parametr.inc' include 'ipfinc/comm_mode.inc' include 'ipfinc/apcom.inc' include 'ipfinc/intbus.inc' include 'ipfinc/lfiles.inc' include 'ipfinc/prt.inc' include 'ipfinc/time1.inc' c Note: This variable can be changed with a symbolic debugger common /term_debug/ iterm common /sort_cmde/ num_sort, sort(200) integer num_sort, sort common /scratch/ kolum(MAXBUS), net(200), mtrx(MAXBUS), & last_out, comm_out(MAXBUS), num_isol, & isol(100) integer last_out, comm_out integer solv_cmde, status C Loop over all the outages do jout = 1, num_comm_mode ipbad(nout+jout) = iib ibad_rs(nout+jout) = 0 if (iterm .ne. 0) then write (*, 10000) jout, comm_mode(jout) else if (mod (jout, 10) .eq. 0) then ipct = 100.0 * float (jout) / float (num_comm_mode) write (*, 10000) jout, comm_mode(jout), ipct endif if (idebug .ne. 0) then write (dbug, 10000) jout, comm_mode(jout) 10000 format (' Commom-mode outage No. ', i4, 2x, a, & ' % completed ', i4) endif C Copy base-case voltage and angle to EI and THI C as initial guesses call fvmov(vmag, 1, ei, 1, nbus) call fvmov(vangle, 1, thi, 1, nbus) error = 0 c c Modify data as imputed by outage. Note that subroutine c "ymod_cmde" defines array "sort(num_sort)", which consists c of the list of deleted buses. c noconv = 0 call ymod_cmde (jout, -1, noconv) iq = nbus - 1 c c Check for isolated subsystems c call cknt_cmde (jout, error) if (error .eq. 0) then C Form and factor B' and B" matrices call fvmov(vmag, 1, ei, 1, nbus) call bprim() call bdprim() C Find power flow for outage status = solv_cmde (noconv, iqsww, jout) if ( noconv .eq. 1 .and. ipqsln .eq. 0 ) then c############# solv_cmde pass 2 with no reactive ################### noconv = 0 c allow 2 "bad" entries c iib = iib - 1 c ibad(iib) = 0 c bad(iib) = 0. ibad_rs(nout+jout) = 1 ipqsln = 1 call fvmov(vmag, 1, ei, 1, nbus) call fvmov(vangle, 1, thi, 1, nbus) if (iqsww .ne. 0) then do i = 1, igenq k = iqlim(i) if (k .gt. 0) then C First check any BQ_min or BQ_max which were restored C to PV. if (qstate(i) .eq. 1) then C Unconditionally restore all other PQ_limit buses C to PV. if (ipqv(k) .lt. 0) ipqv(k) = 0 elseif (qstate(i) .eq. 3) then ipqv(k) = - 1 qnet1(k) = qlow(i) elseif (qstate(i) .eq. 4) then ipqv(k) = - 2 qnet1(k) = qhi(i) endif endif enddo endif call bprim() call bdprim() ilog = solv_cmde(noconv, iqsww, jout) ipqsln = 0 if ( noconv .eq. 1 ) ibad_rs(nout+jout) = 2 endif c######## End of solv_cmde pass 2 ################################### C Test for abnormal errors if (status .gt. 0) then iflag = 4 if (iib .lt. MXIBAD) then ibad(iib) = 0 bad(iib) = iflag iib = iib + 1 elseif (iib .eq. MXIBAD) then ibad(iib) = 0 bad(iib) = iflag iib = iib + 1 write (errbuf(1), 10010) jout, nout, iflag, iib 10010 format (' Overflow of "IBAD" array: ', & 'JOUT,NOUT,IFLAG,IIB = ', 4i8) call prterx('E', 1) endif noconv = 1 if (iterm .ne. 0) write (*, 10020) jout if (idebug .ne. 0) write (dbug, 10020) jout 10020 format ('0 Abnormal termination - Outage ', i4) endif else noconv = 1 c c Flag individual buses "Outage isolates buses" c do k = 1, num_isol iflag = -isol(k) if (iib .lt. MXIBAD) then ibad(iib) = 0 bad(iib) = iflag iib = iib + 1 elseif (iib .eq. MXIBAD) then ibad(iib) = 0 bad(iib) = iflag iib = iib + 1 write (errbuf(1), 10010) jout, nout, iflag, iib call prterx('E', 1) endif enddo endif C Restore admittance array to original form call ymod_cmde(jout, 1, noconv) C Check limits if (noconv .eq. 0) then call check(jout+nout) else endif C Clean up IPQV array and restore B" before next outage if (iqsww .ne. 0) then do i = 1, igenq k = iqlim(i) if (k .gt. 0) then C First check any BQ_min or BQ_max which were c restored to PV. if (qstate(i) .eq. 1) then C Unconditionally restore all other PQ_limit buses C to PV. if (ipqv(k) .lt. 0) ipqv(k) = 0 elseif (qstate(i) .eq. 3) then ipqv(k) = - 1 qnet1(k) = qlow(i) elseif (qstate(i) .eq. 4) then ipqv(k) = - 2 qnet1(k) = qhi(i) endif endif enddo endif if (iib .gt. MXIBAD) goto 900 ipbad(nout+num_comm_mode+1) = iib enddo goto 910 900 do i = jout+nout+1, nout+num_comm_mode+1 ipbad(i) = iib enddo 910 return end
{"hexsha": "d3cc425db15abeeefd5a8e9c40a39c8fa7bbba87", "size": 6974, "ext": "f", "lang": "FORTRAN", "max_stars_repo_path": "ipf/out_cmde.f", "max_stars_repo_name": "mbheinen/bpa-ipf-tsp", "max_stars_repo_head_hexsha": "bf07dd456bb7d40046c37f06bcd36b7207fa6d90", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 14, "max_stars_repo_stars_event_min_datetime": "2020-04-02T15:34:42.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-24T08:57:45.000Z", "max_issues_repo_path": "ipf/out_cmde.f", "max_issues_repo_name": "cuihantao/bpa-ipf-tsp", "max_issues_repo_head_hexsha": "cb2d0917ae42eff571017e9162f550f87900b83f", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 11, "max_issues_repo_issues_event_min_datetime": "2020-02-08T14:21:23.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-13T01:27:56.000Z", "max_forks_repo_path": "ipf/out_cmde.f", "max_forks_repo_name": "mbheinen/bpa-ipf-tsp", "max_forks_repo_head_hexsha": "bf07dd456bb7d40046c37f06bcd36b7207fa6d90", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 14, "max_forks_repo_forks_event_min_datetime": "2020-02-03T04:26:58.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-20T15:04:31.000Z", "avg_line_length": 30.5877192982, "max_line_length": 74, "alphanum_fraction": 0.4208488672, "num_tokens": 1937}
# -*- coding: utf-8 -*- """ Project: neurohacking File: helpers.py Author: wffirilat """ import numpy as np from numpy.fft import fft, rfft import plugin_interface as plugintypes from open_bci_v3 import OpenBCISample class PluginHelpers(plugintypes.IPluginExtended): def __init__(self): self.packetnum = -1 self.ticknum = -1 self.storelength = 1024 self.rawdata = np.zeros((8, self.storelength)) self.data = np.zeros((8, self.storelength)) def activate(self): print("helpers activated") # called with each new sample def __call__(self, sample: OpenBCISample): self.ticknum += 1 if sample.id == 0: self.packetnum += 1 self.rawdata[:, (sample.id + 256 * self.packetnum) % self.storelength] = sample.channel_data self.data[:, (sample.id + 256 * self.packetnum) % self.storelength] = [v - avg for avg, v in zip( [sum(self.rawdata[i, :]) / self.storelength for i in range(8)], sample.channel_data )] self.print(sample) def channelHistory(self, channel): d = list(self.data[channel, self.ticknum % self.storelength:]) d.extend(self.data[channel, :self.ticknum%self.storelength]) return d def minmax(self, sample): print(min(self.data[3, :]), max(self.data[3, :])) def print(self, sample): # print(self.data[3,-1]) print(rfft(self.channelHistory(3))) def thresholdDetect(self, sample): if self.data[3, (sample.id + 256 * self.packetnum) % self.storelength] > 1000: print((sample.id + 256 * self.packetnum))
{"hexsha": "8620a278157169d2532fc920a61686f7c5d4aa59", "size": 1641, "ext": "py", "lang": "Python", "max_stars_repo_path": "plugins/helpers.py", "max_stars_repo_name": "wffirilat/Neurohacking", "max_stars_repo_head_hexsha": "4407566ddb1b4a19a27f585a0050ab04b2bc5efe", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2018-11-03T19:14:22.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-25T23:50:58.000Z", "max_issues_repo_path": "plugins/helpers.py", "max_issues_repo_name": "kayla-e774/Neurohacking", "max_issues_repo_head_hexsha": "4407566ddb1b4a19a27f585a0050ab04b2bc5efe", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2018-01-22T23:21:36.000Z", "max_issues_repo_issues_event_max_datetime": "2018-01-22T23:31:27.000Z", "max_forks_repo_path": "plugins/helpers.py", "max_forks_repo_name": "kayla-e774/Neurohacking", "max_forks_repo_head_hexsha": "4407566ddb1b4a19a27f585a0050ab04b2bc5efe", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 1, "max_forks_repo_forks_event_min_datetime": "2018-09-12T02:50:16.000Z", "max_forks_repo_forks_event_max_datetime": "2018-09-12T02:50:16.000Z", "avg_line_length": 31.5576923077, "max_line_length": 105, "alphanum_fraction": 0.6215722121, "include": true, "reason": "import numpy,from numpy", "num_tokens": 427}
/* High Performance Astrophysical Reconstruction and Processing (HARP) (c) 2014-2015, The Regents of the University of California, through Lawrence Berkeley National Laboratory. See top level LICENSE file for details. */ // Test that we can instantiate our plugin. #include <iostream> #include <cstdio> #include <string> #include <harp_mpi.hpp> #include <boost/property_tree/ptree.hpp> #include <boost/property_tree/json_parser.hpp> #include <boost/property_tree/ptree_serialization.hpp> using namespace std; using namespace harp; int main ( int argc, char *argv[] ) { elem::Initialize ( argc, argv ); boost::mpi::environment env; boost::property_tree::ptree params; cout << endl; cout << "Testing plugin registration..." << endl; bool reg_debug = true; plugin_registry & reg = plugin_registry::get( reg_debug ); cout << "Testing instantiation of example spec type" << endl; spec_p testspec ( reg.create_spec ( "example", params ) ); cout << "Testing instantiation of example psf type" << endl; psf_p testpsf ( reg.create_psf ( "example", params ) ); cout << "Testing instantiation of example image type" << endl; image_p testimage ( reg.create_image ( "example", params ) ); cout << endl; cout << "PASSED" << endl << endl; elem::Finalize(); return 0; }
{"hexsha": "eb3314bd78101b0ad193eb2ae1dc9fe4f6b46fdb", "size": 1320, "ext": "cpp", "lang": "C++", "max_stars_repo_path": "plugin_example/harp_mpi_example.cpp", "max_stars_repo_name": "tskisner/HARP", "max_stars_repo_head_hexsha": "e21435511c3dc95ce1318c852002a95ca59634b1", "max_stars_repo_licenses": ["BSD-3-Clause-LBNL"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "plugin_example/harp_mpi_example.cpp", "max_issues_repo_name": "tskisner/HARP", "max_issues_repo_head_hexsha": "e21435511c3dc95ce1318c852002a95ca59634b1", "max_issues_repo_licenses": ["BSD-3-Clause-LBNL"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "plugin_example/harp_mpi_example.cpp", "max_forks_repo_name": "tskisner/HARP", "max_forks_repo_head_hexsha": "e21435511c3dc95ce1318c852002a95ca59634b1", "max_forks_repo_licenses": ["BSD-3-Clause-LBNL"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 22.7586206897, "max_line_length": 69, "alphanum_fraction": 0.7007575758, "num_tokens": 323}
function PascalDistribution(arg0::jint, arg1::jdouble) return PascalDistribution((jint, jdouble), arg0, arg1) end function cumulative_probability(obj::PascalDistribution, arg0::jint) return jcall(obj, "cumulativeProbability", jdouble, (jint,), arg0) end function get_number_of_successes(obj::PascalDistribution) return jcall(obj, "getNumberOfSuccesses", jint, ()) end function get_numerical_mean(obj::PascalDistribution) return jcall(obj, "getNumericalMean", jdouble, ()) end function get_numerical_variance(obj::PascalDistribution) return jcall(obj, "getNumericalVariance", jdouble, ()) end function get_probability_of_success(obj::PascalDistribution) return jcall(obj, "getProbabilityOfSuccess", jdouble, ()) end function get_support_lower_bound(obj::PascalDistribution) return jcall(obj, "getSupportLowerBound", jint, ()) end function get_support_upper_bound(obj::PascalDistribution) return jcall(obj, "getSupportUpperBound", jint, ()) end function is_support_connected(obj::PascalDistribution) return jcall(obj, "isSupportConnected", jboolean, ()) end function log_probability(obj::PascalDistribution, arg0::jint) return jcall(obj, "logProbability", jdouble, (jint,), arg0) end function probability(obj::PascalDistribution, arg0::jint) return jcall(obj, "probability", jdouble, (jint,), arg0) end
{"hexsha": "9c5959395cc59c93e500896a9bd13774605cff2a", "size": 1356, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "gen/HipparchusWrapper/DistributionWrapper/DiscreteWrapper/pascal_distribution.jl", "max_stars_repo_name": "JuliaAstrodynamics/Orekit.jl", "max_stars_repo_head_hexsha": "e2dd3d8b2085dcbb1d2c75471dab42d6ddf52c99", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2020-09-07T12:26:02.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T16:02:35.000Z", "max_issues_repo_path": "gen/HipparchusWrapper/DistributionWrapper/DiscreteWrapper/pascal_distribution.jl", "max_issues_repo_name": "JuliaSpace/Orekit.jl", "max_issues_repo_head_hexsha": "e2dd3d8b2085dcbb1d2c75471dab42d6ddf52c99", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 2, "max_issues_repo_issues_event_min_datetime": "2020-09-05T10:16:29.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-30T05:17:19.000Z", "max_forks_repo_path": "gen/HipparchusWrapper/DistributionWrapper/DiscreteWrapper/pascal_distribution.jl", "max_forks_repo_name": "JuliaSpace/Orekit.jl", "max_forks_repo_head_hexsha": "e2dd3d8b2085dcbb1d2c75471dab42d6ddf52c99", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.1333333333, "max_line_length": 70, "alphanum_fraction": 0.7721238938, "num_tokens": 344}
#include "Media/MediaSinkPad.h" #include "Media/IMediaFilter.h" #include <boost/foreach.hpp> //SharedMediaFormat MediaSinkPad::accept(SharedMediaPad sourcePad, SharedMediaFormat format) //{} // //SharedMediaFormat MediaSinkPad::onAccept(SharedMediaPad sourcePad, SharedMediaFormat format) //{ // SharedMediaFormats sourceMediaFormats=sourcePad->queryMediaFormats(); // SharedMediaFormats sinkMediaFormats=queryMediaFormats(); // // if(format == SharedMediaFormat()) // { // BOOST_FOREACH(SharedMediaFormat &sourceFormat, sourceMediaFormats) // { // BOOST_FOREACH(SharedMediaFormat &sinkFormat, sinkMediaFormats) // { // if(sourceFormat == sinkFormat) // { // return sourceFormat; // } // } // } // } // else // { // BOOST_FOREACH(SharedMediaFormat &sourceFormat, sourceMediaFormats) // { // if(sourceFormat != format) // continue; // // BOOST_FOREACH(SharedMediaFormat &sinkFormat, sinkMediaFormats) // { // if(sinkFormat == format) // { // return sourceFormat; // } // } // } // } // return SharedMediaFormat(); //} // //bool MediaSinkPad::link(SharedMediaPad sourcePad); //{ // if(m_state == INIT) // { // SharedMediaFormat acceptedFormat=accept(sourcePad, format); // // if(acceptedFormat != SharedMediaFormat()) // { // m_linkedSourcePad=sourcePad; // m_state=LINKED; // return true; // } // } // return false; //} // //SharedMediaFormat MediaSinkPad::connect(SharedMediaPad sourcePad, SharedMediaFormat format) //{ // if(m_state == INIT) // link(sourcePad); // // if(m_state == LINKED) // { // SharedMediaFormat acceptedFormat=parent()->connectPad(share_from_this(), sourcePad); // // if(acceptedFormat != SharedMediaFormat()) // { // m_state=CONNECTED; // } // return acceptedFormat; //// SharedMediaFormat acceptedFormat=accept(sourcePad, format); //// //// if(acceptedFormat != SharedMediaFormat()) //// m_connectedSourcePad=sourcePad; //// return acceptedFormat; // } //} //bool MediaSinkPad::onAccept(SharedMediaFormat format) //{ //// SharedMediaFormats sourceMediaFormats=sourcePad->queryMediaFormats(); // SharedMediaFormats sinkMediaFormats=queryMediaFormats(); // // BOOST_FOREACH(SharedMediaFormat &sinkFormat, sinkMediaFormats) // { // if(sinkFormat->match(format)) // return true; // } // return false; //} //bool MediaSinkPad::onLink(SharedMediaPad mediaPad, SharedMediaFormat format) //{ // SharedMediaFormats mediaFormats=queryMediaFormats(); // // BOOST_FOREACH(SharedMediaFormat &mediaFormat, mediaFormats) // { // if(mediaPad->accept(mediaFormat)) // return true; // } // return false; //} // //SharedMediaFormat MediaSinkPad::onConnect(SharedMediaPad mediaPad, SharedMediaFormat format) //{ // SharedMediaFormats sourceMediaFormats=mediaPad->queryMediaFormats(); // SharedMediaFormats sinkMediaFormats=queryMediaFormats(); // // if(format == SharedMediaFormat()) // { // BOOST_FOREACH(SharedMediaFormat &sourceFormat, sourceMediaFormats) // { // BOOST_FOREACH(SharedMediaFormat &sinkFormat, sinkMediaFormats) // { // if(sourceFormat == sinkFormat) // { // return sourceFormat; // } // } // } // } // else // { // BOOST_FOREACH(SharedMediaFormat &sourceFormat, sourceMediaFormats) // { // if(sourceFormat != format) // continue; // // BOOST_FOREACH(SharedMediaFormat &sinkFormat, sinkMediaFormats) // { // if(sinkFormat == format) // { // return sinkFormat; // } // } // } // } // return SharedMediaFormat(); //} // //void MediaSinkPad::disconnect() //{ // m_connectedSourcePad=SharedMediaPad(); //} // //bool MediaSinkPad::connected() //{ // if(m_connectedSourcePad != SharedMediaPad()) // return true; // return false; //} //bool MediaSinkPad::processSample(SharedMediaSample mediaSample) //{ // return parent()->processSample(shared_from_this(), mediaSample); //}
{"hexsha": "8377d37d54fc1dc4852429a733d433f9b7fa6ead", "size": 3824, "ext": "cpp", "lang": "C++", "max_stars_repo_path": "sdk/Media/MediaSinkPad.cpp", "max_stars_repo_name": "InfiniteInteractive/LimitlessSDK", "max_stars_repo_head_hexsha": "cb71dde14d8c59cbf8a1ece765989c5787fffefa", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 3.0, "max_stars_repo_stars_event_min_datetime": "2017-05-13T20:36:03.000Z", "max_stars_repo_stars_event_max_datetime": "2021-07-16T17:23:01.000Z", "max_issues_repo_path": "sdk/Media/MediaSinkPad.cpp", "max_issues_repo_name": "InfiniteInteractive/LimitlessSDK", "max_issues_repo_head_hexsha": "cb71dde14d8c59cbf8a1ece765989c5787fffefa", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "sdk/Media/MediaSinkPad.cpp", "max_forks_repo_name": "InfiniteInteractive/LimitlessSDK", "max_forks_repo_head_hexsha": "cb71dde14d8c59cbf8a1ece765989c5787fffefa", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2.0, "max_forks_repo_forks_event_min_datetime": "2016-08-04T00:16:50.000Z", "max_forks_repo_forks_event_max_datetime": "2017-09-07T14:50:03.000Z", "avg_line_length": 23.9, "max_line_length": 94, "alphanum_fraction": 0.6919456067, "num_tokens": 1008}
#include <boost/asio/bind_executor.hpp> #include <boost/asio/signal_set.hpp> #include <cstdlib> #include <memory> #include <thread> #include <vector> #include "http_listener.h" int main(int argc, char *argv[]) { auto const address = boost::asio::ip::make_address("0.0.0.0"); auto const port = 8080; auto const threads = 8; // The io_context is required for all I/O boost::asio::io_context ioc{threads}; // Create and launch a listening port std::make_shared<HttpListener>(ioc, boost::asio::ip::tcp::endpoint{address, port})->run(); // Capture SIGINT and SIGTERM to perform a clean shutdown boost::asio::signal_set signals(ioc, SIGINT, SIGTERM); signals.async_wait([&](boost::beast::error_code const &, int) { // Stop the `io_context`. This will cause `run()` // to return immediately, eventually destroying the // `io_context` and all of the sockets in it. ioc.stop(); }); // Run the I/O service on the requested number of threads std::vector<std::thread> v; v.reserve(threads - 1); for (auto i = threads - 1; i > 0; --i) v.emplace_back( [&ioc] { ioc.run(); }); ioc.run(); // (If we get here, it means we got a SIGINT or SIGTERM) // Block until all the threads exit for (auto &t: v) t.join(); return EXIT_SUCCESS; }
{"hexsha": "05d7ab8c0c815c4336b4d661c8270e28083d37b1", "size": 1445, "ext": "cpp", "lang": "C++", "max_stars_repo_path": "jeprof_in_use/src/main.cpp", "max_stars_repo_name": "phantom9999/mithril", "max_stars_repo_head_hexsha": "d7c5ff22a6396a77f7f92a1ee20706573e065c13", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "jeprof_in_use/src/main.cpp", "max_issues_repo_name": "phantom9999/mithril", "max_issues_repo_head_hexsha": "d7c5ff22a6396a77f7f92a1ee20706573e065c13", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "jeprof_in_use/src/main.cpp", "max_forks_repo_name": "phantom9999/mithril", "max_forks_repo_head_hexsha": "d7c5ff22a6396a77f7f92a1ee20706573e065c13", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 30.1041666667, "max_line_length": 94, "alphanum_fraction": 0.5944636678, "num_tokens": 367}
# -*- coding:utf-8 -*- # @author leone # @desc 摄像头实时人脸识别 # @version 2018-12-13 import cv2 import dlib import numpy as np import pandas as pd # 人脸识别模型,提取 128D 的特征矢量 face_recognition_model = dlib.face_recognition_model_v1("../data/data_dlib/dlib_face_recognition_resnet_model_v1.dat") # 计算两个向量间的欧式距离 def return_euclidean_distance(feature_1, feature_2): feature_1 = np.array(feature_1) feature_2 = np.array(feature_2) dist = np.sqrt(np.sum(np.square(feature_1 - feature_2))) print("e_distance: ", dist) if dist > 0.4: return "diff" else: return "same" # 处理存放所有人脸特征的 CSV path_features_known_csv = "../data/features_all.csv" csv_rd = pd.read_csv(path_features_known_csv, header=None) # 存储的特征人脸个数 print(csv_rd.shape[0]) # 用来存放所有录入人脸特征的数组 features_known_arr = [] # known faces for i in range(csv_rd.shape[0]): features_someone_arr = [] for j in range(0, len(csv_rd.loc[i, :])): features_someone_arr.append(csv_rd.loc[i, :][j]) # print(features_someone_arr) features_known_arr.append(features_someone_arr) print("Faces in Database:", len(features_known_arr)) # Dlib 检测器和预测器 detector = dlib.get_frontal_face_detector() predictor = dlib.shape_predictor('../data/data_dlib/shape_predictor_68_face_landmarks.dat') # 创建 cv2 摄像头对象 cap = cv2.VideoCapture(0) # cap.set(propId, value) # 设置视频参数,propId 设置的视频参数,value 设置的参数值 cap.set(3, 480) # 返回一张图像多张人脸的 128D 特征 def get_128d_features(img_gray): faces = detector(img_gray, 1) if len(faces) != 0: face_des = [] for i in range(len(faces)): shape = predictor(img_gray, faces[i]) face_des.append(face_recognition_model.compute_face_descriptor(img_gray, shape)) else: face_des = [] return face_des # cap.isOpened() 返回 True/False 检查初始化是否成功 while cap.isOpened(): flag, img_rd = cap.read() kk = cv2.waitKey(1) # 取灰度 img_gray = cv2.cvtColor(img_rd, cv2.COLOR_RGB2GRAY) # 人脸数 faces faces = detector(img_gray, 0) # 待会要写的字体 font = cv2.FONT_HERSHEY_COMPLEX cv2.putText(img_rd, "Press 'q': Quit", (20, 450), font, 0.8, (84, 255, 159), 1, cv2.LINE_AA) # 存储人脸名字和位置的两个 list # list 1 (faces): store the name of faces Jack unknown unknown Mary # list 2 (pos_namelist): store the positions of faces 12,1 1,21 1,13 31,1 pos_namelist = [] name_namelist = [] # 按下 q 键退出 if kk == ord('q'): break else: # 检测到人脸 if len(faces) != 0: # 获取当前捕获到的图像的所有人脸的特征,存储到 features_cap_arr features_cap_arr = [] for i in range(len(faces)): shape = predictor(img_rd, faces[i]) features_cap_arr.append(face_recognition_model.compute_face_descriptor(img_rd, shape)) # 遍历捕获到的图像中所有的人脸 for k in range(len(faces)): # 让人名跟随在矩形框的下方 # 确定人名的位置坐标 # 先默认所有人不认识,是 unknown name_namelist.append("未知") # 每个捕获人脸的名字坐标 pos_namelist.append( tuple([faces[k].left(), int(faces[k].bottom() + (faces[k].bottom() - faces[k].top()) / 4)])) # 对于某张人脸,遍历所有存储的人脸特征 for i in range(len(features_known_arr)): print("with person_", str(i + 1), "the ", end='') # 将某张人脸与存储的所有人脸数据进行比对 compare = return_euclidean_distance(features_cap_arr[k], features_known_arr[i]) if compare == "same": # 找到了相似脸 name_namelist[k] = "person_" + str(i + 1) # 矩形框 for kk, d in enumerate(faces): # 绘制矩形框 cv2.rectangle(img_rd, tuple([d.left(), d.top()]), tuple([d.right(), d.bottom()]), (0, 255, 255), 2) # 在人脸框下面写人脸名字 for i in range(len(faces)): cv2.putText(img_rd, name_namelist[i], pos_namelist[i], font, 0.8, (0, 255, 255), 1, cv2.LINE_AA) print("匹配的人脸列表:", name_namelist, "\n") cv2.putText(img_rd, "Face Recognition", (20, 40), font, 1, (0, 0, 0), 1, cv2.LINE_AA) cv2.putText(img_rd, "Faces: " + str(len(faces)), (20, 100), font, 1, (0, 0, 255), 1, cv2.LINE_AA) # 窗口显示 cv2.imshow("camera", img_rd) # 释放摄像头 cap.release() # 删除建立的窗口 cv2.destroyAllWindows()
{"hexsha": "c2f1e595271b4f3ed787f0a5d7a1f6a0ff3932a9", "size": 4350, "ext": "py", "lang": "Python", "max_stars_repo_path": "src/recognition_from_camera.py", "max_stars_repo_name": "janlle/dlib-face-recognition", "max_stars_repo_head_hexsha": "394b3665612dd98d5a9104545b1efa55b146e52b", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 13, "max_stars_repo_stars_event_min_datetime": "2020-01-16T02:18:45.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-23T09:23:43.000Z", "max_issues_repo_path": "src/recognition_from_camera.py", "max_issues_repo_name": "janlle/dlib-face-recognition", "max_issues_repo_head_hexsha": "394b3665612dd98d5a9104545b1efa55b146e52b", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/recognition_from_camera.py", "max_forks_repo_name": "janlle/dlib-face-recognition", "max_forks_repo_head_hexsha": "394b3665612dd98d5a9104545b1efa55b146e52b", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 4, "max_forks_repo_forks_event_min_datetime": "2020-01-16T02:18:47.000Z", "max_forks_repo_forks_event_max_datetime": "2020-10-30T13:35:56.000Z", "avg_line_length": 29.0, "max_line_length": 119, "alphanum_fraction": 0.6032183908, "include": true, "reason": "import numpy", "num_tokens": 1531}
import math import os import numpy as np from file_handling import binary_classes from margrie_libs.signal_processing.metadata_handling import store_meta_data def detrend_single_channel(trace): from scipy.signal import savgol_filter return trace - savgol_filter(trace, 1001, 3) def detrend_all_channels_savgol(array): from scipy.signal import savgol_filter detrended_data = array - savgol_filter(array, 1001, 3, axis=0) return detrended_data.astype(int) def detrend_all_channels_gaussian(array): from scipy.ndimage.filters import gaussian_filter1d detrended_data = array - gaussian_filter1d(array, sigma=100, axis=0) return detrended_data def denoise_detrend(array, n_chan, detrending_func=detrend_all_channels_gaussian): detrend_array = detrending_func(array) new_data = chunk_wise_common_average_ref(detrend_array, n_chan) return new_data.astype(int) def median_subtract(array): trace_medians = np.median(array, axis=0) return (array-trace_medians).astype(int) def median_subtract_and_car(array, n_chan): detrend_array = median_subtract(array) denoised_median_subtracted = chunk_wise_common_average_ref(detrend_array, n_chan) return denoised_median_subtracted # # def normalise_denoise_detrend(array, n_chan): # detrended = denoise_detrend(array, n_chan=n_chan) # normalised_detrended = detrended/np.std(detrended, axis=0) # return normalised_detrended def common_average_reference(array): return np.median(array, axis=1).reshape(array.shape[0], 1) def chunk_wise_common_average_ref(array, n_chan, n_chan_per_block=77): # 40 # TODO: n_chan_per_chunk needs to be automatically adjusted for different numbers of channels. # TODO: (cont.) enforce minimum number of channels if n_chan % n_chan_per_block != 0: raise ValueError('n_chan_per_chunk {} must be multiple of n_chan_tot {}'.format(n_chan_per_block, n_chan)) n_chunks = math.ceil(n_chan / n_chan_per_block) median_array = np.zeros_like(array) for i in range(n_chunks): block_median = common_average_reference(array[:, n_chan_per_block * i:n_chan_per_block * (i + 1)]) median_array[:, (n_chan_per_block * i):(n_chan_per_block * (i + 1))] = block_median denoised = array - median_array return denoised def _get_file_size(f_in_path): file_info = os.stat(f_in_path) file_size = file_info.st_size return file_size def _reshape_data(data, chunk): n_samples = int(chunk.size/chunk.byte_width/chunk.n_chan) reshaped_data = np.array(data).reshape(n_samples, chunk.n_chan) return reshaped_data def get_alpha(file_path, shape): data = np.memmap(file_path, shape=shape, dtype='int16') total_size = 2**15 # signed alpha = total_size/max(data.max(), np.abs(data.min())) return alpha def _scale_to_int16(file_path, data, alpha): store_meta_data(file_path, 'alpha', alpha) # scale factor needs to be stored in meta data for loading back data_int16 = (data*alpha) return data_int16.astype(int) def _make_packable(file_path, data, chunk, alpha): data = _scale_to_int16(file_path, data, alpha) # data must be scaled properly to avoid data loss data = data.reshape(int(chunk.size/chunk.byte_width)) return tuple(data) def process_to_file(f_in_path, f_out_path, path_to_meta_data, n_chan, process_data_func=denoise_detrend, n_samples_to_process=50000): file_size = _get_file_size(f_in_path) data_point = binary_classes.DataPoint() time_point = binary_classes.TimePoint(data_point, n_chan) chunk = binary_classes.Chunk(time_point, n_samples_to_process) # define normal chunk leftover_bytes = file_size % chunk.size # this is a problem if the last chunk is very small leftover_samples = int(leftover_bytes/time_point.size) last_chunk = binary_classes.Chunk(time_point, leftover_samples) # define final chunk print('chunk size is {}, last chunk is {} bytes:'.format(chunk.size, leftover_bytes)) print('leftover samples = {}'.format(leftover_samples)) n_chunks = math.ceil(file_size/chunk.size) with open(f_in_path, 'rb') as f_in: with open(f_out_path, 'wb') as f_out: for i in range(n_chunks): print('chunk: {} of {}'.format(i+1, n_chunks)) try: chunk_in = f_in.read(chunk.size) # read 1 set of channels except EOFError: break if int(len(chunk_in)) == last_chunk.size: current_chunk = last_chunk else: current_chunk = chunk if not chunk_in: print('break line reached') break if not current_chunk: print('break line reached') break data = current_chunk.s.unpack_from(chunk_in) data = _reshape_data(data, current_chunk) # reshape data to array processed_data = process_data_func(data, n_chan) # carry out processing steps packable_new_data = _make_packable(path_to_meta_data, processed_data, current_chunk) # put data into packable form chunk_out = current_chunk.s.pack(*packable_new_data) # pack bytes_written = f_out.write(bytes(chunk_out))
{"hexsha": "aded0748d07b5aba731492c8e6d26c668b0cd2e0", "size": 5541, "ext": "py", "lang": "Python", "max_stars_repo_path": "margrie_libs/margrie_libs/signal_processing/detrending.py", "max_stars_repo_name": "Sepidak/spikeGUI", "max_stars_repo_head_hexsha": "25ae60160308c0a34e7180f3e39a1c4dc6aad708", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "margrie_libs/margrie_libs/signal_processing/detrending.py", "max_issues_repo_name": "Sepidak/spikeGUI", "max_issues_repo_head_hexsha": "25ae60160308c0a34e7180f3e39a1c4dc6aad708", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2021-08-09T21:51:41.000Z", "max_issues_repo_issues_event_max_datetime": "2021-08-09T21:51:45.000Z", "max_forks_repo_path": "margrie_libs/margrie_libs/signal_processing/detrending.py", "max_forks_repo_name": "Sepidak/spikeGUI", "max_forks_repo_head_hexsha": "25ae60160308c0a34e7180f3e39a1c4dc6aad708", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 3, "max_forks_repo_forks_event_min_datetime": "2021-10-16T14:07:59.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-16T17:09:03.000Z", "avg_line_length": 35.7483870968, "max_line_length": 132, "alphanum_fraction": 0.6780364555, "include": true, "reason": "import numpy,from scipy", "num_tokens": 1288}
import paddle import numpy as np import argparse import os import os.path as osp import sys import time import json from mmcv import Config from dataset import build_data_loader from models import build_model from utils import ResultFormat, AverageMeter # import warnings # warnings.filterwarnings('ignore') def test(test_loader, model, cfg): model.eval() rf = ResultFormat(cfg.data.test.type, cfg.test_cfg.result_path) for idx, data_ in enumerate(test_loader): print('Testing %d/%d' % (idx, len(test_loader))) sys.stdout.flush() # prepare input data = dict( imgs=data_[1], img_metas=dict( org_img_size=data_[0].shape[1:3], img_size=data_[1].shape[2:] ), cfg=cfg ) # forward with paddle.no_grad(): outputs = model(**data) # save result image_name, _ = osp.splitext(osp.basename(test_loader.dataset.img_paths[idx])) # print('image_name', image_name) rf.write_result(image_name, outputs) def main(args): cfg = Config.fromfile(args.config) # print(json.dumps(cfg._cfg_dict, indent=4)) sys.stdout.flush() # data loader test_dataset = build_data_loader(cfg.data.test) test_loader = paddle.io.DataLoader( test_dataset, batch_size=1, shuffle=False, num_workers=0, ) # model model = build_model(cfg.model) if args.checkpoint is not None and os.path.isfile(args.checkpoint): print("Loading model from checkpoint '{}'".format(args.checkpoint)) model.set_state_dict(paddle.load(args.checkpoint)) else: print("No checkpoint found at '{}'".format(args.checkpoint)) raise test(test_loader, model, cfg) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Hyperparams') parser.add_argument('config', help='config file path') parser.add_argument('checkpoint', nargs='?', type=str, default=None) args = parser.parse_args() main(args)
{"hexsha": "5641993c5962d89683172de67c502e2af1b0a939", "size": 2158, "ext": "py", "lang": "Python", "max_stars_repo_path": "test.py", "max_stars_repo_name": "RoseSakurai/PSENet_paddle", "max_stars_repo_head_hexsha": "6b45f95059724080932b116a98d5af14ea0e1640", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2021-05-13T15:24:53.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-04T06:05:20.000Z", "max_issues_repo_path": "test.py", "max_issues_repo_name": "RoseSakurai/PSENet_paddle", "max_issues_repo_head_hexsha": "6b45f95059724080932b116a98d5af14ea0e1640", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "test.py", "max_forks_repo_name": "RoseSakurai/PSENet_paddle", "max_forks_repo_head_hexsha": "6b45f95059724080932b116a98d5af14ea0e1640", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 26.6419753086, "max_line_length": 87, "alphanum_fraction": 0.6195551437, "include": true, "reason": "import numpy", "num_tokens": 466}
""" Module implementing GAN which will be trained using the Progressive growing technique -> https://arxiv.org/abs/1710.10196 """ import datetime import os import time import timeit import copy import numpy as np import torch as th class Generator(th.nn.Module): """ Generator of the GAN network """ def __init__(self, depth=7, latent_size=512, use_eql=True): """ constructor for the Generator class :param depth: required depth of the Network :param latent_size: size of the latent manifold :param use_eql: whether to use equalized learning rate """ from torch.nn import ModuleList, Conv2d from MSG_GAN.CustomLayers import GenGeneralConvBlock, \ GenInitialBlock, _equalized_conv2d super().__init__() assert latent_size != 0 and ((latent_size & (latent_size - 1)) == 0), \ "latent size not a power of 2" if depth >= 4: assert latent_size >= np.power(2, depth - 4), "latent size will diminish to zero" # state of the generator: self.use_eql = use_eql self.depth = depth self.latent_size = latent_size # register the modules required for the Generator Below ... # create the ToRGB layers for various outputs: if self.use_eql: def to_rgb(in_channels): return _equalized_conv2d(in_channels, 3, (1, 1), bias=True) else: def to_rgb(in_channels): return Conv2d(in_channels, 3, (1, 1), bias=True) # create a module list of the other required general convolution blocks self.layers = ModuleList([GenInitialBlock(self.latent_size, use_eql=self.use_eql)]) self.rgb_converters = ModuleList([to_rgb(self.latent_size)]) # create the remaining layers for i in range(self.depth - 1): if i <= 2: layer = GenGeneralConvBlock(self.latent_size, self.latent_size, use_eql=self.use_eql) rgb = to_rgb(self.latent_size) else: layer = GenGeneralConvBlock( int(self.latent_size // np.power(2, i - 3)), int(self.latent_size // np.power(2, i - 2)), use_eql=self.use_eql ) rgb = to_rgb(int(self.latent_size // np.power(2, i - 2))) self.layers.append(layer) self.rgb_converters.append(rgb) def forward(self, x): """ forward pass of the Generator :param x: input noise :return: *y => output of the generator at various scales """ outputs = [] # initialize to empty list y = x # start the computational pipeline for block, converter in zip(self.layers, self.rgb_converters): y = block(y) outputs.append(converter(y)) return outputs @staticmethod def adjust_dynamic_range(data, drange_in=(-1, 1), drange_out=(0, 1)): """ adjust the dynamic colour range of the given input data :param data: input image data :param drange_in: original range of input :param drange_out: required range of output :return: img => colour range adjusted images """ if drange_in != drange_out: scale = (np.float32(drange_out[1]) - np.float32(drange_out[0])) / ( np.float32(drange_in[1]) - np.float32(drange_in[0])) bias = (np.float32(drange_out[0]) - np.float32(drange_in[0]) * scale) data = data * scale + bias return th.clamp(data, min=0, max=1) class Discriminator(th.nn.Module): """ Discriminator of the GAN """ def __init__(self, depth=7, feature_size=512, use_eql=True, gpu_parallelize=True): """ constructor for the class :param depth: total depth of the discriminator (Must be equal to the Generator depth) :param feature_size: size of the deepest features extracted (Must be equal to Generator latent_size) :param use_eql: whether to use the equalized learning rate or not :param gpu_parallelize: whether to use DataParallel on the discriminator Note that the Last block contains StdDev layer So, it is not parallelized. """ from torch.nn import ModuleList from MSG_GAN.CustomLayers import DisGeneralConvBlock, \ DisFinalBlock, _equalized_conv2d from torch.nn import Conv2d super().__init__() assert feature_size != 0 and ((feature_size & (feature_size - 1)) == 0), \ "latent size not a power of 2" if depth >= 4: assert feature_size >= np.power(2, depth - 4), \ "feature size cannot be produced" # create state of the object self.gpu_parallelize = gpu_parallelize self.use_eql = use_eql self.depth = depth self.feature_size = feature_size # create the fromRGB layers for various inputs: if self.use_eql: def from_rgb(out_channels): return _equalized_conv2d(3, out_channels, (1, 1), bias=True) else: def from_rgb(out_channels): return Conv2d(3, out_channels, (1, 1), bias=True) self.rgb_to_features = ModuleList() self.final_converter = from_rgb(self.feature_size // 2) # create a module list of the other required general convolution blocks self.layers = ModuleList() self.final_block = DisFinalBlock(self.feature_size, use_eql=self.use_eql) # create the remaining layers for i in range(self.depth - 1): if i > 2: layer = DisGeneralConvBlock( int(self.feature_size // np.power(2, i - 2)), int(self.feature_size // np.power(2, i - 2)), use_eql=self.use_eql ) rgb = from_rgb(int(self.feature_size // np.power(2, i - 1))) else: layer = DisGeneralConvBlock(self.feature_size, self.feature_size // 2, use_eql=self.use_eql) rgb = from_rgb(self.feature_size // 2) self.layers.append(layer) self.rgb_to_features.append(rgb) # just replace the last converter self.rgb_to_features[self.depth - 2] = \ from_rgb(self.feature_size // np.power(2, i - 2)) # parallelize the modules from the module-lists if asked to: if self.gpu_parallelize: for i in range(len(self.layers)): self.layers[i] = th.nn.DataParallel(self.layers[i]) self.rgb_to_features[i] = th.nn.DataParallel( self.rgb_to_features[i]) # Note that since the FinalBlock contains the StdDev layer, # it cannot be parallelized so easily. It will have to be parallelized # from the Lower level (from CustomLayers). This much parallelism # seems enough for me. def forward(self, inputs): """ forward pass of the discriminator :param inputs: (multi-scale input images) to the network list[Tensors] :return: out => raw prediction values """ assert len(inputs) == self.depth, \ "Mismatch between input and Network scales" y = self.rgb_to_features[self.depth - 2](inputs[self.depth - 1]) y = self.layers[self.depth - 2](y) for x, block, converter in \ zip(reversed(inputs[1:-1]), reversed(self.layers[:-1]), reversed(self.rgb_to_features[:-1])): input_part = converter(x) # convert the input: y = th.cat((input_part, y), dim=1) # concatenate the inputs: y = block(y) # apply the block # calculate the final block: input_part = self.final_converter(inputs[0]) y = th.cat((input_part, y), dim=1) y = self.final_block(y) # return calculated y return y class MSG_GAN: """ Unconditional TeacherGAN args: depth: depth of the GAN (will be used for each generator and discriminator) latent_size: latent size of the manifold used by the GAN use_eql: whether to use the equalized learning rate use_ema: whether to use exponential moving averages. ema_decay: value of ema decay. Used only if use_ema is True device: device to run the GAN on (GPU / CPU) """ def __init__(self, depth=7, latent_size=512, use_eql=True, use_ema=True, ema_decay=0.999, device=th.device("cpu")): """ constructor for the class """ from torch.nn import DataParallel self.gen = Generator(depth, latent_size, use_eql=use_eql).to(device) # Parallelize them if required: if device == "cuda": self.gen = DataParallel(self.gen) self.dis = Discriminator(depth, latent_size, use_eql=use_eql, gpu_parallelize=True).to(device) else: self.dis = Discriminator(depth, latent_size, use_eql=True).to(device) # state of the object self.use_ema = use_ema self.ema_decay = ema_decay self.use_eql = use_eql self.latent_size = latent_size self.depth = depth self.device = device if self.use_ema: from MSG_GAN.CustomLayers import update_average # create a shadow copy of the generator self.gen_shadow = copy.deepcopy(self.gen) # updater function: self.ema_updater = update_average # initialize the gen_shadow weights equal to the # weights of gen self.ema_updater(self.gen_shadow, self.gen, beta=0) # by default the generator and discriminator are in eval mode self.gen.eval() self.dis.eval() if self.use_ema: self.gen_shadow.eval() def generate_samples(self, num_samples): """ generate samples using this gan :param num_samples: number of samples to be generated :return: generated samples tensor: list[ Tensor(B x H x W x C)] """ noise = th.randn(num_samples, self.latent_size).to(self.device) generated_images = self.gen(noise) # reshape the generated images generated_images = list(map(lambda x: (x.detach().permute(0, 2, 3, 1) / 2) + 0.5, generated_images)) return generated_images def optimize_discriminator(self, dis_optim, noise, real_batch, loss_fn): """ performs one step of weight update on discriminator using the batch of data :param dis_optim: discriminator optimizer :param noise: input noise of sample generation :param real_batch: real samples batch should contain a list of tensors at different scales :param loss_fn: loss function to be used (object of GANLoss) :return: current loss """ # generate a batch of samples fake_samples = self.gen(noise) fake_samples = list(map(lambda x: x.detach(), fake_samples)) loss = loss_fn.dis_loss(real_batch, fake_samples) # optimize discriminator dis_optim.zero_grad() loss.backward() dis_optim.step() return loss.item() def optimize_generator(self, gen_optim, noise, real_batch, loss_fn): """ performs one step of weight update on generator using the batch of data :param gen_optim: generator optimizer :param noise: input noise of sample generation :param real_batch: real samples batch should contain a list of tensors at different scales :param loss_fn: loss function to be used (object of GANLoss) :return: current loss """ # generate a batch of samples fake_samples = self.gen(noise) loss = loss_fn.gen_loss(real_batch, fake_samples) # optimize discriminator gen_optim.zero_grad() loss.backward() gen_optim.step() # if self.use_ema is true, apply the moving average here: if self.use_ema: self.ema_updater(self.gen_shadow, self.gen, self.ema_decay) return loss.item() def create_grid(self, samples, img_files): """ utility function to create a grid of GAN samples :param samples: generated samples for storing list[Tensors] :param img_files: list of names of files to write :return: None (saves multiple files) """ from torchvision.utils import save_image from torch.nn.functional import interpolate from numpy import sqrt, power # dynamically adjust the colour of the images samples = [Generator.adjust_dynamic_range(sample) for sample in samples] # resize the samples to have same resolution: for i in range(len(samples)): samples[i] = interpolate(samples[i], scale_factor=power(2, self.depth - 1 - i)) # save the images: for sample, img_file in zip(samples, img_files): save_image(sample, img_file, nrow=int(sqrt(sample.shape[0])), normalize=True, scale_each=True, padding=0) def train(self, data, gen_optim, dis_optim, loss_fn, normalize_latents=True, start=1, num_epochs=12, feedback_factor=10, checkpoint_factor=1, data_percentage=100, num_samples=36, log_dir=None, sample_dir="./samples", save_dir="./models"): """ Method for training the network :param data: pytorch dataloader which iterates over images :param gen_optim: Optimizer for generator. please wrap this inside a Scheduler if you want to :param dis_optim: Optimizer for discriminator. please wrap this inside a Scheduler if you want to :param loss_fn: Object of GANLoss :param normalize_latents: whether to normalize the latent vectors during training :param start: starting epoch number :param num_epochs: total number of epochs to run for (ending epoch number) note this is absolute and not relative to start :param feedback_factor: number of logs generated and samples generated during training per epoch :param checkpoint_factor: save model after these many epochs :param data_percentage: amount of data to be used :param num_samples: number of samples to be drawn for feedback grid :param log_dir: path to directory for saving the loss.log file :param sample_dir: path to directory for saving generated samples' grids :param save_dir: path to directory for saving the trained models :return: None (writes multiple files to disk) """ from torch.nn.functional import avg_pool2d # turn the generator and discriminator into train mode self.gen.train() self.dis.train() assert isinstance(gen_optim, th.optim.Optimizer), \ "gen_optim is not an Optimizer" assert isinstance(dis_optim, th.optim.Optimizer), \ "dis_optim is not an Optimizer" print("Starting the training process ... ") # create fixed_input for debugging fixed_input = th.randn(num_samples, self.latent_size).to(self.device) if normalize_latents: fixed_input = (fixed_input / fixed_input.norm(dim=-1, keepdim=True) * (self.latent_size ** 0.5)) # create a global time counter global_time = time.time() global_step = 0 for epoch in range(start, num_epochs + 1): start_time = timeit.default_timer() # record time at the start of epoch print("\nEpoch: %d" % epoch) total_batches = len(iter(data)) limit = int((data_percentage / 100) * total_batches) for (i, batch) in enumerate(data, 1): # extract current batch of data for training images = batch.to(self.device) extracted_batch_size = images.shape[0] # create a list of downsampled images from the real images: images = [images] + [avg_pool2d(images, int(np.power(2, i))) for i in range(1, self.depth)] images = list(reversed(images)) # sample some random latent points gan_input = th.randn( extracted_batch_size, self.latent_size).to(self.device) # normalize them if asked if normalize_latents: gan_input = (gan_input / gan_input.norm(dim=-1, keepdim=True) * (self.latent_size ** 0.5)) # optimize the discriminator: dis_loss = self.optimize_discriminator(dis_optim, gan_input, images, loss_fn) # optimize the generator: gen_loss = self.optimize_generator(gen_optim, gan_input, images, loss_fn) # provide a loss feedback if i % (int(limit / feedback_factor) + 1) == 0 or i == 1: # Avoid div by 0 error on small training sets elapsed = time.time() - global_time elapsed = str(datetime.timedelta(seconds=elapsed)) print("Elapsed [%s] batch: %d d_loss: %f g_loss: %f" % (elapsed, i, dis_loss, gen_loss)) # also write the losses to the log file: if log_dir is not None: log_file = os.path.join(log_dir, "loss.log") os.makedirs(os.path.dirname(log_file), exist_ok=True) with open(log_file, "a") as log: log.write(str(global_step) + "\t" + str(dis_loss) + "\t" + str(gen_loss) + "\n") # create a grid of samples and save it reses = [str(int(np.power(2, dep))) + "_x_" + str(int(np.power(2, dep))) for dep in range(2, self.depth + 2)] gen_img_files = [os.path.join(sample_dir, res, "gen_" + str(epoch) + "_" + str(i) + ".png") for res in reses] # Make sure all the required directories exist # otherwise make them os.makedirs(sample_dir, exist_ok=True) for gen_img_file in gen_img_files: os.makedirs(os.path.dirname(gen_img_file), exist_ok=True) dis_optim.zero_grad() gen_optim.zero_grad() with th.no_grad(): if i % 2*(int(limit / feedback_factor) + 1) == 0: self.create_grid( self.gen(fixed_input) if not self.use_ema else self.gen_shadow(fixed_input), gen_img_files) # increment the global_step: global_step += 1 if i > limit: break # calculate the time required for the epoch stop_time = timeit.default_timer() print("Time taken for epoch: %.3f secs" % (stop_time - start_time)) if epoch % checkpoint_factor == 0 or epoch == 1 or epoch == num_epochs: os.makedirs(save_dir, exist_ok=True) gen_save_file = os.path.join(save_dir, "GAN_GEN_" + str(epoch) + ".pth") dis_save_file = os.path.join(save_dir, "GAN_DIS_" + str(epoch) + ".pth") gen_optim_save_file = os.path.join(save_dir, "GAN_GEN_OPTIM_" + str(epoch) + ".pth") dis_optim_save_file = os.path.join(save_dir, "GAN_DIS_OPTIM_" + str(epoch) + ".pth") th.save(self.gen.state_dict(), gen_save_file) th.save(self.dis.state_dict(), dis_save_file) th.save(gen_optim.state_dict(), gen_optim_save_file) th.save(dis_optim.state_dict(), dis_optim_save_file) if self.use_ema: gen_shadow_save_file = os.path.join(save_dir, "GAN_GEN_SHADOW_" + str(epoch) + ".pth") th.save(self.gen_shadow.state_dict(), gen_shadow_save_file) print("Training completed ...") # return the generator and discriminator back to eval mode self.gen.eval() self.dis.eval()
{"hexsha": "d24f2040dd603f46e6aeed183a0af5f8206d07cd", "size": 21510, "ext": "py", "lang": "Python", "max_stars_repo_path": "sourcecode/MSG_GAN/GAN.py", "max_stars_repo_name": "manojtld/BMSG-GAN", "max_stars_repo_head_hexsha": "b3d85cd4fa4dd648e05c7881457c39a6d5379cb5", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "sourcecode/MSG_GAN/GAN.py", "max_issues_repo_name": "manojtld/BMSG-GAN", "max_issues_repo_head_hexsha": "b3d85cd4fa4dd648e05c7881457c39a6d5379cb5", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "sourcecode/MSG_GAN/GAN.py", "max_forks_repo_name": "manojtld/BMSG-GAN", "max_forks_repo_head_hexsha": "b3d85cd4fa4dd648e05c7881457c39a6d5379cb5", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.4450867052, "max_line_length": 123, "alphanum_fraction": 0.5658763366, "include": true, "reason": "import numpy,from numpy", "num_tokens": 4556}
import time, copy import os, os.path import sys import numpy from PyQt4.QtCore import * from PyQt4.QtGui import * from scipy import optimize from echem_plate_ui import * from echem_plate_math import * homepath='C:/Users/Gregoire/Documents/CaltechWork/echemdrop/20130301_CuZnSnFe_Plate3_3654' mainapp=QApplication(sys.argv) form=MainMenu(None, execute=False, folderpath=homepath) echemvis=form.echem echemvis.expmntComboBox.setCurrentIndex(2) echemvis.expmntLineEdit.setText('CA5') echemvis.fillcalcoptions(batchmode=True) echemvis.calcoptionComboBox.setCurrentIndex(3) echemvis.get_techniquedictlist(nfiles=1) techdict=echemvis.techniquedictlist[0] echemvis.CalcParams=[0.4, 0.95, 0.4, 0.95, 'Ece(V)', 0.0, 0.8, 1] echemvis.calckeys=['Illum', 'I(A)', 'Ewe(V)', 't(s)'] ikey=echemvis.CalcParams[4] tshift=echemvis.CalcParams[5] if tshift!=0: newikey='IllumMod' techdict[newikey]=illumtimeshift(techdict, ikey, echemvis.calckeys[3], tshift) ikey=newikey if echemvis.CalcParams[7]!=0: techdict[ikey]*=-1 elif echemvis.CalcParams[7]!=0: newikey='IllumMod' techdict[newikey]=-1*techdict[ikey] ikey=newikey print ikey err=calcdiff_ill_caller(techdict, ikey=ikey, thresh=echemvis.CalcParams[6], ykeys=[echemvis.calckeys[1]], xkeys=list(echemvis.calckeys[2:]), illfracrange=(echemvis.CalcParams[0], echemvis.CalcParams[1]), darkfracrange=(echemvis.CalcParams[2], echemvis.CalcParams[3]))
{"hexsha": "3e39a7e6b490aff3c1e626932a3db19c6b1852c3", "size": 1459, "ext": "py", "lang": "Python", "max_stars_repo_path": "echem_testphoto.py", "max_stars_repo_name": "johnmgregoire/JCAPdatavis", "max_stars_repo_head_hexsha": "6d77a510e00acf31de9665828d27ea33aba6ab78", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "echem_testphoto.py", "max_issues_repo_name": "johnmgregoire/JCAPdatavis", "max_issues_repo_head_hexsha": "6d77a510e00acf31de9665828d27ea33aba6ab78", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "echem_testphoto.py", "max_forks_repo_name": "johnmgregoire/JCAPdatavis", "max_forks_repo_head_hexsha": "6d77a510e00acf31de9665828d27ea33aba6ab78", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.6078431373, "max_line_length": 267, "alphanum_fraction": 0.7511994517, "include": true, "reason": "import numpy,from scipy", "num_tokens": 497}
from fvcore.common.file_io import PathManager import xml.etree.ElementTree as ET from typing import Dict from tqdm import tqdm import numpy as np import os def bias_pascal_voc( dirname: str, noise_ratio: float, bias_rule: Dict[str, str] ): """ Add Noise to Pascal VOC detection annotations. Args: dirname: Contain "Annotations", "ImageSets", "JPEGImages" noise_ratio: Noise ratio of biased annotations bias_rule: Assymetric mislabel rules between classes """ annotation_dirname = PathManager.get_local_path( os.path.join(dirname, "Annotations/") ) annotation_files = np.array(PathManager.ls(annotation_dirname)) num_biased_files = round(len(annotation_files) * noise_ratio) np.random.shuffle(annotation_files) biased_files = set(annotation_files[:num_biased_files]) bias_stats = dict.fromkeys(["total", "mislabeled", "skipped"], 0) for filename in tqdm(annotation_files): anno_file = os.path.join(annotation_dirname, filename) with PathManager.open(anno_file) as f: tree = ET.parse(f) instances = tree.findall("object") num_instances = len(instances) bias_stats['total'] += num_instances if filename in biased_files: mislabel_ratio = round(num_instances*0.7) np.random.shuffle(instances) biased_instances = instances[:mislabel_ratio] for instance in biased_instances: cls_name = instance.find("name") if cls_name.text in bias_rule.keys(): biased_cls_name = bias_rule[cls_name.text] cls_name.text = biased_cls_name mislabel_attr = ET.SubElement(instance, "mislabeled") mislabel_attr.text = '1' bias_stats['mislabeled'] += 1 else: tree.getroot().remove(instance) bias_stats['skipped'] +=1 tree.write(anno_file) return bias_stats
{"hexsha": "2804b3fe9e9e71c922b4b225ad28edad7e927613", "size": 2103, "ext": "py", "lang": "Python", "max_stars_repo_path": "autoqa/add_noise.py", "max_stars_repo_name": "Umbrasi/qa-automation", "max_stars_repo_head_hexsha": "5ac1d97bc77289399132cf8fdda45bde3adb158b", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 4, "max_stars_repo_stars_event_min_datetime": "2020-08-14T12:52:33.000Z", "max_stars_repo_stars_event_max_datetime": "2021-01-13T15:31:28.000Z", "max_issues_repo_path": "autoqa/add_noise.py", "max_issues_repo_name": "Umbrasi/qa-automation", "max_issues_repo_head_hexsha": "5ac1d97bc77289399132cf8fdda45bde3adb158b", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "autoqa/add_noise.py", "max_forks_repo_name": "Umbrasi/qa-automation", "max_forks_repo_head_hexsha": "5ac1d97bc77289399132cf8fdda45bde3adb158b", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2020-09-17T13:40:40.000Z", "max_forks_repo_forks_event_max_datetime": "2020-09-18T13:55:35.000Z", "avg_line_length": 30.4782608696, "max_line_length": 73, "alphanum_fraction": 0.6153114598, "include": true, "reason": "import numpy", "num_tokens": 435}
#!/usr/bin/python3 """ Counterfactual explanation of a user query. Based on application on the knapsack problem of Korikov, A., & Beck, J. C. mming, CP2021. Counterfactual Explanations via Inverse Constraint Programming. Usecase: 1) Some optimal solution x* is provided to the user by a constraint optimization solver. 2) User enters a query to change solution variables x_i to a new value. The assigment of a subset of variables are called a foil. This extra set of constraints is used to generate a new optimal solution x_d 3) Using inverse optimization, we calculate the values of constraints in the objective function which result in x_d being the optimal solution. Extra constraint: only values corresponding to foil items are allowed to change. 4) The user is presented with the constraints which would have resulted in an optimal solution given the foil constraints. Intuition: Iteratively find new constraints vector d with minimal change from c. Improve the set of constraints in every iteration until x_d is optimal for the constraints given the objective function. Given: A constraint optimization problem (c, f, X) with an optimal solution x* A set of foil constraints assigning a value to variables in x*, resulting in x_d Find: d such that min(f(d,X)) == x_d and ||c - d|| is minimal The algorithm consists of 2 alternating problems: the master problem (MP), and the sub problem (SP) Algorithm: 1 S = {} 2 Solve MP to obtain optimal d* 3 Solve SP with d* as c to obtain x_0 4 if objective(x_d) > objective(x_0): add x_0 to S go to 2 else: return d* Master problem: Constraints: - constraints of original forward problem - objective(d*, x) >= objective(d*, x_0) forall x_0 in S - foil constraints assigning values to x_i - foil contraints restricting the altering of c to match the foil constraint indices Objective: - Minimize || c - d* ||_1 Sub problem: The original forward problem """ from cpmpy import * import numpy as np INFINITY = np.iinfo(np.int32).max verbose = True np.random.seed(0) def main(): n = 10 # Number of items in the knapsack m = 5 # Number of items to change in the knapsack values, weights, capacity = generate_knapsack_model(n) x = solve_knapsack_problem(values, weights, capacity) print_knapsack_model(values, weights, capacity, x) # We emulate a user query by selecting random items # These items are assigned the opposite value of the current solution # While generating this query, we ensure there exist a feasable solution. x_user, foil_items = generate_foil_knapsack(values, weights, capacity, x, m) # Pretty print user query pp_uquery(x, foil_items) # Find the values vector such that x_foil is optimal d_star = inverse_optimize(values, weights, capacity, x_user, foil_items) print( f"\n\nValues {d_star} results in a solution satisfying the user query being optimal" ) print(f"Optimal knapsack satisfying user query: {x_user}") print(f"Value of objective function using d* = {sum(d_star * x_user)}") def solve_knapsack_problem(values, weights, capacity): """ Ordinary 0-1 knapsack problem Solve for vector x ∈ {T,F}^n Based on the Numberjack model of Hakan Kjellerstrand """ x = boolvar(len(values), name="x") model = Model([sum(x * weights) <= capacity], maximize=sum(x * values)) if model.solve() is not False: return x.value() else: raise ValueError("Model is UNSAT") def generate_knapsack_model(n=10): """ Generation of a knapsack model Using same generation parameters as Korikov et al. """ R = 1000 values = np.random.randint(1, R, n) weights = np.random.randint(1, R, n) capacity = int(max([0.5 * sum(weights), R])) return values, weights, capacity def generate_foil_knapsack(values, weights, capacity, x, m, tries=1): """ Generate a set of foil constraints Pick m items and assign the opposite value. If this results in an unfeasable assignment (surpassing the capacity), try again @return A model """ n = len(x) foil_idx = np.random.choice(n, m, replace=False) foil_vals = np.abs(1 - x[foil_idx]) if sum(foil_vals * weights[foil_idx]) > capacity: if verbose: print(f"\rGenerated unfeasable user query, retrying...({tries})", end="") return generate_foil_knapsack(values, weights, capacity, x, m, tries + 1) else: return ( extend_to_full_solution(values, weights, capacity, foil_idx, foil_vals), foil_idx, ) def extend_to_full_solution(values, weights, capacity, foil_idx, foil_vals): """ Extend a given set of foil constraints to a full solution of the knapsack Formally: Given v and X, solve the COP (c, v ∩ X) """ xv = boolvar(shape=len(values), name="xv") constraints = [xv[foil_idx] == foil_vals] constraints += [sum(xv * weights) <= capacity] model = Model(constraints, maximize=sum(xv * values)) if model.solve() is not False: return xv.value() def make_master_problem(values, weights, capacity, x_d, foil_idx): """ Creates the master problem. Returns both the model itself as well as the variables used in it. This way the variables can be used to add new constraints outside this building function. """ d = intvar(0, INFINITY, values.shape, name="d") x = boolvar(shape=len(x_d), name="x") # Minimize the change to the values vector m = Model(minimize=np.linalg.norm(values - d, ord=1)) # The ususal knapsack constraint m += [sum(x * weights) <= capacity] # Ensure values are only modified at foil indices m += [d[i] == values[i] for i in range(len(values)) if i not in foil_idx] # Ensure the foil values assigned by the user remain the same m += [x[i] == bool(x_d[i]) for i in foil_idx] return m, d, x def make_sub_problem(values, weights, capacity): """ Creates the sub problem Returns both the model itself as well as the variables in it. This way the variables can be used to add new constraints outside this building function. """ x = boolvar(shape=len(values)) return Model([sum(weights * x) <= capacity]), x def inverse_optimize(values, weights, capacity, x_d, foil_idx): """ Master problem: iteratively find better values for the c vector (new values are vector d) Mapping of variable names to names in the paper (TODO: link papper) - c = values - d = d @param x_d: A feasable solution found in the foil set X_v @param foil_idx: A vector containing the items on which the user asked an explanation All other items must retain their original values """ if verbose: print(f"\n\n{'='*10} Solving the master problem {'='*10}") master_model, d, x = make_master_problem(values, weights, capacity, x_d, foil_idx) sub_model, x_0 = make_sub_problem(values, weights, capacity) i = 1 while master_model.solve() is not False: d_star = d.value() sub_model.maximize(sum(x_0 * d.value())) sub_model.solve() if verbose: print(f"\nStarting iteration {i}") print(f"d* = {d_star}") print(f"d* * x_d = {sum(d_star * x_d)}") print(f"d* * x_0 = {sum(d_star * x_0.value())}") if sum(d_star * x_d) >= sum(d_star * x_0.value()): return d_star else: master_model += [sum(d * x) >= sum(d * x_0.value())] i += 1 raise ValueError("Master model is UNSAT!") ############################################################################ # All functions below this line are purely used for pretty printing results# ############################################################################ def print_knapsack_model(values, weights, capacity, x): """ Pretty prints a knapsack model. """ print("Solution to the following knapsack problem") print("Values =", values) print("Weights = ", weights) print(f"Capacity: {capacity}") print("\nis:", x) print(f"Resulting in an objective value of {sum(x * values)}") print(f"Capacity used: {sum(x*weights)}") def pp_uquery(x, f_items): """ Function to pretty print the user query to solver. Has no computational effects """ include = sorted([str(a) for a in f_items[x[f_items] == 0]]) exclude = sorted([str(a) for a in f_items[x[f_items] == 1]]) print(f"\n\n{'='*10} User Query {'='*10}") print(f"I would like to change the following to the knapsack you provided:") if len(exclude) > 0: print(f"Leave out item{'s' if len(exclude) > 1 else ''} {','.join(exclude)}") if len(include) > 0: print(f"Put in item{'s' if len(include) > 1 else ''} {','.join(include)}") print( "How should the values corresponding to these items change to make this assignment optimal?" ) if __name__ == "__main__": main()
{"hexsha": "e5838f112a52745f7cdff9e96e9a589b1ade8c22", "size": 9119, "ext": "py", "lang": "Python", "max_stars_repo_path": "examples/advanced/counterfactual_explain.py", "max_stars_repo_name": "vishalbelsare/cpmpy", "max_stars_repo_head_hexsha": "42b1795d268c4e634d49d6d6aa2bb243aea67b0c", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 39, "max_stars_repo_stars_event_min_datetime": "2021-07-14T08:24:11.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-22T21:30:59.000Z", "max_issues_repo_path": "examples/advanced/counterfactual_explain.py", "max_issues_repo_name": "vishalbelsare/cpmpy", "max_issues_repo_head_hexsha": "42b1795d268c4e634d49d6d6aa2bb243aea67b0c", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 54, "max_issues_repo_issues_event_min_datetime": "2021-07-05T20:23:01.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-30T14:43:50.000Z", "max_forks_repo_path": "examples/advanced/counterfactual_explain.py", "max_forks_repo_name": "vishalbelsare/cpmpy", "max_forks_repo_head_hexsha": "42b1795d268c4e634d49d6d6aa2bb243aea67b0c", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 5, "max_forks_repo_forks_event_min_datetime": "2021-07-29T20:15:49.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-08T10:46:13.000Z", "avg_line_length": 34.5416666667, "max_line_length": 153, "alphanum_fraction": 0.6509485689, "include": true, "reason": "import numpy", "num_tokens": 2278}
section \<open>Commonly used Lemmas\<close> theory Common imports Main "HOL-Library.Extended_Nat" "HOL-Eisbach.Eisbach" begin declare [[coercion_enabled = false]] subsection \<open>Miscellaneous\<close> lemma split_sym_rel: fixes G :: "'a rel" assumes "sym G" "irrefl G" obtains E where "E\<inter>E\<inverse> = {}" "G = E \<union> E\<inverse>" proof - obtain R :: "'a rel" where WO: "well_order_on UNIV R" using Zorn.well_order_on .. let ?E = "G \<inter> R" from \<open>irrefl G\<close> have [simp, intro!]: "(x,x)\<notin>G" for x by (auto simp: irrefl_def) have "?E \<inter> ?E\<inverse> = {}" using WO unfolding well_order_on_def linear_order_on_def partial_order_on_def antisym_def by fastforce moreover have "G = ?E \<union> ?E\<inverse>" apply safe apply (simp_all add: symD[OF \<open>sym G\<close>]) using WO unfolding well_order_on_def linear_order_on_def total_on_def by force ultimately show ?thesis by (rule that) qed lemma least_antimono: "X\<noteq>{} \<Longrightarrow> X\<subseteq>Y \<Longrightarrow> (LEAST y::_::wellorder. y\<in>Y) \<le> (LEAST x. x\<in>X)" by (metis LeastI_ex Least_le equals0I rev_subsetD) lemma distinct_map_snd_inj: "distinct (map snd l) \<Longrightarrow> (a,b)\<in>set l \<Longrightarrow> (a',b)\<in>set l \<Longrightarrow> a=a'" by (metis distinct_map inj_onD prod.sel(2) prod.simps(1)) lemma map_add_apply: "(m\<^sub>1 ++ m\<^sub>2) k = (case m\<^sub>2 k of None \<Rightarrow> m\<^sub>1 k | Some x \<Rightarrow> Some x)" by (auto simp: map_add_def) lemma map_eq_append_conv: "map f xs = ys\<^sub>1@ys\<^sub>2 \<longleftrightarrow> (\<exists>xs\<^sub>1 xs\<^sub>2. xs = xs\<^sub>1@xs\<^sub>2 \<and> map f xs\<^sub>1 = ys\<^sub>1 \<and> map f xs\<^sub>2 = ys\<^sub>2)" apply rule subgoal apply (rule exI[where x="take (length ys\<^sub>1) xs"]) apply (rule exI[where x="drop (length ys\<^sub>1) xs"]) apply (drule sym) by (auto simp: append_eq_conv_conj take_map drop_map) subgoal by auto done lemma prod_case_const[simp]: "case_prod (\<lambda>_ _. c) = (\<lambda>_. c)" by auto lemma card2_eq: "card e = 2 \<longleftrightarrow> (\<exists>u v. u\<noteq>v \<and> e={u,v})" by (auto simp: eval_nat_numeral card_Suc_eq) lemma in_ranE: assumes "v \<in> ran m" obtains k where "m k = Some v" using assms unfolding ran_def by auto lemma Inf_in: fixes A :: "'a::{linorder,complete_lattice} set" assumes "finite A" "A\<noteq>{}" shows "Inf A \<in> A" using assms proof (induction A rule: finite_induct) case empty then show ?case by simp next have [simp]: "inf a b = (if a\<le>b then a else b)" for a b :: 'a by (meson inf_absorb2 le_iff_inf linear) case (insert x F) show ?case proof cases assume "F={}" thus ?thesis by auto next assume "F\<noteq>{}" with insert.IH have "Inf F \<in> F" . then show ?thesis using le_less_linear[of x "Inf F"] by auto qed qed lemma INF_of_enat_infty_iff1: "(INF x \<in> A. enat (f x)) = \<infinity> \<longleftrightarrow> A={}" apply (cases "A={}") subgoal by (simp add: top_enat_def) subgoal by safe (metis INF_top_conv(2) enat.distinct(1) top_enat_def)+ done lemma INF_of_enat_infty_iff2: "\<infinity> = (INF x \<in> A. enat (f x)) \<longleftrightarrow> A={}" by (metis INF_of_enat_infty_iff1) lemmas INF_of_enat_infty_iff[simp] = INF_of_enat_infty_iff1 INF_of_enat_infty_iff2 lemma INF_of_enat_nat_conv1: assumes "finite A" shows "(INF x \<in> A. enat (f x)) = enat d \<longleftrightarrow> (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))" proof - from assms have F: "finite (enat`f`A)" by auto show ?thesis proof (cases "A={}") case True thus ?thesis by (auto simp: top_enat_def) next case [simp]: False note * = Inf_in[OF F, simplified] show ?thesis apply (rule iffI) subgoal by (smt False Inf_in assms enat.inject enat_ord_simps(1) finite_imageI imageE image_is_empty le_INF_iff order_refl) subgoal by clarsimp (meson INF_greatest INF_lower antisym enat_ord_simps(1)) done qed qed lemma INF_of_enat_nat_conv2: assumes "finite A" shows "enat d = (INF x \<in> A. enat (f x)) \<longleftrightarrow> (\<exists>x\<in>A. d = f x \<and> (\<forall>y\<in>A. f x \<le> f y))" using INF_of_enat_nat_conv1[OF assms] by metis lemmas INF_of_enat_nat_conv = INF_of_enat_nat_conv1 INF_of_enat_nat_conv2 lemma finite_inf_linorder_ne_ex: fixes f :: "_ \<Rightarrow> _::{complete_lattice,linorder}" assumes "finite S" assumes "S\<noteq>{}" shows "\<exists>x\<in>S. (INF x \<in> S. f x) = f x" using assms by (meson Inf_in finite_imageI imageE image_is_empty) lemma finite_linorder_eq_INF_conv: "finite S \<Longrightarrow> a = (INF x \<in> S. f x) \<longleftrightarrow> (if S={} then a=top else \<exists>x\<in>S. a=f x \<and> (\<forall>y\<in>S. a \<le> f y))" for a :: "_::{complete_lattice,linorder}" by (auto simp: INF_greatest INF_lower intro: finite_inf_linorder_ne_ex antisym) lemma sym_inv_eq[simp]: "sym E \<Longrightarrow> E\<inverse> = E" unfolding sym_def by auto lemma insert_inv[simp]: "(insert e E)\<inverse> = insert (prod.swap e) (E\<inverse>)" by (cases e) auto lemma inter_compl_eq_diff[simp]: "x \<inter> - s = x - s" by auto subsection \<open>The-Default\<close> fun the_default :: "'a \<Rightarrow> 'a option \<Rightarrow> 'a" where "the_default d None = d" | "the_default _ (Some x) = x" lemma the_default_alt: "the_default d x = (case x of None \<Rightarrow> d | Some v \<Rightarrow> v)" by (auto split: option.split) subsection \<open>Implementing \<open>enat\<close> by Option\<close> text \<open>Our maps are functions to \<open>nat option\<close>,which are interpreted as \<open>enat\<close>, \<open>None\<close> being \<open>\<infinity>\<close>\<close> fun enat_of_option :: "nat option \<Rightarrow> enat" where "enat_of_option None = \<infinity>" | "enat_of_option (Some n) = enat n" lemma enat_of_option_inj[simp]: "enat_of_option x = enat_of_option y \<longleftrightarrow> x=y" by (cases x; cases y; simp) lemma enat_of_option_simps[simp]: "enat_of_option x = enat n \<longleftrightarrow> x = Some n" "enat_of_option x = \<infinity> \<longleftrightarrow> x = None" "enat n = enat_of_option x \<longleftrightarrow> x = Some n" "\<infinity> = enat_of_option x \<longleftrightarrow> x = None" by (cases x; auto; fail)+ lemma enat_of_option_le_conv: "enat_of_option m \<le> enat_of_option n \<longleftrightarrow> (case (m,n) of (_,None) \<Rightarrow> True | (Some a, Some b) \<Rightarrow> a\<le>b | (_, _) \<Rightarrow> False )" by (auto split: option.split) subsection \<open>Foldr-Refine\<close> lemma foldr_refine: assumes "I s" assumes "\<And>s x. I s \<Longrightarrow> x\<in>set l \<Longrightarrow> I (f x s) \<and> \<alpha> (f x s) = f' x (\<alpha> s)" shows "I (foldr f l s) \<and> \<alpha> (foldr f l s) = foldr f' l (\<alpha> s)" using assms by (induction l arbitrary: s) auto end
{"author": "data61", "repo": "PSL", "sha": "2a71eac0db39ad490fe4921a5ce1e4344dc43b12", "save_path": "github-repos/isabelle/data61-PSL", "path": "github-repos/isabelle/data61-PSL/PSL-2a71eac0db39ad490fe4921a5ce1e4344dc43b12/SeLFiE/Example/afp-2020-05-16/thys/Prim_Dijkstra_Simple/Common.thy"}
# -*- coding: utf-8 -*- """ Created on Fri Jul 8 22:40:32 2016 @author: au194693 """ import mne import numpy as np from my_settings import * subject = 1 raw = mne.io.Raw(data_folder + "sub_%s-raw.fif" % subject, preload=True) raw.filter(8, 12) picks = mne.pick_types(raw.info, "grad") raw.apply_hilbert(picks) events = mne.read_events(data_folder + "sub_%s-eve.fif" % subject) event_id = {"Anger/non-target": 1, "Disgust/non-target": 2, "Fear/non-target": 3, "Happiness/target": 4, "Neutrality/non-target": 5, "Sadness/non-target": 6, "Test": 10} tmin, tmax = -0.2, 0.83 reject = {"grad": 4000e-13} # T / m (gradiometers) epochs_params = dict(events=events, event_id=event_id, tmin=tmin, tmax=tmax, reject=reject, baseline=(None, 0), preload=True) epochs = mne.Epochs(raw, **epochs_params) ave_nt = epochs["non-target"].average() data = np.abs(epochs["non-target"].get_data())**2 ave_nt.data = data.mean(axis=0) data = np.abs(epochs["Happiness"].get_data())**2 ave_happines = epochs["Happiness"].average() ave_happines.data = data.mean(axis=0) data = np.abs(epochs["Anger"].get_data())**2 ave_anger = epochs["Anger"].average() ave_anger.data = data.mean(axis=0) data = np.abs(epochs["Fear"].get_data())**2 ave_fear = epochs["Fear"].average() ave_fear.data = data.mean(axis=0) data = np.abs(epochs["Disgust"].get_data())**2 ave_disgust = epochs["Disgust"].average() ave_disgust.data = data.mean(axis=0) data = np.abs(epochs["Sadness"].get_data())**2 ave_sadness = epochs["Sadness"].average() ave_sadness.data = data.mean(axis=0) data = np.abs(epochs["Neutrality"].get_data())**2 ave_neutral = epochs["Neutrality"].average() ave_neutral.data = data.mean(axis=0) evokeds = [ave_happines, ave_anger, ave_disgust, ave_fear, ave_neutral, ave_sadness] colors = ["red", "green", "lightblue", "m", "orange", "yellow"] result = np.empty([data.shape[1], data.shape[2]]) for j in range(data.shape[1]): for i in range(data.shape[2]): result[j, i] =\ np.abs(np.mean(np.exp(1j * (np.angle(data[:, j, i])))))
{"hexsha": "38e3c539a469ff8cac4b778c90f941c6822e4046", "size": 2248, "ext": "py", "lang": "Python", "max_stars_repo_path": "hilbert_transform.py", "max_stars_repo_name": "MadsJensen/biomeg_class", "max_stars_repo_head_hexsha": "470ce736d8103e6d90ca203a0b2e0a96b756a780", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "hilbert_transform.py", "max_issues_repo_name": "MadsJensen/biomeg_class", "max_issues_repo_head_hexsha": "470ce736d8103e6d90ca203a0b2e0a96b756a780", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "hilbert_transform.py", "max_forks_repo_name": "MadsJensen/biomeg_class", "max_forks_repo_head_hexsha": "470ce736d8103e6d90ca203a0b2e0a96b756a780", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 27.7530864198, "max_line_length": 72, "alphanum_fraction": 0.6161032028, "include": true, "reason": "import numpy", "num_tokens": 679}
// ----------------- BEGIN LICENSE BLOCK --------------------------------- // // Copyright (C) 2018-2019 Intel Corporation // // SPDX-License-Identifier: MIT // // ----------------- END LICENSE BLOCK ----------------------------------- #pragma once #include <boost/program_options/options_description.hpp> #include "ad/map/maker/common/InternalToRoad5Config.hpp" namespace ad { namespace map { namespace maker { namespace common { /*! * \brief Option parsing for InternalToRoad5 */ struct InternalToRoad5ConfigDescription : ::boost::program_options::options_description { InternalToRoad5ConfigDescription(); InternalToRoad5Config config; }; } // namespace common } // namespace maker } // namespace map } // namespace ad
{"hexsha": "55517e654c47a4beb4e64ba9a1009abf692c42af", "size": 732, "ext": "hpp", "lang": "C++", "max_stars_repo_path": "tools/map_maker/common/include/ad/map/maker/common/InternalToRoad5ConfigDescription.hpp", "max_stars_repo_name": "seowwj/map", "max_stars_repo_head_hexsha": "2afacd50e1b732395c64b1884ccfaeeca0040ee7", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 61.0, "max_stars_repo_stars_event_min_datetime": "2019-12-19T20:57:24.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T15:20:51.000Z", "max_issues_repo_path": "tools/map_maker/common/include/ad/map/maker/common/InternalToRoad5ConfigDescription.hpp", "max_issues_repo_name": "seowwj/map", "max_issues_repo_head_hexsha": "2afacd50e1b732395c64b1884ccfaeeca0040ee7", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 54.0, "max_issues_repo_issues_event_min_datetime": "2020-04-05T05:32:47.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-15T18:42:33.000Z", "max_forks_repo_path": "tools/map_maker/common/include/ad/map/maker/common/InternalToRoad5ConfigDescription.hpp", "max_forks_repo_name": "seowwj/map", "max_forks_repo_head_hexsha": "2afacd50e1b732395c64b1884ccfaeeca0040ee7", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 31.0, "max_forks_repo_forks_event_min_datetime": "2019-12-20T07:37:39.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-16T13:06:16.000Z", "avg_line_length": 22.875, "max_line_length": 87, "alphanum_fraction": 0.6448087432, "num_tokens": 147}
#!/usr/bin/env python #Copyright (c) 2014, #All rights reserved. #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: # #* Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. #* Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. #* Neither the name of flopy nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" #AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE #IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE #FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL #DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR #SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, #OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE #OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ''' Created on 19/8/2019 @author: Neil Symington Gridding classes and functions. This is mostly adapted from the grid base class from flopy (https://github.com/modflowpy/flopy). The licence above is from flopy (https://github.com/modflowpy/flopy/blob/develop/LICENSE) ''' import numpy as np import copy # From https://github.com/modflowpy/flopy/blob/develop/flopy/utils/geometry.py def rotate(x, y, xoff, yoff, angrot_radians): """ Given x and y array-like values calculate the rotation about an arbitrary origin and then return the rotated coordinates. """ if isinstance(x, list): x = np.array(x) if isinstance(y, list): y = np.array(y) xrot = xoff + np.cos(angrot_radians) * \ (x - xoff) - np.sin(angrot_radians) * \ (y - yoff) yrot = yoff + np.sin(angrot_radians) * \ (x - xoff) + np.cos(angrot_radians) * \ (y - yoff) return xrot, yrot class CachedData(object): def __init__(self, data): self._data = data self.out_of_date = False @property def data_nocopy(self): return self._data @property def data(self): return copy.deepcopy(self._data) def update_data(self, data): self._data = data self.out_of_date = False class Grid(object): """ Base class for a structured or unstructured model grid Parameters ---------- grid_type : enumeration type of model grid ('structured', 'vertex_layered', 'vertex_unlayered') top : ndarray(np.float) top elevations of cells in topmost layer botm : ndarray(np.float) bottom elevations of all cells idomain : ndarray(np.int) ibound/idomain value for each cell lenuni : ndarray(np.int) model length units origin_loc : str Corner of the model grid that is the model origin 'ul' (upper left corner) or 'll' (lower left corner) origin_x : float x coordinate of the origin point (lower left corner of model grid) in the spatial reference coordinate system origin_y : float y coordinate of the origin point (lower left corner of model grid) in the spatial reference coordinate system rotation : float rotation angle of model grid, as it is rotated around the origin point Properties ---------- grid_type : enumeration type of model grid ('structured', 'vertex_layered', 'vertex_unlayered') top : ndarray(np.float) top elevations of cells in topmost layer botm : ndarray(np.float) bottom elevations of all cells idomain : ndarray(np.int) ibound/idomain value for each cell proj4 : proj4 SpatialReference spatial reference locates the grid in a coordinate system epsg : epsg SpatialReference spatial reference locates the grid in a coordinate system lenuni : int modflow lenuni parameter origin_x : float x coordinate of the origin point in the spatial reference coordinate system origin_y : float y coordinate of the origin point in the spatial reference coordinate system rotation : float rotation angle of model grid, as it is rotated around the origin point xgrid : ndarray returns numpy meshgrid of x edges in reference frame defined by point_type ygrid : ndarray returns numpy meshgrid of y edges in reference frame defined by point_type zgrid : ndarray returns numpy meshgrid of z edges in reference frame defined by point_type xcenters : ndarray returns x coordinate of cell centers ycenters : ndarray returns y coordinate of cell centers ycenters : ndarray returns z coordinate of cell centers xyzgrid : [ndarray, ndarray, ndarray] returns the location of grid edges of all model cells. if the model grid contains spatial reference information, the grid edges are in the coordinate system provided by the spatial reference information. returns a list of three ndarrays for the x, y, and z coordinates xyzcellcenters : [ndarray, ndarray, ndarray] returns the cell centers of all model cells in the model grid. if the model grid contains spatial reference information, the cell centers are in the coordinate system provided by the spatial reference information. otherwise the cell centers are based on a 0,0 location for the upper left corner of the model grid. returns a list of three ndarrays for the x, y, and z coordinates Methods ---------- get_coords(x, y) transform point or array of points x, y from model coordinates to spatial coordinates grid_lines : (point_type=PointType.spatialxyz) : list returns the model grid lines in a list. each line is returned as a list containing two tuples in the format [(x1,y1), (x2,y2)] where x1,y1 and x2,y2 are the endpoints of the line. xyvertices : (point_type) : ndarray 1D array of x and y coordinates of cell vertices for whole grid (single layer) in C-style (row-major) order (same as np.ravel()) intersect(x, y, local) returns the row and column of the grid that the x, y point is in See Also -------- Notes ----- Examples -------- """ def __init__(self, grid_type=None, top=None, botm=None, idomain=None, lenuni=2, epsg=None, proj4=None, prj=None, xoff=0.0, yoff=0.0, ArithmeticErrorangrot=0.0,angrot=0.0): lenunits = {0: "undefined", 1: "feet", 2: "meters", 3: "centimeters"} LENUNI = {"u": 0, "f": 1, "m": 2, "c": 3} self.use_ref_coords = True self._grid_type = grid_type self._top = top self._botm = botm self._idomain = idomain if lenuni is None: lenuni = 0 elif isinstance(lenuni, str): lenuni = LENUNI[lenuni.lower()[0]] self._lenuni = lenuni self._units = lenunits[self._lenuni] self._epsg = epsg self._proj4 = proj4 self._prj = prj self._xoff = xoff self._yoff = yoff if angrot is None: angrot = 0.0 self._angrot = angrot self._cache_dict = {} self._copy_cache = True ################################### # access to basic grid properties ################################### def __repr__(self): s = "xll:{0:<.10G}; yll:{1:<.10G}; rotation:{2:<G}; ". \ format(self.xoffset, self.yoffset, self.angrot) s += "proj4_str:{0}; ".format(self.proj4) s += "units:{0}; ".format(self.units) s += "lenuni:{0}; ".format(self.lenuni) return s @property def grid_type(self): return self._grid_type @property def xoffset(self): return self._xoff @property def yoffset(self): return self._yoff @property def angrot(self): return self._angrot @property def angrot_radians(self): return self._angrot * np.pi / 180. @property def epsg(self): return self._epsg @epsg.setter def epsg(self, epsg): self._epsg = epsg @property def proj4(self): proj4 = None if self._proj4 is not None: if "epsg" in self._proj4.lower(): if "init" not in self._proj4.lower(): proj4 = "+init=" + self._proj4 else: proj4 = self._proj4 # set the epsg if proj4 specifies it tmp = [i for i in self._proj4.split() if 'epsg' in i.lower()] self._epsg = int(tmp[0].split(':')[1]) else: proj4 = self._proj4 elif self.epsg is not None: proj4 = '+init=epsg:{}'.format(self.epsg) return proj4 @proj4.setter def proj4(self, proj4): self._proj4 = proj4 @property def prj(self): return self._prj @prj.setter def prj(self, prj): self._proj4 = prj @property def top(self): return self._top @property def botm(self): return self._botm @property def top_botm(self): new_top = np.expand_dims(self._top, 0) return np.concatenate((new_top, self._botm), axis=0) @property def units(self): return self._units @property def lenuni(self): return self._lenuni @property def idomain(self): return self._idomain @property def shape(self): raise NotImplementedError( 'must define extent in child ' 'class to use this base class') @property def extent(self): raise NotImplementedError( 'must define extent in child ' 'class to use this base class') @property def grid_lines(self): raise NotImplementedError( 'must define get_cellcenters in child ' 'class to use this base class') @property def xcellcenters(self): return self.xyzcellcenters[0] @property def ycellcenters(self): return self.xyzcellcenters[1] @property def zcellcenters(self): return self.xyzcellcenters[2] @property def xyzcellcenters(self): raise NotImplementedError( 'must define get_cellcenters in child ' 'class to use this base class') @property def xvertices(self): return self.xyzvertices[0] @property def yvertices(self): return self.xyzvertices[1] @property def zvertices(self): return self.xyzvertices[2] @property def xyzvertices(self): raise NotImplementedError( 'must define xyzgrid in child ' 'class to use this base class') def get_coords(self, x, y): """ Given x and y array-like values, apply rotation, scale and offset, to convert them from model coordinates to real-world coordinates. """ if isinstance(x, list): x = np.array(x) y = np.array(y) if not np.isscalar(x): x, y = x.copy(), y.copy() x += self._xoff y += self._yoff return rotate(x, y, self._xoff, self._yoff, self.angrot_radians) def get_local_coords(self, x, y): """ Given x and y array-like values, apply rotation, scale and offset, to convert them from real-world coordinates to model coordinates. """ if isinstance(x, list): x = np.array(x) y = np.array(y) if not np.isscalar(x): x, y = x.copy(), y.copy() x, y = rotate(x, y, self._xoff, self._yoff, -self.angrot_radians) x -= self._xoff y -= self._yoff return x, y def intersect(self, x, y, local=False, forgive=False): if not local: return self.get_local_coords(x, y) else: return x, y def set_coord_info(self, xoff=0.0, yoff=0.0, angrot=0.0, epsg=None, proj4=None, merge_coord_info=True): if merge_coord_info: if xoff is None: xoff = self._xoff if yoff is None: yoff = self._yoff if angrot is None: angrot = self._angrot if epsg is None: epsg = self._epsg if proj4 is None: proj4 = self._proj4 self._xoff = xoff self._yoff = yoff self._angrot = angrot self._epsg = epsg self._proj4 = proj4 self._require_cache_updates() # Internal def _xul_to_xll(self, xul, angrot=None): yext = self.xyedges[1][0] if angrot is not None: return xul + (np.sin(angrot * np.pi / 180) * yext) else: return xul + (np.sin(self.angrot_radians) * yext) def _yul_to_yll(self, yul, angrot=None): yext = self.xyedges[1][0] if angrot is not None: return yul - (np.cos(angrot * np.pi / 180) * yext) else: return yul - (np.cos(self.angrot_radians) * yext) def _set_sr_coord_info(self, sr): self._xoff = sr.xll self._yoff = sr.yll self._angrot = sr.rotation self._epsg = sr.epsg self._proj4 = sr.proj4_str self._require_cache_updates() def _require_cache_updates(self): for cache_data in self._cache_dict.values(): cache_data.out_of_date = True @property def _has_ref_coordinates(self): return self._xoff != 0.0 or self._yoff != 0.0 or self._angrot != 0.0 def _load_settings(self, d): self._xoff = d.xul def _zcoords(self): if self.top is not None and self.botm is not None: zcenters = [] top_3d = np.expand_dims(self.top, 0) zbdryelevs = np.concatenate((top_3d, self.botm), axis=0) for ix in range(1, len(zbdryelevs)): zcenters.append((zbdryelevs[ix - 1] + zbdryelevs[ix]) / 2.) else: zbdryelevs = None zcenters = None return zbdryelevs, zcenters class StructuredGrid(Grid): """ class for a structured model grid Parameters ---------- delc delc array delr delr array Properties ---------- nlay returns the number of model layers nrow returns the number of model rows ncol returns the number of model columns delc returns the delc array delr returns the delr array xyedges returns x-location points for the edges of the model grid and y-location points for the edges of the model grid Methods ---------- get_cell_vertices(i, j) returns vertices for a single cell at row, column i, j. """ def __init__(self, delc=None, delr=None, top=None, botm=None, idomain=None, lenuni=2, epsg=None, proj4=None, prj=None, xoff=0.0, yoff=0.0, angrot=0.0, nlay=None, nrow=None, ncol=None): super(StructuredGrid, self).__init__('structured', top, botm, idomain, lenuni, epsg, proj4, prj, xoff, yoff, angrot) self.__delc = delc self.__delr = delr if delc is not None: self.__nrow = len(delc) else: self.__nrow = nrow if delr is not None: self.__ncol = len(delr) else: self.__ncol = ncol if top is not None: assert self.__nrow * self.__ncol == len(np.ravel(top)) if botm is not None: assert self.__nrow * self.__ncol == len(np.ravel(botm[0])) self.__nlay = len(botm) else: self.__nlay = nlay #################### # Properties #################### @property def nlay(self): return self.__nlay @property def nrow(self): return self.__nrow @property def ncol(self): return self.__ncol @property def shape(self): return self.__nlay, self.__nrow, self.__ncol @property def extent(self): self._copy_cache = False xyzgrid = self.xyzvertices self._copy_cache = True return (np.min(xyzgrid[0]), np.max(xyzgrid[0]), np.min(xyzgrid[1]), np.max(xyzgrid[1])) @property def delc(self): return self.__delc @property def delr(self): return self.__delr @property def xyzvertices(self): """ """ cache_index = 'xyzgrid' if cache_index not in self._cache_dict or \ self._cache_dict[cache_index].out_of_date: xedge = np.concatenate(([0.], np.add.accumulate(self.__delr))) length_y = np.add.reduce(self.__delc) yedge = np.concatenate(([length_y], length_y - np.add.accumulate(self.delc))) xgrid, ygrid = np.meshgrid(xedge, yedge) zgrid, zcenter = self._zcoords() if self._has_ref_coordinates: # transform x and y pass xgrid, ygrid = self.get_coords(xgrid, ygrid) if zgrid is not None: self._cache_dict[cache_index] = \ CachedData([xgrid, ygrid, zgrid]) else: self._cache_dict[cache_index] = \ CachedData([xgrid, ygrid]) if self._copy_cache: return self._cache_dict[cache_index].data else: return self._cache_dict[cache_index].data_nocopy @property def xyedges(self): cache_index = 'xyedges' if cache_index not in self._cache_dict or \ self._cache_dict[cache_index].out_of_date: xedge = np.concatenate(([0.], np.add.accumulate(self.__delr))) length_y = np.add.reduce(self.__delc) yedge = np.concatenate(([length_y], length_y - np.add.accumulate(self.delc))) self._cache_dict[cache_index] = \ CachedData([xedge, yedge]) if self._copy_cache: return self._cache_dict[cache_index].data else: return self._cache_dict[cache_index].data_nocopy @property def xyzcellcenters(self): """ Return a list of two numpy one-dimensional float array one with the cell center x coordinate and the other with the cell center y coordinate for every row in the grid in model space - not offset of rotated, with the cell center y coordinate. """ cache_index = 'cellcenters' if cache_index not in self._cache_dict or \ self._cache_dict[cache_index].out_of_date: # get x centers x = np.add.accumulate(self.__delr) - 0.5 * self.delr # get y centers Ly = np.add.reduce(self.__delc) y = Ly - (np.add.accumulate(self.__delc) - 0.5 * self.__delc) x_mesh, y_mesh = np.meshgrid(x, y) if self.__nlay is not None: # get z centers z = np.empty((self.__nlay, self.__nrow, self.__ncol)) z[0, :, :] = (self._top[:, :] + self._botm[0, :, :]) / 2. for l in range(1, self.__nlay): z[l, :, :] = (self._botm[l - 1, :, :] + self._botm[l, :, :]) / 2. else: z = None if self._has_ref_coordinates: # transform x and y x_mesh, y_mesh = self.get_coords(x_mesh, y_mesh) # store in cache self._cache_dict[cache_index] = CachedData([x_mesh, y_mesh, z]) if self._copy_cache: return self._cache_dict[cache_index].data else: return self._cache_dict[cache_index].data_nocopy @property def grid_lines(self): """ Get the grid lines as a list """ # get edges initially in model coordinates use_ref_coords = self.use_ref_coords self.use_ref_coords = False xyedges = self.xyedges self.use_ref_coords = use_ref_coords xmin = xyedges[0][0] xmax = xyedges[0][-1] ymin = xyedges[1][-1] ymax = xyedges[1][0] lines = [] # Vertical lines for j in range(self.ncol + 1): x0 = xyedges[0][j] x1 = x0 y0 = ymin y1 = ymax lines.append([(x0, y0), (x1, y1)]) # horizontal lines for i in range(self.nrow + 1): x0 = xmin x1 = xmax y0 = xyedges[1][i] y1 = y0 lines.append([(x0, y0), (x1, y1)]) if self._has_ref_coordinates: lines_trans = [] for ln in lines: lines_trans.append([self.get_coords(*ln[0]), self.get_coords(*ln[1])]) return lines_trans return lines ############### ### Methods ### ############### def intersect(self, x, y, local=False, forgive=False): """ Get the row and column of a point with coordinates x and y When the point is on the edge of two cells, the cell with the lowest row or column is returned. Parameters ---------- x : float The x-coordinate of the requested point y : float The y-coordinate of the requested point local: bool (optional) If True, x and y are in local coordinates (defaults to False) forgive: bool (optional) Forgive x,y arguments that fall outside the model grid and return NaNs instead (defaults to False - will throw exception) Returns ------- row : int The row number col : int The column number """ # transform x and y to local coordinates x, y = super(StructuredGrid, self).intersect(x, y, local, forgive) # get the cell edges in local coordinates xe, ye = self.xyedges xcomp = x > xe if np.all(xcomp) or not np.any(xcomp): if forgive: col = np.nan else: raise Exception( 'x, y point given is outside of the model area') else: col = np.where(xcomp)[0][-1] ycomp = y < ye if np.all(ycomp) or not np.any(ycomp): if forgive: row = np.nan else: raise Exception( 'x, y point given is outside of the model area') else: row = np.where(ycomp)[0][-1] if np.any(np.isnan([row, col])): row = col = np.nan return row, col def _cell_vert_list(self, i, j): """Get vertices for a single cell or sequence of i, j locations.""" self._copy_cache = False pts = [] xgrid, ygrid = self.xvertices, self.yvertices pts.append([xgrid[i, j], ygrid[i, j]]) pts.append([xgrid[i + 1, j], ygrid[i + 1, j]]) pts.append([xgrid[i + 1, j + 1], ygrid[i + 1, j + 1]]) pts.append([xgrid[i, j + 1], ygrid[i, j + 1]]) pts.append([xgrid[i, j], ygrid[i, j]]) self._copy_cache = True if np.isscalar(i): return pts else: vrts = np.array(pts).transpose([2, 0, 1]) return [v.tolist() for v in vrts] def get_cell_vertices(self, i, j): """ Method to get a set of cell vertices for a single cell used in the Shapefile export utilities :param i: (int) cell row number :param j: (int) cell column number :return: list of x,y cell vertices """ self._copy_cache = False cell_verts = [(self.xvertices[i, j], self.yvertices[i, j]), (self.xvertices[i, j+1], self.yvertices[i, j+1]), (self.xvertices[i+1, j+1], self.yvertices[i+1, j+1]), (self.xvertices[i+1, j], self.yvertices[i+1, j]),] self._copy_cache = True return cell_verts # Importing @classmethod def from_gridspec(cls, gridspec_file, lenuni=0): f = open(gridspec_file, 'r') raw = f.readline().strip().split() nrow = int(raw[0]) ncol = int(raw[1]) raw = f.readline().strip().split() xul, yul, rot = float(raw[0]), float(raw[1]), float(raw[2]) delr = [] j = 0 while j < ncol: raw = f.readline().strip().split() for r in raw: if '*' in r: rraw = r.split('*') for n in range(int(rraw[0])): delr.append(float(rraw[1])) j += 1 else: delr.append(float(r)) j += 1 delc = [] i = 0 while i < nrow: raw = f.readline().strip().split() for r in raw: if '*' in r: rraw = r.split('*') for n in range(int(rraw[0])): delc.append(float(rraw[1])) i += 1 else: delc.append(float(r)) i += 1 f.close() grd = cls(np.array(delc), np.array(delr), lenuni=lenuni) xll = grd._xul_to_xll(xul) yll = grd._yul_to_yll(yul) cls.set_coord_info(xoff=xll, yoff=yll, angrot=rot) return cls
{"hexsha": "5be417a67762f027128cc84ffec9bb277860a136", "size": 26448, "ext": "py", "lang": "Python", "max_stars_repo_path": "hydrogeol_utils/grid_utils.py", "max_stars_repo_name": "GeoscienceAustralia/hydrogeol_utils", "max_stars_repo_head_hexsha": "586c8289f5a9931c25c04c141dbdf3cd3b2ae3dc", "max_stars_repo_licenses": ["Apache-2.0"], "max_stars_count": 3, "max_stars_repo_stars_event_min_datetime": "2019-09-06T05:09:39.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-24T22:49:59.000Z", "max_issues_repo_path": "hydrogeol_utils/grid_utils.py", "max_issues_repo_name": "GeoscienceAustralia/hydrogeol_utils", "max_issues_repo_head_hexsha": "586c8289f5a9931c25c04c141dbdf3cd3b2ae3dc", "max_issues_repo_licenses": ["Apache-2.0"], "max_issues_count": 8, "max_issues_repo_issues_event_min_datetime": "2020-03-24T17:59:02.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-13T01:55:20.000Z", "max_forks_repo_path": "hydrogeol_utils/grid_utils.py", "max_forks_repo_name": "GeoscienceAustralia/hydrogeol_utils", "max_forks_repo_head_hexsha": "586c8289f5a9931c25c04c141dbdf3cd3b2ae3dc", "max_forks_repo_licenses": ["Apache-2.0"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2019-10-21T23:52:18.000Z", "max_forks_repo_forks_event_max_datetime": "2020-01-03T14:00:07.000Z", "avg_line_length": 32.0581818182, "max_line_length": 79, "alphanum_fraction": 0.5623109498, "include": true, "reason": "import numpy", "num_tokens": 6593}
# -*- coding: utf-8 -*- # !/usr/bin/python ################################### PART0 DESCRIPTION ################################# # Filename: class_compute_meta_data_of_network.py # Description: # # Author: Shuai Yuan # E-mail: [email protected] # Create: 2015-12-06 21:49:46 # Last: __author__ = 'yuens' ################################### PART1 IMPORT ###################################### import logging import MySQLdb import time from operator import add import networkx as nx from Tkinter import _flatten ################################### PART2 CLASS && FUNCTION ########################### class ComputeEdgeProperty(object): def __init__(self, database_name, pyspark_sc): self.start = time.clock() logging.basicConfig(level = logging.INFO, format = '%(asctime)s %(levelname)5s %(filename)19s[line:%(lineno)3d] %(funcName)s %(message)s', datefmt = '%y-%m-%d %H:%M:%S', filename = './main.log', filemode = 'a') console = logging.StreamHandler() console.setLevel(logging.INFO) formatter = logging.Formatter('%(asctime)s %(levelname)5s %(filename)19s[line:%(lineno)3d] %(funcName)s %(message)s') console.setFormatter(formatter) logging.getLogger('').addHandler(console) logging.info("START CLASS {class_name}.".format(class_name = ComputeEdgeProperty.__name__)) # connect database try: self.con = MySQLdb.connect(host='localhost', user='root', passwd='931209', db = database_name, charset='utf8') logging.info("Success in connecting MySQL.") except MySQLdb.Error, e: logging.error("Fail in connecting MySQL.") logging.error("MySQL Error {error_num}: {error_info}.".format(error_num = e.args[0], error_info = e.args[1])) # spark configure try: self.sc = pyspark_sc logging.info("Config spark successfully.") except Exception as e: logging.error("Config spark failed.") logging.error(e) def __del__(self): # close database try: self.con.close() logging.info("Success in quiting MySQL.") except MySQLdb.Error, e: logging.error("MySQL Error {error_num}: {error_info}.".format(error_num = e.args[0], error_info = e.args[1])) logging.info("END CLASS {class_name}.".format(class_name = ComputeEdgeProperty.__name__)) self.end = time.clock() logging.info("The class {class_name} run time is : {delta_time} seconds".format(class_name = ComputeEdgeProperty.__name__, delta_time = self.end)) def compute_common_degree_in_different_network(self, database_name, node_table_name, connection_table_name): # sub-function def get_node_and_connection_data_from_database(self, database_name, node_table_name, connection_table_name): cursor = self.con.cursor() sqls = ["SELECT network_type, is_directed, node," " degree_str, in_degree_str, out_degree_str" " FROM {database}.{table}"\ .format(database = database_name,\ table = node_table_name)] sqls.append("SELECT network_type, is_directed, node1, node2" " FROM {database}.{table}"\ .format(database = database_name,\ table = connection_table_name)) for sql_idx in xrange(len(sqls)): sql = sqls[sql_idx] try: cursor.execute(sql) if sql_idx == 0: node_tuple_list = map(lambda (network_type,\ is_directed,\ node,\ degree_str,\ in_degree_str,\ out_degree_str): (str(network_type),\ int(is_directed),\ int(node),\ str(degree_str),\ str(in_degree_str),\ str(out_degree_str)),\ cursor.fetchall()\ ) logging.info("len(node_tuple_list):{0}".format(len(node_tuple_list))) logging.info("node_tuple_list[:3]:{0}".format(node_tuple_list[:3])) elif sql_idx == 1: connection_tuple_list = map(lambda (network_type,\ is_directed,\ node1,\ node2): (str(network_type),\ int(is_directed),\ int(node1),\ int(node2)\ ),\ cursor.fetchall()\ ) logging.info("len(connection_tuple_list):{0}".format(len(connection_tuple_list))) logging.info("connection_tuple_list[:3]:{0}".format(connection_tuple_list[:3])) except MySQLdb.Error, e: logging.error("failed to get node and connection data from database.") logging.error("MySQL Error {error_num}: {error_info}.".format(error_num = e.args[0], error_info = e.args[1])) cursor.close() return node_tuple_list, connection_tuple_list # sub-function def compute_common_degree_in_network(network_type, is_directed, node_tuple_list, connection_tuple_list): node_tuple_list = filter(lambda (network_type_,\ is_directed_,\ node,\ degree_str,\ in_degree_str,\ out_degree_str): network_type_ == network_type and is_directed_ == is_directed,\ node_tuple_list\ ) edge_tuple_list = filter(lambda (network_type_,\ is_directed_,\ node1,\ node2): network_type_ == network_type and is_directed_ == is_directed,\ connection_tuple_list\ ) edge_tuple_list_length = len(edge_tuple_list) success_compute = 0 failure_compute = 0 common_degree_str_list_in_network = [] common_degree_num_list_in_network = [] common_edge_tuple_list_in_network = [] common_degree_rate_list_in_network = [] for edge_idx in xrange(len(edge_tuple_list)): edge_tuple = edge_tuple_list[edge_idx] node1 = edge_tuple[2] node2 = edge_tuple[3] if (edge_idx % 1000 == 0 and edge_idx > 998) or (edge_idx == edge_tuple_list_length-1): logging.info("============== Computer common node of {edge_idx}th edge in {network_type}.{is_directed} network ==============".format(edge_idx = edge_idx, network_type = network_type, is_directed = is_directed)) logging.info("edge_index:{idx}, finish rate:{rate}".format(idx = edge_idx, rate = float(edge_idx+1)/edge_tuple_list_length)) logging.info("success_rate:{success_rate}".format(success_rate = success_compute / float(success_compute + failure_compute + 0.0001))) logging.info("success_update:{success}, failure_update:{failure}".format(success = success_compute, failure = failure_compute)) try: node1_and_degree_str_list = filter(lambda (network_type,\ is_directed,\ node,\ degree_str,\ in_degree_str,\ out_degree_str): node == node1,\ node_tuple_list)[0] except Exception as e: failure_compute = failure_compute + 1 logging.error(e) continue if node1_and_degree_str_list[3] == "": node1_degree_list = [] else: node1_degree_list = node1_and_degree_str_list[3].split("///") try: node2_and_degree_str_list = filter(lambda (network_type,\ is_directed,\ node,\ degree_str,\ in_degree_str,\ out_degree_str): node == node2,\ node_tuple_list)[0] except Exception as e: failure_compute = failure_compute + 1 logging.error(e) continue if node2_and_degree_str_list[3] == "": node2_degree_list = [] else: node2_degree_list = node2_and_degree_str_list[3].split("///") # Merge current result node1_degree_list = _flatten([node1_degree_list]) node2_degree_list = _flatten([node2_degree_list]) if len(node2_degree_list) <= len(node1_degree_list): common_degree_list = filter(lambda node: node in node1_degree_list, node2_degree_list) else: common_degree_list = filter(lambda node: node in node2_degree_list, node1_degree_list) common_degree_str_list_in_network.append("///".join(map(str, common_degree_list))) common_degree_num_list_in_network.append(len(common_degree_list)) common_edge_tuple_list_in_network.append((node1, node2)) common_degree_rate_list_in_network.append(len(common_degree_list)/float(len(node1_degree_list)+len(node2_degree_list))) success_compute = success_compute + 1 # Merge all results degree_data_tuple_list_in_network = map(lambda edge_tuple, degree_str, degree_num, degree_rate:\ (edge_tuple, degree_str, degree_num, degree_rate),\ common_edge_tuple_list_in_network,\ common_degree_str_list_in_network,\ common_degree_num_list_in_network,\ common_degree_rate_list_in_network\ ) logging.info("len(degree_data_tuple_list_in_network):{0}".format(len(degree_data_tuple_list_in_network))) logging.info("degree_data_tuple_list_in_network[:3]:{0}".format(degree_data_tuple_list_in_network[:3])) return degree_data_tuple_list_in_network # sub-function def sql_generator(database_name, connection_table_name, network_type, is_directed, node1, node2, common_neighbor_str, common_neighbor_num, common_neighbor_rate): try: sql = """UPDATE {database_name}.{table_name} SET common_neighbor_str = '{common_neighbor_str}', common_neighbor_num = {common_neighbor_num}, common_neighbor_rate = {common_neighbor_rate} WHERE network_type = '{network_type}' AND is_directed = {is_directed} AND node1 = {node1} AND node2 = {node2}"""\ .format(database_name = database_name, table_name = connection_table_name,\ common_neighbor_str = common_neighbor_str, common_neighbor_num = common_neighbor_num, common_neighbor_rate = common_neighbor_rate,\ network_type = network_type, is_directed = is_directed, node1 = node1, node2 = node2) except Exception as e: logging.error("Failed to generate sql for edge{node1}-{node2} {type} network is_directed:{directed}."\ .format(node1 = node1,\ node2 = node2,\ type = network_type,\ directed = is_directed)\ ) logging.error(e) return sql # sub-function def execute_update_sql_for_database(self, network_type, is_directed, database_name, connection_table_table, sql_list): cursor = self.con.cursor() sql_list_length = len(sql_list) success_update = 0 failure_update = 0 for sql_idx in xrange(len(sql_list)): sql = sql_list[sql_idx] if (sql_idx % 1000 == 0 and sql_idx > 998) or (sql_idx == sql_list_length-1): logging.info("============== update {idx}th sql for {network_type}.{is_directed} network ==============".format(idx = sql_idx, network_type = network_type, is_directed = is_directed)) logging.info("sql_index:{idx}, finish rate:{rate}".format(idx = sql_idx, rate = float(sql_idx+1)/sql_list_length)) logging.info("success_rate:{success_rate}".format(success_rate = success_update / float(success_update + failure_update + 0.0001))) logging.info("success_update:{success}, failure_update:{failure}".format(success = success_update, failure = failure_update)) try: cursor.execute(sql) self.con.commit() success_update = success_update + 1 except MySQLdb.Error, e: self.con.rollback() logging.error("Failed in update {database}.{table} in MySQL.".format(database = database_name, table = connection_table_name)) logging.error("MySQL Error {error_num}: {error_info}.".format(error_num = e.args[0], error_info = e.args[1])) logging.error(sql) failure_update = failure_update + 1 continue # start # get data from database node_tuple_list, connection_tuple_list = get_node_and_connection_data_from_database(self = self,\ database_name = database_name,\ node_table_name = node_table_name,\ connection_table_name = connection_table_name) ''' # bio un bio_undirected_common_node_list = compute_common_degree_in_network(network_type = "bio",\ is_directed = 0,\ node_tuple_list = node_tuple_list,\ connection_tuple_list = connection_tuple_list) bio_undirected_update_sql_list = map(lambda ((node1,\ node2),\ common_neighbor_str,\ common_neighbor_num,\ common_neighbor_rate):\ sql_generator(database_name = database_name,\ connection_table_name = connection_table_name,\ network_type = "bio",\ is_directed = 0,\ node1 = node1,\ node2 = node2,\ common_neighbor_str = common_neighbor_str,\ common_neighbor_num = common_neighbor_num,\ common_neighbor_rate = common_neighbor_rate\ ),\ bio_undirected_common_node_list,\ ) logging.info("len(bio_undirected_update_sql_list:{0}".format(len(bio_undirected_update_sql_list))) logging.info("bio_undirected_update_sql_list[:3]:{0}".format(bio_undirected_update_sql_list[:3])) execute_update_sql_for_database(self = self,\ network_type = "bio",\ is_directed = 0,\ database_name = database_name,\ connection_table_table = connection_table_name,\ sql_list = bio_undirected_update_sql_list) # bio di bio_directed_common_node_list = compute_common_degree_in_network(network_type = "bio",\ is_directed = 1,\ node_tuple_list = node_tuple_list,\ connection_tuple_list = connection_tuple_list) bio_directed_update_sql_list = map(lambda ((node1,\ node2),\ common_neighbor_str,\ common_neighbor_num,\ common_neighbor_rate):\ sql_generator(database_name = database_name,\ connection_table_name = connection_table_name,\ network_type = "bio",\ is_directed = 1,\ node1 = node1,\ node2 = node2,\ common_neighbor_str = common_neighbor_str,\ common_neighbor_num = common_neighbor_num,\ common_neighbor_rate = common_neighbor_rate\ ),\ bio_directed_common_node_list,\ ) logging.info("len(bio_directed_update_sql_list:{0}".format(len(bio_directed_update_sql_list))) logging.info("bio_directed_update_sql_list[:3]:{0}".format(bio_directed_update_sql_list[:3])) execute_update_sql_for_database(self = self,\ network_type = "bio",\ is_directed = 1,\ database_name = database_name,\ connection_table_table = connection_table_name,\ sql_list = bio_directed_update_sql_list) # info un info_undirected_common_node_list = compute_common_degree_in_network(network_type = "info",\ is_directed = 0,\ node_tuple_list = node_tuple_list,\ connection_tuple_list = connection_tuple_list) info_undirected_update_sql_list = map(lambda ((node1,\ node2),\ common_neighbor_str,\ common_neighbor_num,\ common_neighbor_rate):\ sql_generator(database_name = database_name,\ connection_table_name = connection_table_name,\ network_type = "info",\ is_directed = 0,\ node1 = node1,\ node2 = node2,\ common_neighbor_str = common_neighbor_str,\ common_neighbor_num = common_neighbor_num,\ common_neighbor_rate = common_neighbor_rate\ ),\ info_undirected_common_node_list,\ ) logging.info("len(info_undirected_update_sql_list:{0}".format(len(info_undirected_update_sql_list))) logging.info("info_undirected_update_sql_list[:3]:{0}".format(info_undirected_update_sql_list[:3])) execute_update_sql_for_database(self = self,\ network_type = "info",\ is_directed = 0,\ database_name = database_name,\ connection_table_table = connection_table_name,\ sql_list = info_undirected_update_sql_list) # info di info_directed_common_node_list = compute_common_degree_in_network(network_type = "info",\ is_directed = 1,\ node_tuple_list = node_tuple_list,\ connection_tuple_list = connection_tuple_list) info_directed_update_sql_list = map(lambda ((node1,\ node2),\ common_neighbor_str,\ common_neighbor_num,\ common_neighbor_rate):\ sql_generator(database_name = database_name,\ connection_table_name = connection_table_name,\ network_type = "info",\ is_directed = 1,\ node1 = node1,\ node2 = node2,\ common_neighbor_str = common_neighbor_str,\ common_neighbor_num = common_neighbor_num,\ common_neighbor_rate = common_neighbor_rate\ ),\ info_directed_common_node_list,\ ) logging.info("len(info_directed_update_sql_list:{0}".format(len(info_directed_update_sql_list))) logging.info("info_directed_update_sql_list[:3]:{0}".format(info_directed_update_sql_list[:3])) execute_update_sql_for_database(self = self,\ network_type = "info",\ is_directed = 1,\ database_name = database_name,\ connection_table_table = connection_table_name,\ sql_list = info_directed_update_sql_list) # social un social_undirected_common_node_list = compute_common_degree_in_network(network_type = "social",\ is_directed = 0,\ node_tuple_list = node_tuple_list,\ connection_tuple_list = connection_tuple_list) social_undirected_update_sql_list = map(lambda ((node1,\ node2),\ common_neighbor_str,\ common_neighbor_num,\ common_neighbor_rate):\ sql_generator(database_name = database_name,\ connection_table_name = connection_table_name,\ network_type = "social",\ is_directed = 0,\ node1 = node1,\ node2 = node2,\ common_neighbor_str = common_neighbor_str,\ common_neighbor_num = common_neighbor_num,\ common_neighbor_rate = common_neighbor_rate\ ),\ social_undirected_common_node_list,\ ) logging.info("len(social_undirected_update_sql_list:{0}".format(len(social_undirected_update_sql_list))) logging.info("social_undirected_update_sql_list[:3]:{0}".format(social_undirected_update_sql_list[:3])) execute_update_sql_for_database(self = self,\ network_type = "social",\ is_directed = 0,\ database_name = database_name,\ connection_table_table = connection_table_name,\ sql_list = social_undirected_update_sql_list) ''' # social di social_directed_common_node_list = compute_common_degree_in_network(network_type = "social",\ is_directed = 1,\ node_tuple_list = node_tuple_list,\ connection_tuple_list = connection_tuple_list) social_directed_update_sql_list = map(lambda ((node1,\ node2),\ common_neighbor_str,\ common_neighbor_num,\ common_neighbor_rate):\ sql_generator(database_name = database_name,\ connection_table_name = connection_table_name,\ network_type = "social",\ is_directed = 1,\ node1 = node1,\ node2 = node2,\ common_neighbor_str = common_neighbor_str,\ common_neighbor_num = common_neighbor_num,\ common_neighbor_rate = common_neighbor_rate\ ),\ social_directed_common_node_list,\ ) logging.info("len(social_directed_update_sql_list:{0}".format(len(social_directed_update_sql_list))) logging.info("social_directed_update_sql_list[:3]:{0}".format(social_directed_update_sql_list[:3])) execute_update_sql_for_database(self = self,\ network_type = "social",\ is_directed = 1,\ database_name = database_name,\ connection_table_table = connection_table_name,\ sql_list = social_directed_update_sql_list) ################################### PART3 CLASS TEST ################################## ''' # Initialization database_name = "LinkPredictionDB" connection_table_name = "connection_table" node_table_name = "node_table" from pyspark import SparkContext pyspark_sc = SparkContext() EdgeComputer = ComputeEdgeProperty(database_name = database_name,\ pyspark_sc = pyspark_sc) EdgeComputer.compute_common_degree_in_different_network(database_name = database_name,\ node_table_name = node_table_name,\ connection_table_name = connection_table_name) '''
{"hexsha": "0dc01f78e3eb29a92d8ae9e9240ce763142543e5", "size": 31897, "ext": "py", "lang": "Python", "max_stars_repo_path": "mypackage/class_compute_edge_property.py", "max_stars_repo_name": "ysh329/link-prediction", "max_stars_repo_head_hexsha": "1ffbd1ecdf3b80a6ddebb02cf20a0487e36adb3b", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 27, "max_stars_repo_stars_event_min_datetime": "2015-12-08T12:24:57.000Z", "max_stars_repo_stars_event_max_datetime": "2021-06-30T03:49:50.000Z", "max_issues_repo_path": "mypackage/class_compute_edge_property.py", "max_issues_repo_name": "ysh329/link-prediction", "max_issues_repo_head_hexsha": "1ffbd1ecdf3b80a6ddebb02cf20a0487e36adb3b", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2017-12-13T13:10:28.000Z", "max_issues_repo_issues_event_max_datetime": "2017-12-18T08:38:29.000Z", "max_forks_repo_path": "mypackage/class_compute_edge_property.py", "max_forks_repo_name": "ysh329/link-prediction", "max_forks_repo_head_hexsha": "1ffbd1ecdf3b80a6ddebb02cf20a0487e36adb3b", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 8, "max_forks_repo_forks_event_min_datetime": "2017-04-18T14:04:40.000Z", "max_forks_repo_forks_event_max_datetime": "2022-02-10T17:01:21.000Z", "avg_line_length": 65.2290388548, "max_line_length": 231, "alphanum_fraction": 0.4254318588, "include": true, "reason": "import networkx", "num_tokens": 4500}
import unittest import numpy import chainer from chainer.backends import cuda from chainer import functions from chainer import gradient_check from chainer import testing from chainer.testing import attr from chainer.utils import type_check @testing.parameterize( {'axis': 0, 'start': 2, 'out_shape': (3, 2, 4)}, {'axis': 2, 'start': 0, 'out_shape': (4, 2, 3)}, {'axis': 1, 'start': 1, 'out_shape': (2, 3, 4)}, {'axis': -3, 'start': 2, 'out_shape': (3, 2, 4)}, {'axis': -1, 'start': 0, 'out_shape': (4, 2, 3)}, {'axis': -2, 'start': -2, 'out_shape': (2, 3, 4)}, {'axis': 0, 'start': 3, 'out_shape': (3, 4, 2)}, {'axis': 2, 'start': -3, 'out_shape': (4, 2, 3)}, ) class TestRollaxis(unittest.TestCase): dtype = numpy.float32 def setUp(self): self.x = numpy.random.uniform(-1, 1, (2, 3, 4)).astype(self.dtype) self.g = numpy.random.uniform(-1, 1, self.out_shape).astype(self.dtype) self.gg = numpy.random.uniform(-1, 1, (2, 3, 4)).astype(self.dtype) self.check_backward_options = {} self.check_double_backward_options = {'atol': 1e-3, 'rtol': 1e-2} def check_forward(self, x_data): x = chainer.Variable(x_data) y = functions.rollaxis(x, self.axis, self.start) expect = numpy.rollaxis(self.x, self.axis, self.start) testing.assert_allclose(y.data, expect) def test_forward_cpu(self): self.check_forward(self.x) @attr.gpu def test_forward_gpu(self): self.check_forward(cuda.to_gpu(self.x)) def check_backward(self, x_data, g_data): def f(x): return functions.rollaxis(x, self.axis, self.start) gradient_check.check_backward( f, x_data, g_data, dtype='d', **self.check_backward_options) def test_backward_cpu(self): self.check_backward(self.x, self.g) @attr.gpu def test_backward_gpu(self): self.check_backward(cuda.to_gpu(self.x), cuda.to_gpu(self.g)) def check_double_backward(self, x_data, g_data, gg_data): def f(x): y = functions.rollaxis(x, self.axis, self.start) return y * y gradient_check.check_double_backward( f, x_data, g_data, gg_data, dtype='d', **self.check_double_backward_options) def test_double_backward_cpu(self): self.check_double_backward(self.x, self.g, self.gg) @attr.gpu def test_double_backward_gpu(self): self.check_double_backward(cuda.to_gpu(self.x), cuda.to_gpu(self.g), cuda.to_gpu(self.gg)) @testing.parameterize( {'axis': 3, 'start': 0}, {'axis': -4, 'start': 0}, {'axis': 0, 'start': 4}, {'axis': 0, 'start': -4}, ) class TestRollaxisInvalidType(unittest.TestCase): def setUp(self): self.x = numpy.random.uniform(-1, 1, (2, 3, 4)).astype('f') def check_type_error(self, x): with self.assertRaises(type_check.InvalidType): functions.rollaxis(x, self.axis, self.start) def test_type_error_cpu(self): self.check_type_error(self.x) @attr.gpu def test_type_error_gpu(self): self.check_type_error(cuda.to_gpu(self.x)) class TestRollaxisInvalidTypeError(unittest.TestCase): def test_invalid_axis(self): with self.assertRaises(TypeError): functions.Rollaxis('a', 0) def test_invalid_start(self): with self.assertRaises(TypeError): functions.Rollaxis(0, 'a') testing.run_module(__name__, __file__)
{"hexsha": "60cdeb368af47d793e9962fd8d9ba25b81b4dde2", "size": 3523, "ext": "py", "lang": "Python", "max_stars_repo_path": "tests/chainer_tests/functions_tests/array_tests/test_rollaxis.py", "max_stars_repo_name": "disktnk/chainer", "max_stars_repo_head_hexsha": "133798db470f6fd95973b882b9ccbd0c9726ac13", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 90, "max_stars_repo_stars_event_min_datetime": "2017-02-23T04:04:47.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-09T12:06:50.000Z", "max_issues_repo_path": "tests/chainer_tests/functions_tests/array_tests/test_rollaxis.py", "max_issues_repo_name": "disktnk/chainer", "max_issues_repo_head_hexsha": "133798db470f6fd95973b882b9ccbd0c9726ac13", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 7, "max_issues_repo_issues_event_min_datetime": "2017-07-23T13:38:06.000Z", "max_issues_repo_issues_event_max_datetime": "2018-07-10T07:09:03.000Z", "max_forks_repo_path": "tests/chainer_tests/functions_tests/array_tests/test_rollaxis.py", "max_forks_repo_name": "disktnk/chainer", "max_forks_repo_head_hexsha": "133798db470f6fd95973b882b9ccbd0c9726ac13", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 32, "max_forks_repo_forks_event_min_datetime": "2017-02-28T07:40:38.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-17T11:33:09.000Z", "avg_line_length": 30.3706896552, "max_line_length": 79, "alphanum_fraction": 0.6258870281, "include": true, "reason": "import numpy", "num_tokens": 947}
[STATEMENT] lemma cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r_inject [simp]: "cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r x = cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r y \<longleftrightarrow> x = y" [PROOF STATE] proof (prove) goal (1 subgoal): 1. (cast x = cast y) = (x = y) [PROOF STEP] by(simp add: cast\<^sub>n\<^sub>o\<^sub>d\<^sub>e\<^sub>_\<^sub>p\<^sub>t\<^sub>r\<^sub>2\<^sub>o\<^sub>b\<^sub>j\<^sub>e\<^sub>c\<^sub>t\<^sub>_\<^sub>p\<^sub>t\<^sub>r_def)
{"llama_tokens": 397, "file": "Core_SC_DOM_common_pointers_NodePointer", "length": 1}
""" Tests the InputMixl class to ensure it is constructed correctly and that input validation works as expected. """ import unittest import numpy as np from src.models.base_model_inputs import InputMixl class InputMixlTests(unittest.TestCase): """ Unit test class for storing the various tests of the InputMixl class. """ def setUp(self): # Set a seed for reproducibility np.random.seed(456) # Specify testing constants self.num_draws = 10 # Store the fake data needed for the tests self.fake_alt_ids = np.array([1, 2, 1, 2], dtype=int) self.fake_obs_ids = np.array([1, 1, 2, 2], dtype=int) self.fake_design = np.arange(1, 5)[:, None] # Note the number of observations self.num_obs = np.unique(self.fake_obs_ids).size self.fake_normal_rvs_list =\ [np.random.normal(size=(self.num_obs, self.num_draws))] return None def test_input_mixl_constructor(self): # Initialize the input object input_object =\ InputMixl(self.fake_design, self.fake_alt_ids, self.fake_obs_ids, self.fake_normal_rvs_list) # Test that the object is of the correct type # Test that the instance has the correct attributes # Test that the values of the attribute instances have the correct id return None
{"hexsha": "f048882adf60c618048b61209a5aa5a65ce90e82", "size": 1439, "ext": "py", "lang": "Python", "max_stars_repo_path": "tests/unit/test_input_mixl.py", "max_stars_repo_name": "timothyb0912/check-yourself", "max_stars_repo_head_hexsha": "bbca2afcd63c068401913de2dd98f64569373c97", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 7, "max_stars_repo_stars_event_min_datetime": "2018-12-30T04:31:41.000Z", "max_stars_repo_stars_event_max_datetime": "2021-08-31T17:07:28.000Z", "max_issues_repo_path": "tests/unit/test_input_mixl.py", "max_issues_repo_name": "timothyb0912/check-yourself", "max_issues_repo_head_hexsha": "bbca2afcd63c068401913de2dd98f64569373c97", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 3, "max_issues_repo_issues_event_min_datetime": "2020-03-09T16:47:37.000Z", "max_issues_repo_issues_event_max_datetime": "2021-04-25T15:55:13.000Z", "max_forks_repo_path": "tests/unit/test_input_mixl.py", "max_forks_repo_name": "timothyb0912/check-yourself", "max_forks_repo_head_hexsha": "bbca2afcd63c068401913de2dd98f64569373c97", "max_forks_repo_licenses": ["MIT"], "max_forks_count": 2, "max_forks_repo_forks_event_min_datetime": "2019-12-27T15:45:40.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-29T20:31:57.000Z", "avg_line_length": 29.3673469388, "max_line_length": 77, "alphanum_fraction": 0.6358582349, "include": true, "reason": "import numpy", "num_tokens": 323}
""" ``` transform_data(m::AbstractModel, levels::DataFrame; verbose::Symbol = :low) ``` Transform data loaded in levels and order columns appropriately for the DSGE model. Returns DataFrame of transformed data. The DataFrame `levels` is output from `load_data_levels`. The series in levels are transformed as specified in `m.data_transforms`. - To prepare for per-capita transformations, population data are filtered using `hpfilter`. The series in `levels` to use as the population series is given by the `population_mnemonic` setting. If `use_population_forecast` is `true`, a population forecast is appended to the recorded population levels before the filtering. Both filtered and unfiltered population levels and growth rates are added to the `levels` data frame. - The transformations are applied for each series using the `levels` DataFrame as input. """ function transform_data(m::AbstractModel, levels::DataFrame; verbose::Symbol = :low) population_mnemonic = get_setting(m, :population_mnemonic) n_obs, _ = size(levels) # Step 1: HP filter population forecasts, if they're being used # population_recorded: historical population, unfiltered # population_all: full unfiltered series (including forecast) # dlpopulation_forecast: growth rates of population forecasts pre-filtering population_recorded = levels[:,[:date, population_mnemonic]] population_all, dlpopulation_forecast, n_population_forecast_obs = if use_population_forecast(m) if VERBOSITY[verbose] >= VERBOSITY[:high] println("Loading population forecast...") end # load population forecast population_forecast_file = inpath(m, "data", "population_forecast_$(data_vintage(m)).csv") pop_forecast = readtable(population_forecast_file) rename!(pop_forecast, :POPULATION, population_mnemonic) DSGE.na2nan!(pop_forecast) DSGE.format_dates!(:date, pop_forecast) # use our "real" series as current value pop_all = [population_recorded; pop_forecast[2:end,:]] # return values pop_all[population_mnemonic], difflog(pop_forecast[population_mnemonic]), length(pop_forecast[population_mnemonic]) else population_recorded[:,population_mnemonic], [NaN], 1 end # hp filter population_all = convert(Array, population_all) filtered_population, _ = hpfilter(population_all, 1600) # filtered series (levels) filtered_population_recorded = filtered_population[1:end-n_population_forecast_obs+1] filtered_population_forecast = filtered_population[end-n_population_forecast_obs+1:end] # filtered growth rates dlpopulation_recorded = difflog(population_recorded[population_mnemonic]) dlfiltered_population_recorded = difflog(filtered_population_recorded) levels[:filtered_population] = filtered_population_recorded levels[:filtered_population_growth] = dlfiltered_population_recorded levels[:unfiltered_population_growth] = dlpopulation_recorded # Step 2: apply transformations to each series transformed = DataFrame() transformed[:date] = levels[:date] for series in keys(m.data_transforms) if VERBOSITY[verbose] >= VERBOSITY[:high] println("Transforming series " * string(series) * "...") end f = m.data_transforms[series] transformed[series] = f(levels) end sort!(transformed, cols = :date) end
{"hexsha": "df5ff598ed781a487d6650c5d20c6d1a390850a4", "size": 3493, "ext": "jl", "lang": "Julia", "max_stars_repo_path": "src/data/transform_data.jl", "max_stars_repo_name": "bgoodri/DSGE.jl", "max_stars_repo_head_hexsha": "6f9077ab8e9912bbade15b40c9c78c298c26e8f0", "max_stars_repo_licenses": ["BSD-3-Clause"], "max_stars_count": 2, "max_stars_repo_stars_event_min_datetime": "2017-09-17T22:06:32.000Z", "max_stars_repo_stars_event_max_datetime": "2019-03-07T23:16:32.000Z", "max_issues_repo_path": "src/data/transform_data.jl", "max_issues_repo_name": "bgoodri/DSGE.jl", "max_issues_repo_head_hexsha": "6f9077ab8e9912bbade15b40c9c78c298c26e8f0", "max_issues_repo_licenses": ["BSD-3-Clause"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/data/transform_data.jl", "max_forks_repo_name": "bgoodri/DSGE.jl", "max_forks_repo_head_hexsha": "6f9077ab8e9912bbade15b40c9c78c298c26e8f0", "max_forks_repo_licenses": ["BSD-3-Clause"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 41.0941176471, "max_line_length": 100, "alphanum_fraction": 0.731176639, "num_tokens": 784}
"""Connect four game. """ import numpy as np class Connect_four_game: def __init__(self): self.n_in_a_row = 4 self.board_dim = 6 self.reset() self.bad_move = 0 #States: # 0: start # 1: player 1 # 2: check for win? # 3: player 2 # 4: check for win? # 5: game over # 6: reset game def reset(self): self.grid = [[0 for i in range(self.board_dim)] for i in range(self.board_dim)] self.last_move = [0,0] self.state = 0 self.bad_move = 0 def get_state(self): return np.array(self.grid).flatten() def place(self, col): if self.state == 1 or self.state == 3: if self.grid[col][0] == 0: #Valid move i = self.board_dim - 1 while self.grid[col][i] != 0: i -= 1 self.grid[col][i] = self.turn() self.state += 1 self.last_move = [col, i] else: self.bad_move = self.turn() self.state += 1 return def turn(self): if self.state < 3: return 1 else: return 2 def win(self): # print(f'bad_move {self.bad_move}') if self.bad_move == 1: # self.bad_move = 0 return 2 elif self.bad_move == 2: # self.bad_move = 0 return 1 #Check for win - Tjekker alle muligheder for begge spillere: 3*6*2+3*3*2 = 54 kompinationer for hvert træk - mange flere, hvis brættet havde været større p_x = self.last_move[0] p_y = self.last_move[1] p = self.grid[p_x][p_y] if self.vert_horiz([p_x, p_y], p) or self.vert_horiz([p_y, p_x], p, switch=True) or self.diagonal([p_x, p_y], p) or self.diagonal([p_x, p_y], p, switch=True): return p return 0 def vert_horiz(self, coords, p, switch=False): # Antal kolonner / rækker venstre og højre eller op og ned: lu = 3 if coords[0] - self.n_in_a_row - 1 >= 0 else coords[0] # left or up rd = min(self.board_dim -1 - coords[0], self.n_in_a_row - 1) # right or down in_row = 0 reset = False for i in range(coords[0] - lu, coords[0] + rd+1): field_check = self.grid[i][coords[1]] if not switch else self.grid[coords[1]][i] if field_check == p: if reset: # Reset in_row = 1 reset = False else: in_row += 1 # Endnu en på stribe else: reset = True # Reset næste gang et felt passer # print("coords: {}, in_row {}".format(coords, in_row)) if in_row == self.n_in_a_row: return True def diagonal(self, coords, p, switch=False): # Antal felter skråt ned højre if not switch: r = 3 if coords[0] + self.n_in_a_row - 1 < self.board_dim and coords[1] + self.n_in_a_row - 1 < self.board_dim else min(self.board_dim -1 - coords[0], self.board_dim -1 - coords[1]) # right down l = 3 if coords[0] - self.n_in_a_row + 1 > 0 and coords[1] - self.n_in_a_row + 1 > 0 else min(coords[0], coords[1]) # left up else: r = 3 if coords[0] + self.n_in_a_row - 1 < self.board_dim and coords[1] - self.n_in_a_row - 1 > 0 else min(self.board_dim - 1 - coords[0], coords[1], 3) # right up l = 3 if coords[0] - self.n_in_a_row + 1 > 0 and coords[1] + self.n_in_a_row - 1 < self.board_dim - 1 else min(coords[0], self.board_dim - 1 - coords[1], 3) # left up in_row = 0 reset = False for i in range(coords[0] - l, coords[0] + r + 1): if not switch: field_check = self.grid[i][coords[1] - (coords[0] - i)] else: field_check = self.grid[i][coords[1] + coords[0] - i] if field_check == p: if reset: # Reset in_row = 1 reset = False else: in_row += 1 # Endnu en på stribe else: reset = True # Reset næste gang et felt passer if in_row == self.n_in_a_row: return True def print_game(self, grid): for row in grid: row_print = '' for field in row: if field == 0: color = bcolors.ENDC + bcolors.ENDB if field == 1: color = bcolors.BBLUE + bcolors.CWHITE elif field == 2: color = bcolors.BRED + bcolors.CWHITE row_print += (f'{color} {field} {bcolors.ENDC}') print(row_print) def invert_state(self, state): indices_one = state == 1 indices_two = state == 2 state[indices_one] = 2 state[indices_two] = 1 return state class bcolors: CBLUE = '\033[94m' CRED = '\033[31m' BBLUE = '\033[44m' BRED = '\033[41m' ENDC = '\033[0m' ENDB = '\033[0;39m' HEADER = '\033[95m' OKCYAN = '\033[96m' OKGREEN = '\033[92m' WARNING = '\033[93m' FAIL = '\033[91m' CWHITE = '\033[1;37m' BOLD = '\033[1m' UNDERLINE = '\033[4m'
{"hexsha": "8688771ada387d4775ccd5dcbd80cd3ccc2f6058", "size": 5435, "ext": "py", "lang": "Python", "max_stars_repo_path": "examples/connect_four/game.py", "max_stars_repo_name": "kasperskov01/pysnaike", "max_stars_repo_head_hexsha": "401a4601cbbd151470fa9ac0575288f89fa93240", "max_stars_repo_licenses": ["MIT"], "max_stars_count": 1, "max_stars_repo_stars_event_min_datetime": "2021-03-20T21:54:28.000Z", "max_stars_repo_stars_event_max_datetime": "2021-03-20T21:54:28.000Z", "max_issues_repo_path": "examples/connect_four/game.py", "max_issues_repo_name": "kasperskov01/pysnaike", "max_issues_repo_head_hexsha": "401a4601cbbd151470fa9ac0575288f89fa93240", "max_issues_repo_licenses": ["MIT"], "max_issues_count": null, "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "examples/connect_four/game.py", "max_forks_repo_name": "kasperskov01/pysnaike", "max_forks_repo_head_hexsha": "401a4601cbbd151470fa9ac0575288f89fa93240", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 35.2922077922, "max_line_length": 206, "alphanum_fraction": 0.493100276, "include": true, "reason": "import numpy", "num_tokens": 1545}
#!/bin/python import numpy as np class LabelGroup(): def __init__(self, baseNames): self.base = baseNames self.cropped = self.crop(self.base) # lowercase greek letters for niceness; self.clusterSymbolMap = [chr(945 + x) for x in range(55)] print(self.cropped) @staticmethod def crop(Labels, maxSize=13, Replacer="..."): croppedLabels = [] maxSize -= len(Replacer) for label in Labels: if len(label) > maxSize: crop_size = len(label) - maxSize crop_size += crop_size % 2 crop_size //= 2 mid_point = len(label) // 2 allowed_side_size = mid_point - crop_size cropped = label[:allowed_side_size] cropped += Replacer cropped += label[-allowed_side_size:] else: cropped = label croppedLabels.append(cropped) return croppedLabels def clusterize(self, clusterGroup): Cluster = [None for z in self.base] for n in clusterGroup.keys(): if len(clusterGroup[n]) > 1: for member in clusterGroup[n]: idx = None for l, label in enumerate(self.base): if label == member or label == member[:30]: idx = l if idx is not None: Cluster[idx] = n return Cluster def get_labels(self, Cluster=[], symbolSide=0): Output = [] symbolSideFormat = [ "{symbol}{spacer}{label}", "{label}{spacer}{symbol}" ] for k, label in enumerate(self.cropped): if Cluster and Cluster[k] is not None: symbol = self.clusterSymbolMap[Cluster[k]] else: symbol = " " label_content = { 'label': label, 'spacer': " " * (15 - len(label)), 'symbol': symbol } output_label = symbolSideFormat[symbolSide].format(**label_content) Output.append(output_label) return Output def get_ordered(self, reorderIndexes, **kwargs): r = np.array(self.get_labels(**kwargs)) r = r[reorderIndexes] return list(r)
{"hexsha": "ebfcfc74e664e488aab9327c8da13db4a321a77a", "size": 2364, "ext": "py", "lang": "Python", "max_stars_repo_path": "straintables/Viewer/MatrixLabelGroup.py", "max_stars_repo_name": "Gab0/linkageMapper", "max_stars_repo_head_hexsha": "549b292e5b6ab22e03373483cd27236aa2f635eb", "max_stars_repo_licenses": ["MIT"], "max_stars_count": null, "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "straintables/Viewer/MatrixLabelGroup.py", "max_issues_repo_name": "Gab0/linkageMapper", "max_issues_repo_head_hexsha": "549b292e5b6ab22e03373483cd27236aa2f635eb", "max_issues_repo_licenses": ["MIT"], "max_issues_count": 1, "max_issues_repo_issues_event_min_datetime": "2020-05-03T15:13:07.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-04T03:01:59.000Z", "max_forks_repo_path": "straintables/Viewer/MatrixLabelGroup.py", "max_forks_repo_name": "Gab0/straintables", "max_forks_repo_head_hexsha": "549b292e5b6ab22e03373483cd27236aa2f635eb", "max_forks_repo_licenses": ["MIT"], "max_forks_count": null, "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null, "avg_line_length": 28.4819277108, "max_line_length": 79, "alphanum_fraction": 0.5063451777, "include": true, "reason": "import numpy", "num_tokens": 489}