@@ -1211,6 +1211,17 @@ Proof.
12111211 rewrite Hy_eq. apply phr_ip_zero_r_real.
12121212Qed .
12131213
1214+ (** ip(neg x, y) = - ip(x, y), derived from symmetry + neg_r. *)
1215+ Lemma phr_ip_neg_l : forall (H : PreHilbertR) (x y : H),
1216+ phr_ip H (phr_neg H x) y = - phr_ip H x y.
1217+ Proof .
1218+ intros H x y.
1219+ rewrite (phr_ip_sym H (phr_neg H x) y).
1220+ rewrite phr_ip_neg_r.
1221+ rewrite phr_ip_sym.
1222+ reflexivity.
1223+ Qed .
1224+
12141225(* §10c — Abstract Cauchy-Schwarz for PreHilbertR *)
12151226
12161227(** Auxiliary vector: w = λ·x - ip(y,x)·y where λ = phr_norm2 y *)
@@ -1231,16 +1242,34 @@ Proof.
12311242 unfold phr_cs_aux, phr_norm2.
12321243 (* w = (phr_norm2 H y)·x + neg((phr_ip H y x)·y).
12331244 Expand ip(w,w) by bilinearity and symmetry. *)
1245+ (* Name the three scalar values for clarity. *)
12341246 set (λ := phr_ip H y y).
1235- (* Do NOT set β here — keep phr_ip H y x literal so rewrites find it. *)
1247+ set (β := phr_ip H y x).
1248+ set (w1 := phr_scal H λ x).
1249+ set (w2 := phr_neg H (phr_scal H β y)).
1250+ (* Assert the four bilinear terms. *)
1251+ assert (H11 : phr_ip H w1 w1 = λ * λ * phr_ip H x x).
1252+ { unfold w1. rewrite phr_ip_scal_l. rewrite phr_ip_scal_r. ring. }
1253+ assert (H12 : phr_ip H w1 w2 = λ * (- β) * phr_ip H x y).
1254+ { unfold w1, w2. rewrite phr_ip_scal_l. rewrite phr_ip_neg_r.
1255+ rewrite phr_ip_scal_r. ring. }
1256+ assert (H21 : phr_ip H w2 w1 = λ * (- β) * phr_ip H x y).
1257+ { unfold w1, w2. rewrite phr_ip_neg_l. rewrite phr_ip_scal_l.
1258+ rewrite phr_ip_scal_r. rewrite (phr_ip_sym H y x). fold β. ring. }
1259+ assert (H22 : phr_ip H w2 w2 = β * β * λ).
1260+ { unfold w2. rewrite phr_ip_neg_l. rewrite phr_ip_neg_r.
1261+ rewrite phr_ip_scal_l. rewrite phr_ip_scal_r. fold λ. ring. }
1262+ (* ip(w, w) = H11 + H12 + H21 + H22 *)
1263+ unfold phr_cs_aux.
12361264 rewrite phr_ip_linear_l.
1237- rewrite phr_ip_linear_r, phr_ip_linear_r.
1238- rewrite phr_ip_scal_l, phr_ip_scal_l.
1239- rewrite phr_ip_scal_r, phr_ip_scal_r.
1240- rewrite phr_ip_neg_r, phr_ip_neg_r.
1241- (* Now ip(y,x) appears literally — apply symmetry *)
1242- rewrite (phr_ip_sym H y x).
1243- (* Everything is now in terms of λ = ip(y,y) and ip(x,y). *)
1265+ rewrite phr_ip_linear_r. rewrite phr_ip_linear_r.
1266+ fold w1 w2.
1267+ rewrite H11, H12, H21, H22.
1268+ (* β = ip(y,x) = ip(x,y) *)
1269+ assert (Hβ : β = phr_ip H x y).
1270+ { unfold β. apply phr_ip_sym. }
1271+ rewrite Hβ.
1272+ fold λ.
12441273 ring.
12451274Qed .
12461275
@@ -1250,27 +1279,170 @@ Theorem phr_cauchy_schwarz :
12501279 (phr_ip H x y)^2 <= phr_norm2 H x * phr_norm2 H y.
12511280Proof .
12521281 intros H x y.
1253- unfold phr_norm2.
1254- set (λ := phr_ip H y y).
1255- set (A := phr_ip H x y).
1256- pose proof (phr_norm2_nonneg H x) as Hxnn. unfold phr_norm2 in Hxnn.
1257- pose proof (phr_norm2_nonneg H y) as Hynn. unfold phr_norm2 in Hynn.
1258- destruct (Req_dec λ 0) as [Hy0 | Hynz].
1259- - (* λ = 0 ⟹ ip(x,y) = 0 ⟹ LHS = 0 *)
1260- assert (Hy_eq : y = phr_zero H).
1261- { apply phr_ip_zero_iff. exact Hy0. }
1262- assert (HAzero : A = 0).
1263- { unfold A. rewrite Hy_eq. apply phr_ip_zero_r_real. }
1264- rewrite HAzero. ring_simplify. lra.
1265- - assert (Hypos : 0 < λ) by lra.
1282+ pose proof (phr_norm2_nonneg H x) as Hxnn.
1283+ pose proof (phr_norm2_nonneg H y) as Hynn.
1284+ unfold phr_norm2 in *.
1285+ destruct (Req_dec (phr_ip H y y) 0) as [Hy0 | Hynz].
1286+ - (* ip(y,y) = 0 ⟹ y = 0 ⟹ ip(x,y) = 0 ⟹ LHS = 0 *)
1287+ assert (Hy_eq : y = phr_zero H) by (apply phr_ip_zero_iff; exact Hy0).
1288+ assert (HAzero : phr_ip H x y = 0).
1289+ { rewrite Hy_eq. apply phr_ip_zero_r_real. }
1290+ rewrite HAzero. rewrite Hy0. lra.
1291+ - assert (Hypos : 0 < phr_ip H y y) by lra.
12661292 pose proof (phr_cs_expand_norm H x y) as Haux.
12671293 pose proof (phr_norm2_nonneg H (phr_cs_aux H x y)) as Hauxnn.
12681294 unfold phr_norm2 in Haux, Hauxnn.
12691295 rewrite Haux in Hauxnn.
1270- (* Hauxnn: 0 <= λ * (λ * ip(x,x) - A ^2) *)
1271- assert (Hbracket : 0 <= λ * phr_ip H x x - A ^2).
1272- { apply Rmult_le_reg_l with (r := λ ); [exact Hypos|].
1296+ (* Hauxnn: 0 <= ip(y,y) * (ip(y,y)* ip(x,x) - ip(x,y) ^2) *)
1297+ assert (Hbracket : 0 <= phr_ip H y y * phr_ip H x x - (phr_ip H x y) ^2).
1298+ { apply Rmult_le_reg_l with (r := phr_ip H y y ); [exact Hypos|].
12731299 rewrite Rmult_0_r. lra. }
1274- unfold λ, A in *.
12751300 lra.
12761301Qed .
1302+
1303+ (* ====================================================================
1304+ §11 Rung 4 — Self-adjoint operators, variance, and Robertson
1305+ uncertainty (real PreHilbert, unit-vector state).
1306+
1307+ Deliverable:
1308+ §11a Definition: SelfAdj H A — symmetric (self-adjoint) linear map.
1309+ §11b Definition: expect, variance, centered vector.
1310+ §11c Key lemma: norm2 of centered vector = variance (for self-adjoint A
1311+ and unit psi).
1312+ §11d robertson_real: Var(A) * Var(B) >= Cov(A,B)^2 — follows directly
1313+ from phr_cauchy_schwarz on the centered vectors.
1314+
1315+ This closes Rung 4. The full quantum Robertson (complex scalars,
1316+ commutator lower bound) is Rung 5+ (not in scope this session).
1317+ ==================================================================== *)
1318+
1319+ (* ── §11a Self-adjoint operator ─────────────────────────────────────── *)
1320+
1321+ (** A (possibly nonlinear) endomorphism of H. *)
1322+ Definition PHREndo (H : PreHilbertR) := H -> H.
1323+
1324+ (** Self-adjointness / symmetry: ip x (A y) = ip (A x) y for all x, y. *)
1325+ Definition SelfAdj (H : PreHilbertR) (A : PHREndo H) : Prop :=
1326+ forall x y : H, phr_ip H x (A y) = phr_ip H (A x) y.
1327+
1328+ (** Self-adjoint A implies ip (A x) y = ip x (A y). *)
1329+ Lemma self_adj_swap :
1330+ forall (H : PreHilbertR) (A : PHREndo H),
1331+ SelfAdj H A ->
1332+ forall x y : H, phr_ip H (A x) y = phr_ip H x (A y).
1333+ Proof .
1334+ intros H A Hadj x y.
1335+ symmetry. apply Hadj.
1336+ Qed .
1337+
1338+ (** Self-adjoint A: ip (A x) x = ip x (A x). *)
1339+ Lemma self_adj_diag_sym :
1340+ forall (H : PreHilbertR) (A : PHREndo H),
1341+ SelfAdj H A ->
1342+ forall x : H, phr_ip H (A x) x = phr_ip H x (A x).
1343+ Proof .
1344+ intros H A Hadj x.
1345+ rewrite (self_adj_swap H A Hadj x x). reflexivity.
1346+ Qed .
1347+
1348+ (* ── §11b Expectation, variance, and centered vector ────────────────── *)
1349+
1350+ (** Expectation of operator A in state psi: E_psi(A) = ip psi (A psi). *)
1351+ Definition phr_expect (H : PreHilbertR) (A : PHREndo H) (psi : H) : R :=
1352+ phr_ip H psi (A psi).
1353+
1354+ (** Variance: Var_psi(A) = E_psi(A^2) - E_psi(A)^2.
1355+ Defined as ip psi (A(A psi)) - (ip psi (A psi))^2. *)
1356+ Definition phr_variance (H : PreHilbertR) (A : PHREndo H) (psi : H) : R :=
1357+ phr_ip H psi (A (A psi)) - (phr_ip H psi (A psi))^2.
1358+
1359+ (** Centered vector: u_A = A psi - E_A * psi.
1360+ When psi is a unit vector, ||u_A||^2 = Var_psi(A). *)
1361+ Definition phr_centered (H : PreHilbertR) (A : PHREndo H) (psi : H) : H :=
1362+ phr_add H (A psi) (phr_neg H (phr_scal H (phr_ip H psi (A psi)) psi)).
1363+
1364+ (* ── §11c Norm of centered vector = variance (for unit, self-adjoint) ── *)
1365+
1366+ (** Unit-state: ||psi||^2 = 1. *)
1367+ Definition phr_unit (H : PreHilbertR) (psi : H) : Prop :=
1368+ phr_norm2 H psi = 1.
1369+
1370+ (** For a self-adjoint A and a unit psi, ip(A psi)(psi) = E_psi(A).
1371+ (Immediate from self_adj_swap + symmetry of ip.) *)
1372+ Lemma self_adj_ip_Apsi_psi :
1373+ forall (H : PreHilbertR) (A : PHREndo H) (psi : H),
1374+ SelfAdj H A ->
1375+ phr_ip H (A psi) psi = phr_expect H A psi.
1376+ Proof .
1377+ intros H A psi Hadj.
1378+ unfold phr_expect.
1379+ rewrite (phr_ip_sym H (A psi) psi).
1380+ apply Hadj.
1381+ Qed .
1382+
1383+ (** Expand ip(u_A, u_A) for self-adjoint A and unit psi. *)
1384+ Lemma phr_centered_norm2 :
1385+ forall (H : PreHilbertR) (A : PHREndo H) (psi : H),
1386+ SelfAdj H A ->
1387+ phr_unit H psi ->
1388+ phr_norm2 H (phr_centered H A psi) = phr_variance H A psi.
1389+ Proof .
1390+ intros H A psi Hadj Hunit.
1391+ unfold phr_centered, phr_variance, phr_expect, phr_norm2.
1392+ set (E := phr_ip H psi (A psi)).
1393+ set (u := phr_add H (A psi) (phr_neg H (phr_scal H E psi))).
1394+ (* Expand ip(u, u) = ip(Apsi, Apsi) - 2*E*ip(psi, Apsi) + E^2*ip(psi,psi). *)
1395+ unfold u.
1396+ rewrite phr_ip_linear_l.
1397+ rewrite phr_ip_linear_r, phr_ip_linear_r.
1398+ rewrite phr_ip_neg_r, phr_ip_neg_r.
1399+ rewrite phr_ip_scal_r, phr_ip_scal_r.
1400+ (* phr_unit psi: phr_ip H psi psi = 1. *)
1401+ unfold phr_unit, phr_norm2 in Hunit.
1402+ (* ip(Apsi, Apsi) = ip(psi, A(Apsi)) by self-adjointness. *)
1403+ rewrite (Hadj (A psi) psi).
1404+ (* ip(Apsi, psi) = ip(psi, Apsi) by symmetry and self-adj. *)
1405+ rewrite (phr_ip_sym H (A psi) psi).
1406+ rewrite (Hadj psi psi).
1407+ fold E.
1408+ (* Now we have:
1409+ ip(psi, A(Apsi)) - E * ip(psi, Apsi) - (E * ip(psi, Apsi) - E * E * ip(psi,psi)) *)
1410+ lra.
1411+ Qed .
1412+
1413+ (* ── §11d Robertson uncertainty bound ───────────────────────────────── *)
1414+
1415+ (** Covariance of A and B in state psi:
1416+ Cov_psi(A, B) = ip(u_A, u_B) where u_X is the centered vector of X.
1417+ For self-adjoint A, B and unit psi this equals
1418+ ip(psi, A(B psi)) - E_A * E_B. *)
1419+ Definition phr_covariance (H : PreHilbertR) (A B : PHREndo H) (psi : H) : R :=
1420+ phr_ip H (phr_centered H A psi) (phr_centered H B psi).
1421+
1422+ (** Robertson uncertainty for a real PreHilbert space:
1423+ Var_psi(A) * Var_psi(B) >= Cov_psi(A, B)^2.
1424+
1425+ Proof: let u = u_A (centered vector of A) and v = u_B.
1426+ By phr_cauchy_schwarz: (ip u v)^2 <= ip(u,u) * ip(v,v).
1427+ By phr_centered_norm2: ip(u,u) = Var(A) and ip(v,v) = Var(B).
1428+ By definition: ip(u,v) = Cov(A, B).
1429+ Together: Cov^2 <= Var(A) * Var(B). *)
1430+ Theorem robertson_real :
1431+ forall (H : PreHilbertR) (A B : PHREndo H) (psi : H),
1432+ SelfAdj H A ->
1433+ SelfAdj H B ->
1434+ phr_unit H psi ->
1435+ (phr_covariance H A B psi)^2 <= phr_variance H A psi * phr_variance H B psi.
1436+ Proof .
1437+ intros H A B psi HsA HsB Hunit.
1438+ unfold phr_covariance.
1439+ (* By phr_cauchy_schwarz: (ip u v)^2 <= norm2 u * norm2 v. *)
1440+ pose proof (phr_cauchy_schwarz H
1441+ (phr_centered H A psi)
1442+ (phr_centered H B psi)) as Hcs.
1443+ (* Rewrite norm2(u_A) = Var(A) and norm2(u_B) = Var(B). *)
1444+ rewrite (phr_centered_norm2 H A psi HsA Hunit) in Hcs.
1445+ rewrite (phr_centered_norm2 H B psi HsB Hunit) in Hcs.
1446+ (* phr_cauchy_schwarz gives (ip u v)^2 <= norm2 u * norm2 v. *)
1447+ lra.
1448+ Qed .
0 commit comments