-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcoq_is_total.v
46 lines (36 loc) · 1.34 KB
/
coq_is_total.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(**************************************************************)
(* Copyright Dominique Larchey-Wendling [*] *)
(* *)
(* [*] Affiliation LORIA -- CNRS *)
(**************************************************************)
(* This file is distributed under the terms of the *)
(* CeCILL v2 FREE SOFTWARE LICENSE AGREEMENT *)
(**************************************************************)
Require Import utils decidable_t nat_minimizer.
Require Import recalg ra_rel ra_ca ra_sem_eq ra_ca_props.
Set Implicit Arguments.
Section Coq_is_total.
Variables (k : nat) (f : recalg k) (Hf : forall v, exists x, [|f|] v x).
Let coq_f v : { n : nat & { x | [f;v] -[n>> x } }.
Proof.
apply nat_reify_t.
apply ra_ca_decidable_t.
destruct (Hf v) as (x & Hx).
apply ra_ca_correct in Hx.
destruct Hx as (n & ?).
exists n; exists; exists x; trivial.
Qed.
Let cf v := proj1_sig (projT2 (coq_f v)).
Let Hcf v : [|f|] v (cf v).
Proof.
apply ra_ca_correct.
exists (projT1 (coq_f v)).
apply (proj2_sig (projT2 (coq_f v))).
Qed.
Theorem Coq_is_total : { cf | forall v, [|f|] v (cf v) }.
Proof.
exists cf; auto.
Qed.
End Coq_is_total.
Check Coq_is_total.
Print Assumptions Coq_is_total.