Skip to Content.
Sympa Menu

coq-club - [Coq-Club] Is there a measure for these functions?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

[Coq-Club] Is there a measure for these functions?


Chronological Thread 
  • From: Junyoung Clare Jang <jjc9310 AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: [Coq-Club] Is there a measure for these functions?
  • Date: Mon, 3 Aug 2020 15:22:22 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jjc9310 AT gmail.com; spf=Pass smtp.mailfrom=jjc9310 AT gmail.com; spf=None smtp.helo=postmaster AT mail-yb1-f177.google.com
  • Ironport-phdr: 9a23:cDYO4hR4N2CvHWpoZLLTYMxUTdpsv+yvbD5Q0YIujvd0So/mwa6yZBWN2/xhgRfzUJnB7Loc0qyK6v6mBjBLuM3c+Fk5M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aFRrwLxd6KfroEYDOkcu3y/qy+5rOaAlUmTaxe7x/IAi3oAnLtMQbjoRuJrs/xxbJv3BFZ/lYyWR0KFyJgh3y/N2w/Jlt8yRRv/Iu6ctNWrjkcqo7ULJVEi0oP3g668P3uxbDSxCP5mYHXWUNjhVIGQnF4wrkUZr3ryD3q/By2CiePc3xULA0RTGv5LplRRP0lCsKMSMy/WfKgcJyka1bugqsqBN/zYDaY4+bKeRwcb/GcNwAWWZMRNxcWzBdDo6+aYYEEuoPPfxfr4n4v1YAqQa+BQ+sBePo1z9IgHD21rAk3uQlCw7GxhIvFM8KvnvOqtX1O7oZXOe3zKnK0TrOa/1b1Srh5IXTfRAhpOuDXbN0ccbL1UYvEAbFg0yWpIf4MDybyv4DvHKH7+p8S+2vkWgnphlyrzWvwsoihJXEip8bx13F6Ch0xII4KMC3RUN7Y9OpEZhduS6EO4Z5X88vTGBltTs5x7ACt5O3YjQGxpo7yhDfbfGMbouG4gr7WeqPPTt1gGhpdbG/ihqo70Ss1+nxWtOp3FtIrCdIlMTHuGoX2BzJ8MeHT+Nw/ke/1jaL0ADe8uRELlo1larfMpIgwqU/mocKvUTNAyP7mkf7gLWZdkUj/eio5ODnbav8qpCAMI90jxnyMqUomsOhHeQ1KhYCU3Sf9Oim17Du/Vf1TKtXgvAyiKXVrZLXKMYDqq68GQBV04Ij6xilDzeh1dQVhXsHLFBZdx+DgYXlJk3CLev3Dfe6mVuskTNry+raMb3mB5XBNmLDn6v5fbZh905czxI+wsxY55JNE70OPPbzWlLqu9HDFR84Mwm0w/79B9ln14MeX3iPAq6DP6/Iv1+I/LFnH+7Zb4gM/T35NvIN5vj0jHZ/l0VOU7Ou2M41dXapGelgLA2yZXP2j58jGGEF9l48Tue70wTaeTFWbne2Gak742doW8qdEY7fS9X10/S61yChE8gOPzwUOhW3CX7tMr68dbIUcivLe51ulzUFUf6qTIpzjUjz5j+/8KJuK6/vwgNdtZ/n04IrtejalBV35DYtSsrEjD7LQGZzkWcFATQx2fIn+B0v+hK4yaF9xsdgO5lW7vJNXB09MMeFneN/AtH2HAnGe4XQRQ==

Dear All,

While I am trying to prove some properties of my language, the following functions come up.

Inductive Sub : Set :=
| NullS : Sub
| SnocS : Sub -> Ty -> Sub
with Ty : Set :=
| TUnit : Ty
| TBox : Ty -> Ty
| TUnbox : nat -> nat -> Sub -> Ty
.

Fixpoint nth (s : Sub) (x : nat) : Ty :=
  match s with
  | NullS => TUnit
  | SnocS s' t' =>
    match x with
    | O => t'
    | S x' => nth s' x'
    end
  end
.
Fixpoint substSub (s : Sub) (n : nat) (s' : Sub) : Sub :=
  match s' with
  | NullS => NullS
  | SnocS s'' t'' => SnocS (substSub s n s'') (substTy s n t'')
  end
with substTy (s : Sub) (n : nat) (t' : Ty) : Ty :=
  match t' with
  | TUnit => TUnit
  | TBox t'' => TBox (substTy s n t'')
  | TUnbox x'' d'' s'' =>
    if eq_dec d'' n
    then
      match nth s x'' with
      | TBox t''' => substTy (substSub s n s'') d'' t'''
      | t''' => TUnit
      end
    else
      TUnbox x'' d'' (substSub s n s'')
  end
.

(I simplified the actual version a little)

However, substSub and substTy are clearly not structurally recursive, so I tried several measures in order to define them, but none of those worked. I also attempted to find a looping example, and that was also unsuccessful. Do these functions terminate? I will appreciate any helps to show these functions are terminating or non-terminating...

Thanks,
Clare Jang



Archive powered by MHonArc 2.6.19+.

Top of Page