1+ Require Coq.Strings.Ascii.
2+ Require Coq.Strings.String.
13Require Import Coq.Strings.String.
24Require Import Coq.Program .Wf.
35Require Import Coq.PArith.BinPos.
@@ -133,11 +135,10 @@ Section sum_Show.
133135 " "%char <<
134136 payload <<
135137 ")"%char.
136-
138+
137139End sum_Show.
138140
139141Section foldable_Show.
140- Require Import ExtLib.Structures.Reducible.
141142 Polymorphic Context {A:Type} {B:Type} {F : Foldable B A} {BS : Show A}.
142143
143144 Global Polymorphic Instance foldable_Show : Show B :=
@@ -154,51 +155,51 @@ Polymorphic Fixpoint iter_show (ss : list showM) : showM :=
154155Section hiding_notation.
155156 Import ShowNotation.
156157 Local Open Scope show_scope.
157- Require Import Ascii.
158- Require Import String.
158+ Import Ascii.
159+ Import String.
159160
160- Global Instance unit_Show : Show unit :=
161+ Global Instance unit_Show : Show unit :=
161162 { show u := "tt"%string }.
162- Global Instance bool_Show : Show bool :=
163+ Global Instance bool_Show : Show bool :=
163164 { show b := if b then "true"%string else "false"%string }.
164- Global Instance ascii_Show : Show ascii :=
165- fun a => "'"%char << a << "'"%char.
166- Global Instance string_Show : Show string :=
165+ Global Instance ascii_Show : Show ascii :=
166+ fun a => "'"%char << a << "'"%char.
167+ Global Instance string_Show : Show string :=
167168 { show s := """"%char << s << """"%char }.
168169
169- Program Fixpoint nat_show (n:nat) {measure n} : showM :=
170- if Compare_dec.le_gt_dec n 9 then
171- inject (Char.digit2ascii n)
172- else
173- let n' := NPeano.Nat.div n 10 in
174- (@nat_show n' _) << (inject (Char.digit2ascii (n - 10 * n'))).
175- Next Obligation .
176- assert (NPeano.Nat.div n 10 < n) ; eauto .
177- eapply NPeano.Nat.div_lt.
178- inversion H; apply Lt.lt_O_Sn.
179- repeat constructor.
180- Defined .
181- Global Instance nat_Show : Show nat := { show := nat_show }.
182-
183- Global Instance Show_positive : Show positive :=
184- fun x => nat_show (Pos.to_nat x).
185-
186- Global Instance Show_Z : Show Z :=
187- fun x =>
188- match x with
170+ Program Fixpoint nat_show (n:nat) {measure n} : showM :=
171+ if Compare_dec.le_gt_dec n 9 then
172+ inject (Char.digit2ascii n)
173+ else
174+ let n' := NPeano.Nat.div n 10 in
175+ (@nat_show n' _) << (inject (Char.digit2ascii (n - 10 * n'))).
176+ Next Obligation .
177+ assert (NPeano.Nat.div n 10 < n) ; eauto .
178+ eapply NPeano.Nat.div_lt.
179+ inversion H; apply Lt.lt_O_Sn.
180+ repeat constructor.
181+ Defined .
182+ Global Instance nat_Show : Show nat := { show := nat_show }.
183+
184+ Global Instance Show_positive : Show positive :=
185+ fun x => nat_show (Pos.to_nat x).
186+
187+ Global Instance Show_Z : Show Z :=
188+ fun x =>
189+ match x with
189190 | Z0 => "0"%char
190191 | Zpos p => show p
191192 | Zneg p => "-"%char << show p
192- end .
193-
194- Section pair_Show.
195- Polymorphic Definition pair_Show@{a m}
196- {A : Type @{a}} {B : Type @{a}} {AS:Show A} {BS:Show B}
197- : Show (A*B) :=
198- fun p =>
199- let (a,b) := p in
200- "("%char << show a << ","%char << show b << ")"%char.
201- End pair_Show.
193+ end .
194+
195+ Section pair_Show.
196+ Polymorphic Definition pair_Show@{a m}
197+ {A : Type @{a}} {B : Type @{a}} {AS:Show A} {BS:Show B}
198+ : Show (A*B) :=
199+ fun p =>
200+ let (a,b) := p in
201+ "("%char << show a << ","%char << show b << ")"%char.
202+ End pair_Show.
202203End hiding_notation.
203204
204205
0 commit comments