import OmegaTransport.Constants import OmegaTransport.Ledger import OmegaTransport.Codec namespace OmegaTransport theorem reference_ratio (a : ℝ) (ha : 0 < a) : (a * Omega.phi) / (a * Omega.phi + a * Real.pi) = Omega.lam := by rw [← mul_add] unfold Omega.lam field_simp [ne_of_gt ha, ne_of_gt Omega.denominator_pos] ring theorem affine_reference (v : ℝ) : (Omega.phi * v + Real.pi) / (Omega.phi + Real.pi) = 1 + Omega.lam * (v - 1) := by unfold Omega.lam field_simp [ne_of_gt Omega.denominator_pos] ring theorem coefficient_from_public_constants : Int.floor ((scale : ℝ) * Omega.lam) = (coefficient : ℤ) := by apply Int.floor_eq_iff.mpr obtain ⟨hl, hu⟩ := Omega.lam_bounds norm_num [scale, coefficient] at * constructor <;> linarith theorem remainder_history_recovers_seed (n : Nat) (d : Int) : let record := Omega.Ledger.encode coefficient scale n d Omega.Ledger.recover coefficient scale record.1 record.2 = d := Omega.Ledger.roundtrip _ _ (by decide) n d #print axioms reference_ratio #print axioms affine_reference #print axioms coefficient_from_public_constants #print axioms remainder_history_recovers_seed #print axioms packet_recovers_history #print axioms packet_recovers_trace_bytes #print axioms packet_injective #print axioms packet_399 #eval packet 399 end OmegaTransport