Built with Alectryon, running Coq+SerAPI v8.20.0+0.20.0. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑Ctrl+↓ to navigate, Ctrl+🖱️ to focus. On Mac, use ⌘ instead of Ctrl.
[Loading ML file ssrmatching_plugin.cmxs (using legacy method) ... done]
[Loading ML file ssreflect_plugin.cmxs (using legacy method) ... done]
[Loading ML file ring_plugin.cmxs (using legacy method) ... done]
Serlib plugin: coq-elpi.elpi is not available: serlib support is missing.
Incremental checking for commands in this plugin will be impacted.
[Loading ML file coq-elpi.elpi ... done]
Notation"_ + _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ - _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ <= _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ < _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ >= _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ > _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Notation"_ <= _ <= _" was already used in scope
nat_scope. [notation-overridden,parsing,default]
Notation"_ < _ <= _" was already used in scope
nat_scope. [notation-overridden,parsing,default]
Notation"_ <= _ < _" was already used in scope
nat_scope. [notation-overridden,parsing,default]
Notation"_ < _ < _" was already used in scope
nat_scope. [notation-overridden,parsing,default]
Notation"_ * _" was already used in scope nat_scope.
[notation-overridden,parsing,default]
Require Export prosa.util.tactics.(** A function to calculate the least common multiple of all integers in a sequence [xs], denoted by [lcml xs]. *)Definitionlcml (xs : seq nat) : nat := foldr lcmn 1 xs.(** First we show that [x] divides [lcml (x :: xs)] for any [x] and [xs]. *)
lcmn a
((fix foldr (s : seq nat) : nat :=
match s with
| [::] => 1
| x :: s' => lcmn x (foldr s')
end) xs)
%| lcmn x
((fix foldr (s : seq nat) : nat :=
match s with
| [::] => 1
| x :: s' => lcmn x (foldr s')
end) ([:: a] ++ xs))
byapply dvdn_lcmr.Qed.(** Given a sequence [xs], any integer [x \in xs] divides [lcml xs]. *)
forall (x : nat) (xs : seq nat),
x \in xs -> x %| lcml xs
forall (x : nat) (xs : seq nat),
x \in xs -> x %| lcml xs
x: nat xs: seq nat IN: x \in xs
existsk : nat, lcml xs = k * x
x, z: nat sq: seq nat IN: x \in z :: sq IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x
existsk : nat, lcml (z :: sq) = k * x
x, z: nat sq: seq nat IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x IN: (x == z) || (x \in sq)
existsk : nat, lcml (z :: sq) = k * x
x, z: nat sq: seq nat IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x EQ: x = z
existsk : nat, lcml (z :: sq) = k * x
x, z: nat sq: seq nat IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x IN: x \in sq
existsk : nat, lcml (z :: sq) = k * x
x, z: nat sq: seq nat IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x EQ: x = z
existsk : nat, lcml (z :: sq) = k * x
x, z: nat sq: seq nat IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x EQ: x = z
x %| lcml (z :: sq)
x, z: nat sq: seq nat IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x EQ: x = z
z %| foldr lcmn 1 (z :: sq)
byapply int_divides_lcm_in_seq.
x, z: nat sq: seq nat IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x IN: x \in sq
existsk : nat, lcml (z :: sq) = k * x
x, z: nat sq: seq nat IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x IN: x \in sq k: nat EQ: lcml sq = k * x
existsk : nat, lcml (z :: sq) = k * x
x, z: nat sq: seq nat IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x IN: x \in sq k: nat EQ: lcml sq = k * x
lcml (z :: sq) =
foldr lcmn 1 (z :: sq) %/ foldr lcmn 1 sq * k * x
x, z: nat sq: seq nat IH_DIV: x \in sq -> existsk : nat, lcml sq = k * x IN: x \in sq k: nat EQ: lcml sq = k * x
foldr lcmn 1 sq %| foldr lcmn 1 (z :: sq)
byapply lcm_seq_divides_lcm_super.Qed.(** The LCM of all elements in a sequence with only positive elements is positive. *)