SQLCMD outputting text with spaces between letters - powershell

I have a powershell script that takes some inputs and uses them in a SQLCMD call, putting the output into a log file.
SQLCMD -Q $RestoreDB -S $SQLServer -d $DBName >> $SQLLogFile
The log file is a .txt file, but when I run this the output of the script (in this case, some information related to the restore process) is very odd:
C h a n g e d d a t a b a s e c o n t e x t t o ' m a s t e r ' .
N o n q u a l i f i e d t r a n s a c t i o n s a r e b e i n g r o l l e d b a c k . E s t i m a t e d r o l l b a c k c o m p l e t i o n : 1 0 0 % .
1 0 p e r c e n t p r o c e s s e d .
2 0 p e r c e n t p r o c e s s e d .
3 0 p e r c e n t p r o c e s s e d .
I think this is because Powershell uses unicode, so these are 2-byte characters (hence the space). Is there any way to change the way Powershell outputs, or should I pipe the output from SQLCMD using out-file -append and just change it there?

Related

How to solve R of Problems

what's the meaning of this?
R o R o R o R = R o R o R
As I understand it means R of R of R of R is same as R of R of R
But It seems there something more in discrete mathematics
Let us consider a relation R={(1,2),(2,3),(3,1)} defined on set S={1,2,3}.
R o R is calculated as follows
R o R(1) = R(2) = 3
R o R(2) = R(3) = 1
R o R(3) = R(1) = 2
R o R = {(1,3),(2,1),(3,2)}
similarly R o R o R = {(1,1),(2,2),(3,3)}
R o R o R o R = {(1,2),(2,3),(3,1)}
for this example R o R o R o R = R
In case your question R o R o R o R = R o R o R, The relation R={(1,1),(2,2),(3,3)} satisfies the equation.
You are correct; the meaning of:
R o R o R o R = R o R o R
Is this:
R of R of R of R is equal to R of R of R
We can infer some more about the nature of R based on this equality by composing with R's inverse:
R o R o R o R = R o R o R
(R^-1 o R^-1 o R^-1) o (R o R o R o R) = (R^-1 o R^-1 o R^-1) o (R o R o R)
(R^-1 o R^-1) o (R^-1 o R) o (R o R o R) = (R^-1 o R^-1) o (R^-1 o R) o (R o R)
(R^-1 o R^-1) o I o (R o R o R) = (R^-1 o R^-1) o I o (R o R)
(R^-1 o R^-1) o (R o R o R) = (R^-1 o R^-1) o (R o R)
You can repeat this process and find that:
R = I
is the only admissible solution.

Converging sequence to least upper bound

Given a non-empty subset of the real numbers E : R -> Prop, the completeness axiom gives a least upper bound l of E.
Is there a constructive function
lub_approx_seq (E : R -> Prop) (l : R)
: is_lub E l -> forall n:nat, { x:R | E x /\ l-1/n < x }
In classical mathematics we would argue that for all n:nat, l-1/n is not an upper bound, so there exists an x such that E x /\ l-1/n < x.
But in constructive mathematics, ~forall (not an upper bound) is weaker than exists.
If it is not possible for a general subset E, are there conditions on E that make it possible ?
EDIT
I'm particularly interested in the case where E is a downward-infinite interval. Then the converging sequence is simply fun n:nat => l-1/n and what remains to be proved is :
Lemma lub_approx (E : R -> Prop) (l : R)
: is_lub E l
-> (forall x y : R, x < y -> E y -> E x) (* interval *)
-> forall x : R, x < l -> E x

Coq - Proving condition about elements of sequence in Ssreflect

I have a goal that looks like this:
x \in [seq (f v j) | j <- enum 'I_m & P v j] -> 0 < x
In the above, f is a definition generating a solution of an inequality depending on v, j and P v j is a predicate restricting j to indices which satisfy another inequality.
I have already proven that Goal : P v j -> (f v j > 0), but how can I use this to prove that it holds for any x in the sequence? I have found just a few relevant lemmas like nthP which introduce sequence manipulation, which I'm very unfamiliar with.
Thanks in advance!
You need to use the mapP lemma (that characterizes membership wrt map):
Lemma U m (P : rel 'I_m) f v x (hp : forall j, P v j -> f v j > 0) :
x \in [seq f v j | j <- enum 'I_m & P v j] -> 0 < x.
Proof. by case/mapP=> [y]; rewrite mem_filter; case/andP=> /hp ? _ ->. Qed.

How to automatically introduce symmetries into Coq hypotheses?

I have some equalities (=) and unequalities (<>) in the hypotheses such as:
e : x2 = x1
n : x3 <> x1
I want to use tactics like assumption, but sometimes the expected (un)equality in the goal is in the other direction like:
x1 = x2
x1 <> x3
My question is:
Is it possible to automatically introduce the symmetric forms of (un)equality above into the hypotheses?
If not, is it possible to use Notation to write a tactical to do this.
So far, I can do this manually like this:
assert (x1 = x2) by (symmetry in e; assumption).
assert (x1 <> x3) by (unfold not; intro Hnot;
symmetry in Hnot; unfold not in n; apply n in Hnot; inversion Hnot).
But it is really tedious and noisy. I don't know enough about how to automate this or if there is a better way.
Perhaps this tactic can help:
Ltac maybe_intro_sym A B :=
match goal with
|[H:B=A|-_] => fail 1
|[H:A=B|-_] => assert (B=A) by auto
end.
Ltac maybe_intro_sym_neg A B :=
match goal with
|[H:B<>A|-_] => fail 1
|[H:A<>B|-_] => assert (B<>A) by auto
end.
Ltac intro_sym :=
repeat match goal with
|[H:?A=?B|-_] => maybe_intro_sym A B
|[H:?A<>?B|-_] => maybe_intro_sym_neg A B
end.
Here's an example:
Parameters a b c d:nat.
Goal a=b -> c=d -> c<>d -> True.
intros.
intro_sym.
Now the context is
H : a = b
H0 : c = d
H1 : c <> d
H2 : d = c
H3 : b = a
H4 : d <> c
============================
True

Merging two small sequencies - algorithm

Prove that it is enough to make at most 5 comparisons in order to merge two sorted sequences of lengths 2 and 5.
Suppose the input arrays are [a b c d e] and [x y]
We start by trying to insert x into the larger array. We do binary search but we take a chance: We don't start in the middle but slightly to the left: We check x < b.
If we're lucky x falls in the left (smaller) part of the array and we can compare x < a to figure out if the result should start with x a or a x. We then have 3 comparisons left for y which is sufficient to do a binary search.
If we're unlucky x falls in the right (larger) part of the array. In other words x should be in c d e. We continue the binary search by checking x < d.
If we're lucky this is false, because we then know that the result starts with a b c d and we can then check x < e and y < e to figure out the order of the last three elements.
If this is true, we check x < c to figure out if the sequence should start with a b c x or a b x. We then have 2 comparisons left which is enough to do a binary search for y since we know that it should be to the right of x.
This is of course just an outline of a solution and not a formal proof. However, it can easily be transformed to a formal proof using Hoare logic. It would look as follows:
{ a ≤ b ≤ c ≤ d ≤ e ∧ x ≤ y }
if (x < b) {
{ a ≤ b ≤ c ≤ d ≤ e ∧ x ≤ y ∧ x < b }
if (x < a) {
...
} else {
...
}
} else {
{ a ≤ b ≤ c ≤ d ≤ e ∧ x ≤ y ∧ b ≤ x }
if (x < d) {
...
} else {
...
}
}