> rewrite (plusSuccRightSucc y x) ---------- Other goals: ---------- { hole 3 } { hole 2 } { hole 1 } { hole 0 } ---------- Assumptions: ---------- x : Nat y : Nat hypothesis : plus x y = plus y x ---------- Goal: ---------- { hole 4 }: S (plus x y) = S (plus y x)
> rewrite hypothesis ---------- Other goals: ---------- { hole 4 } { hole 3 } { hole 2 } { hole 1 } { hole 0 } ---------- Assumptions: ---------- x : Nat y : Nat hypothesis : plus x y = plus y x ---------- Goal: ---------- { hole 5 }: S (plus x y) = S (plus x y)
> rewrite hypothesis ---------- Other goals: ---------- { hole 4 } { hole 3 } { hole 2 } { hole 1 } { hole 0 } ---------- Assumptions: ---------- x : Nat y : Nat hypothesis : plus x y = plus y x ---------- Goal: ---------- { hole 5 }: S (plus x y) = S (plus x y)
> trivial inductive: No more goals. > qed Proof completed! Math.inductive = proof intros rewrite (plusSuccRightSucc y x) rewrite hypothesis trivial
3. Applying the ideas in the real world
Mission: Edit audio clips
class Audio { public: };
class Audio { public: size_t count() const; };
class Audio { public: size_t count() const; int16_t operator[](size_t i) const; int16_t& operator[](size_t i); };
class Audio { public: size_t count() const; int16_t operator[](size_t i) const; int16_t& operator[](size_t i); double timeAtZero() const; double sampleRate() const; };
class Audio { public: size_t count() const; int16_t operator[](size_t i) const; int16_t& operator[](size_t i); double timeAtZero() const; double sampleRate() const; double verticalScale() const; };
Audio audio; double time = 0.5; size_t index = (time - audio.timeAtZero()) / audio.sampleRate();
Audio audio; double time = 0.5; size_t index = (time - audio.timeAtZero()) / audio.sampleRate(); int16_t value = audio[index]; double level = static_cast<double>(value) * audio.verticalScale();
class Audio { public: size_t count() const; int16_t operator[](size_t i) const; int16_t& operator[](size_t i); double timeAtZero() const; double sampleRate() const; double verticalScale() const; };
class Audio { public: size_t count() const; int16_t operator[](size_t i) const; int16_t& operator[](size_t i); double timeAtZero() const; double sampleRate() const; double verticalScale() const; std::string fileName() const; std::string comments() const; bool isStereo() const; void loadFromFile(const std::string& filename); void saveToFile(const std::string& filename); };
What is an audio clip?
Recommend
More recommend